Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .checkapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,7 @@ ignored_functions:
- ^Test.*
- ^Benchmark.*
- ^Fuzz.*

unkeyed_literal_initialization:
enabled: true
limit: 1 # this limit will increase over time to 5.
2 changes: 2 additions & 0 deletions connector/datadogconnector/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ var _ component.Config = (*Config)(nil)
type Config struct {
// Traces defines the Traces specific configuration
Traces datadogconfig.TracesConnectorConfig `mapstructure:"traces"`
// prevent unkeyed literal initialization
_ struct{}
}

// Validate checks if the configuration is valid
Expand Down
4 changes: 4 additions & 0 deletions connector/exceptionsconnector/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@ import (
type Dimension struct {
Name string `mapstructure:"name"`
Default *string `mapstructure:"default"`
// prevent unkeyed literal initialization
_ struct{}
}

type Exemplars struct {
Enabled bool `mapstructure:"enabled"`
// prevent unkeyed literal initialization
_ struct{}
}

// Config defines the configuration options for exceptionsconnector
Expand Down
22 changes: 11 additions & 11 deletions connector/exceptionsconnector/connector_metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,21 +124,21 @@ func newTestMetricsConnector(mcon consumer.Metrics, defaultNullValue *string, lo
cfg := &Config{
Dimensions: []Dimension{
// Set nil defaults to force a lookup for the attribute in the span.
{stringAttrName, nil},
{intAttrName, nil},
{doubleAttrName, nil},
{boolAttrName, nil},
{mapAttrName, nil},
{arrayAttrName, nil},
{nullAttrName, defaultNullValue},
{Name: stringAttrName},
{Name: intAttrName},
{Name: doubleAttrName},
{Name: boolAttrName},
{Name: mapAttrName},
{Name: arrayAttrName},
{Name: nullAttrName, Default: defaultNullValue},
// Add a default value for an attribute that doesn't exist in a span
{notInSpanAttrName0, stringp("defaultNotInSpanAttrVal")},
{Name: notInSpanAttrName0, Default: stringp("defaultNotInSpanAttrVal")},
// Leave the default value unset to test that this dimension should not be added to the metric.
{notInSpanAttrName1, nil},
{Name: notInSpanAttrName1},

// Exception specific dimensions
{exceptionTypeKey, nil},
{exceptionMessageKey, nil},
{Name: exceptionTypeKey},
{Name: exceptionMessageKey},
},
Exemplars: Exemplars{
Enabled: true,
Expand Down
3 changes: 3 additions & 0 deletions connector/servicegraphconnector/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,7 @@ type StoreConfig struct {
MaxItems int `mapstructure:"max_items"`
// TTL is the time to live for items in the store.
TTL time.Duration `mapstructure:"ttl"`

// prevent unkeyed literal initialization
_ struct{}
}
8 changes: 8 additions & 0 deletions connector/spanmetricsconnector/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,22 +107,30 @@ type HistogramConfig struct {
type ExemplarsConfig struct {
Enabled bool `mapstructure:"enabled"`
MaxPerDataPoint *int `mapstructure:"max_per_data_point"`
// prevent unkeyed literal initialization
_ struct{}
}

type ExponentialHistogramConfig struct {
MaxSize int32 `mapstructure:"max_size"`
// prevent unkeyed literal initialization
_ struct{}
}

type ExplicitHistogramConfig struct {
// Buckets is the list of durations representing explicit histogram buckets.
Buckets []time.Duration `mapstructure:"buckets"`
// prevent unkeyed literal initialization
_ struct{}
}

type EventsConfig struct {
// Enabled is a flag to enable events.
Enabled bool `mapstructure:"enabled"`
// Dimensions defines the list of dimensions to add to the events metric.
Dimensions []Dimension `mapstructure:"dimensions"`
// prevent unkeyed literal initialization
_ struct{}
}

var _ xconfmap.Validator = (*Config)(nil)
Expand Down
2 changes: 2 additions & 0 deletions exporter/awss3exporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ const (
type ResourceAttrsToS3 struct {
// S3Prefix indicates the mapping of the key (directory) prefix used for writing into the bucket to a specific resource attribute value.
S3Prefix string `mapstructure:"s3_prefix"`
// prevent unkeyed literal initialization
_ struct{}
}

// Config contains the main configuration options for the s3 exporter
Expand Down
6 changes: 6 additions & 0 deletions exporter/cassandraexporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,19 @@ type Config struct {
type Replication struct {
Class string `mapstructure:"class"`
ReplicationFactor int `mapstructure:"replication_factor"`
// prevent unkeyed literal initialization
_ struct{}
}

type Compression struct {
Algorithm string `mapstructure:"algorithm"`
// prevent unkeyed literal initialization
_ struct{}
}

type Auth struct {
UserName string `mapstructure:"username"`
Password configopaque.String `mapstructure:"password"`
// prevent unkeyed literal initialization
_ struct{}
}
27 changes: 27 additions & 0 deletions exporter/elasticsearchexporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,27 +129,42 @@ type TelemetrySettings struct {

LogFailedDocsInput bool `mapstructure:"log_failed_docs_input"`
LogFailedDocsInputRateLimit time.Duration `mapstructure:"log_failed_docs_input_rate_limit"`

// prevent unkeyed literal initialization
_ struct{}
}

type LogstashFormatSettings struct {
Enabled bool `mapstructure:"enabled"`
PrefixSeparator string `mapstructure:"prefix_separator"`
DateFormat string `mapstructure:"date_format"`

// prevent unkeyed literal initialization
_ struct{}
}

type DynamicIndexSetting struct {
// Enabled enables dynamic index routing.
//
// Deprecated: [v0.122.0] This config is now ignored. Dynamic index routing is always done by default.
Enabled bool `mapstructure:"enabled"`

// prevent unkeyed literal initialization
_ struct{}
}

type DynamicIDSettings struct {
Enabled bool `mapstructure:"enabled"`

// prevent unkeyed literal initialization
_ struct{}
}

type DynamicPipelineSettings struct {
Enabled bool `mapstructure:"enabled"`

// prevent unkeyed literal initialization
_ struct{}
}

// AuthenticationSettings defines user authentication related settings.
Expand All @@ -164,6 +179,9 @@ type AuthenticationSettings struct {
//
// https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-api-key.html
APIKey configopaque.String `mapstructure:"api_key"`

// prevent unkeyed literal initialization
_ struct{}
}

// DiscoverySettings defines Elasticsearch node discovery related settings.
Expand All @@ -183,6 +201,9 @@ type DiscoverySettings struct {
// Interval instructs the exporter to renew the list of Elasticsearch URLs
// with the given interval. URLs will not be updated if Interval is <=0.
Interval time.Duration `mapstructure:"interval"`

// prevent unkeyed literal initialization
_ struct{}
}

// FlushSettings defines settings for configuring the write buffer flushing
Expand All @@ -194,6 +215,9 @@ type FlushSettings struct {

// Interval configures the max age of a document in the send buffer.
Interval time.Duration `mapstructure:"interval"`

// prevent unkeyed literal initialization
_ struct{}
}

// RetrySettings defines settings for the HTTP request retries in the Elasticsearch exporter.
Expand Down Expand Up @@ -235,6 +259,9 @@ type MappingsSettings struct {
//
// If unspecified, all mapping modes are allowed.
AllowedModes []string `mapstructure:"allowed_modes"`

// prevent unkeyed literal initialization
_ struct{}
}

type MappingMode int
Expand Down
3 changes: 3 additions & 0 deletions exporter/honeycombmarkerexporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ type Marker struct {
type Rules struct {
// LogConditions is the list of ottllog conditions that determine a match
LogConditions []string `mapstructure:"log_conditions"`

// prevent unkeyed literal initialization
_ struct{}
}

var _ component.Config = (*Config)(nil)
Expand Down
10 changes: 10 additions & 0 deletions exporter/loadbalancingexporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ type Config struct {
// Protocol holds the individual protocol-specific settings. Only OTLP is supported at the moment.
type Protocol struct {
OTLP otlpexporter.Config `mapstructure:"otlp"`
// prevent unkeyed literal initialization
_ struct{}
}

// ResolverSettings defines the configurations for the backend resolver
Expand All @@ -62,11 +64,15 @@ type ResolverSettings struct {
DNS *DNSResolver `mapstructure:"dns"`
K8sSvc *K8sSvcResolver `mapstructure:"k8s"`
AWSCloudMap *AWSCloudMapResolver `mapstructure:"aws_cloud_map"`
// prevent unkeyed literal initialization
_ struct{}
}

// StaticResolver defines the configuration for the resolver providing a fixed list of backends
type StaticResolver struct {
Hostnames []string `mapstructure:"hostnames"`
// prevent unkeyed literal initialization
_ struct{}
}

// DNSResolver defines the configuration for the DNS resolver
Expand All @@ -75,6 +81,8 @@ type DNSResolver struct {
Port string `mapstructure:"port"`
Interval time.Duration `mapstructure:"interval"`
Timeout time.Duration `mapstructure:"timeout"`
// prevent unkeyed literal initialization
_ struct{}
}

// K8sSvcResolver defines the configuration for the DNS resolver
Expand All @@ -83,6 +91,8 @@ type K8sSvcResolver struct {
Ports []int32 `mapstructure:"ports"`
Timeout time.Duration `mapstructure:"timeout"`
ReturnHostnames bool `mapstructure:"return_hostnames"`
// prevent unkeyed literal initialization
_ struct{}
}

type AWSCloudMapResolver struct {
Expand Down
4 changes: 4 additions & 0 deletions exporter/logicmonitorexporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ type Config struct {
type APIToken struct {
AccessID string `mapstructure:"access_id"`
AccessKey configopaque.String `mapstructure:"access_key"`
// prevent unkeyed literal initialization
_ struct{}
}

type MappingOperation string
Expand All @@ -58,6 +60,8 @@ func (mop *MappingOperation) UnmarshalText(in []byte) error {
type LogsConfig struct {
// Operation to be performed for resource mapping. Valid values are `and`, `or`.
ResourceMappingOperation MappingOperation `mapstructure:"resource_mapping_op"`
// prevent unkeyed literal initialization
_ struct{}
}

func (c *Config) Validate() error {
Expand Down
9 changes: 9 additions & 0 deletions exporter/prometheusremotewriteexporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,17 @@ type Config struct {
type CreatedMetric struct {
// Enabled if true the _created metrics could be exported
Enabled bool `mapstructure:"enabled"`

// prevent unkeyed literal initialization
_ struct{}
}

type TargetInfo struct {
// Enabled if false the target_info metric is not generated by the exporter
Enabled bool `mapstructure:"enabled"`

// prevent unkeyed literal initialization
_ struct{}
}

// RemoteWriteQueue allows to configure the remote write queue.
Expand All @@ -82,6 +88,9 @@ type RemoteWriteQueue struct {
// NumWorkers configures the number of workers used by
// the collector to fan out remote write requests.
NumConsumers int `mapstructure:"num_consumers"`

// prevent unkeyed literal initialization
_ struct{}
}

// TODO(jbd): Add capacity, max_samples_per_send to QueueConfig.
Expand Down
2 changes: 2 additions & 0 deletions exporter/rabbitmqexporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ type RoutingConfig struct {

type AuthConfig struct {
Plain PlainAuth `mapstructure:"plain"`
// prevent unkeyed literal initialization
_ struct{}
}

type PlainAuth struct {
Expand Down
8 changes: 8 additions & 0 deletions extension/azureauthextension/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,32 @@ type Config struct {
Workload *WorkloadIdentity `mapstructure:"workload_identity"`
ServicePrincipal *ServicePrincipal `mapstructure:"service_principal"`
UseDefault bool `mapstructure:"use_default"`
// prevent unkeyed literal initialization
_ struct{}
}

type ManagedIdentity struct {
// if left empty, then it is system managed
ClientID string `mapstructure:"client_id"`
// prevent unkeyed literal initialization
_ struct{}
}

type WorkloadIdentity struct {
ClientID string `mapstructure:"client_id"`
TenantID string `mapstructure:"tenant_id"`
FederatedTokenFile string `mapstructure:"federated_token_file"`
// prevent unkeyed literal initialization
_ struct{}
}

type ServicePrincipal struct {
TenantID string `mapstructure:"tenant_id"`
ClientID string `mapstructure:"client_id"`
ClientSecret string `mapstructure:"client_secret"`
ClientCertificatePath string `mapstructure:"client_certificate_path"`
// prevent unkeyed literal initialization
_ struct{}
}

var _ component.Config = (*Config)(nil)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ type Config struct {
//
// See https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudwatch-metricstream.html#cfn-cloudwatch-metricstream-outputformat
Format string `mapstructure:"format"`

// prevent unkeyed literal initialization
_ struct{}
}

func (cfg *Config) Validate() error {
Expand Down
5 changes: 5 additions & 0 deletions extension/encoding/awslogsencodingextension/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ type Config struct {
Format string `mapstructure:"format"`

VPCFlowLogConfig VPCFlowLogConfig `mapstructure:"vpc_flow_log"`

// prevent unkeyed literal initialization
_ struct{}
}

type VPCFlowLogConfig struct {
Expand All @@ -45,6 +48,8 @@ type VPCFlowLogConfig struct {
//
// See https://docs.aws.amazon.com/vpc/latest/userguide/flow-logs-s3-path.html.
FileFormat string `mapstructure:"file_format"`
// prevent unkeyed literal initialization
_ struct{}
}

func (cfg *Config) Validate() error {
Expand Down
Loading
Loading