diff --git a/config/config.go b/config/config.go index 60533b7b5cd..e2599766fe3 100644 --- a/config/config.go +++ b/config/config.go @@ -150,6 +150,7 @@ func ParseYAML(file []byte) (*OpenTelemetryConfiguration, error) { return &cfg, nil } + func toStringMap(pairs []NameStringValuePair) map[string]string { output := make(map[string]string) for _, v := range pairs { diff --git a/config/config_test.go b/config/config_test.go index c6b33b66e12..4a50fff81f9 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -78,13 +78,88 @@ func TestNewSDK(t *testing.T) { } } -var v02OpenTelemetryConfig = OpenTelemetryConfiguration{ +var v03OpenTelemetryConfig = OpenTelemetryConfiguration{ Disabled: ptr(false), - FileFormat: "0.2", + FileFormat: ptr("0.3"), AttributeLimits: &AttributeLimits{ AttributeCountLimit: ptr(128), AttributeValueLengthLimit: ptr(4096), }, + Instrumentation: &Instrumentation{ + Cpp: LanguageSpecificInstrumentation{ + "example": map[string]interface{}{ + "property": "value", + }, + }, + Dotnet: LanguageSpecificInstrumentation{ + "example": map[string]interface{}{ + "property": "value", + }, + }, + Erlang: LanguageSpecificInstrumentation{ + "example": map[string]interface{}{ + "property": "value", + }, + }, + General: &GeneralInstrumentation{ + Http: &GeneralInstrumentationHttp{ + Client: &GeneralInstrumentationHttpClient{ + RequestCapturedHeaders: []string{"Content-Type", "Accept"}, + ResponseCapturedHeaders: []string{"Content-Type", "Content-Encoding"}, + }, + Server: &GeneralInstrumentationHttpServer{ + RequestCapturedHeaders: []string{"Content-Type", "Accept"}, + ResponseCapturedHeaders: []string{"Content-Type", "Content-Encoding"}, + }, + }, + Peer: &GeneralInstrumentationPeer{ + ServiceMapping: []GeneralInstrumentationPeerServiceMappingElem{ + {Peer: "1.2.3.4", Service: "FooService"}, + {Peer: "2.3.4.5", Service: "BarService"}, + }, + }, + }, + Go: LanguageSpecificInstrumentation{ + "example": map[string]interface{}{ + "property": "value", + }, + }, + Java: LanguageSpecificInstrumentation{ + "example": map[string]interface{}{ + "property": "value", + }, + }, + Js: LanguageSpecificInstrumentation{ + "example": map[string]interface{}{ + "property": "value", + }, + }, + Php: LanguageSpecificInstrumentation{ + "example": map[string]interface{}{ + "property": "value", + }, + }, + Python: LanguageSpecificInstrumentation{ + "example": map[string]interface{}{ + "property": "value", + }, + }, + Ruby: LanguageSpecificInstrumentation{ + "example": map[string]interface{}{ + "property": "value", + }, + }, + Rust: LanguageSpecificInstrumentation{ + "example": map[string]interface{}{ + "property": "value", + }, + }, + Swift: LanguageSpecificInstrumentation{ + "example": map[string]interface{}{ + "property": "value", + }, + }, + }, LoggerProvider: &LoggerProvider{ Limits: &LogRecordLimits{ AttributeCountLimit: ptr(128), @@ -100,13 +175,14 @@ var v02OpenTelemetryConfig = OpenTelemetryConfiguration{ ClientCertificate: ptr("/app/cert.pem"), ClientKey: ptr("/app/cert.pem"), Compression: ptr("gzip"), - Endpoint: "http://localhost:4318", - Headers: Headers{ - "api-key": "1234", + Endpoint: ptr("http://localhost:4318/v1/logs"), + Headers: []NameStringValuePair{ + {Name: "api-key", Value: ptr("1234")}, }, - Insecure: ptr(false), - Protocol: "http/protobuf", - Timeout: ptr(10000), + HeadersList: ptr("api-key=1234"), + Insecure: ptr(false), + Protocol: ptr("http/protobuf"), + Timeout: ptr(10000), }, }, MaxExportBatchSize: ptr(512), @@ -126,8 +202,11 @@ var v02OpenTelemetryConfig = OpenTelemetryConfiguration{ MeterProvider: &MeterProvider{ Readers: []MetricReader{ { + Producers: []MetricProducer{ + {Opencensus: MetricProducerOpencensus{}}, + }, Pull: &PullMetricReader{ - Exporter: MetricExporter{ + Exporter: PullMetricExporter{ Prometheus: &Prometheus{ Host: ptr("localhost"), Port: ptr(9464), @@ -143,20 +222,24 @@ var v02OpenTelemetryConfig = OpenTelemetryConfiguration{ }, }, { + Producers: []MetricProducer{ + {}, + }, Periodic: &PeriodicMetricReader{ - Exporter: MetricExporter{ + Exporter: PushMetricExporter{ OTLP: &OTLPMetric{ Certificate: ptr("/app/cert.pem"), ClientCertificate: ptr("/app/cert.pem"), ClientKey: ptr("/app/cert.pem"), Compression: ptr("gzip"), DefaultHistogramAggregation: ptr(OTLPMetricDefaultHistogramAggregationBase2ExponentialBucketHistogram), - Endpoint: "http://localhost:4318", - Headers: Headers{ - "api-key": "1234", + Endpoint: ptr("http://localhost:4318/v1/metrics"), + Headers: []NameStringValuePair{ + {Name: "api-key", Value: ptr("1234")}, }, + HeadersList: ptr("api-key=1234"), Insecure: ptr(false), - Protocol: "http/protobuf", + Protocol: ptr("http/protobuf"), TemporalityPreference: ptr("delta"), Timeout: ptr(10000), }, @@ -167,7 +250,7 @@ var v02OpenTelemetryConfig = OpenTelemetryConfiguration{ }, { Periodic: &PeriodicMetricReader{ - Exporter: MetricExporter{ + Exporter: PushMetricExporter{ Console: Console{}, }, }, @@ -190,20 +273,32 @@ var v02OpenTelemetryConfig = OpenTelemetryConfiguration{ RecordMinMax: ptr(true), }, }, - AttributeKeys: []string{"key1", "key2"}, - Description: ptr("new_description"), - Name: ptr("new_instrument_name"), + AttributeKeys: &IncludeExclude{ + Included: []string{"key1", "key2"}, + Excluded: []string{"key3"}, + }, + Description: ptr("new_description"), + Name: ptr("new_instrument_name"), }, }, }, }, Propagator: &Propagator{ - Composite: []string{"tracecontext", "baggage", "b3", "b3multi", "jaeger", "xray", "ottrace"}, + Composite: []*string{ptr("tracecontext"), ptr("baggage"), ptr("b3"), ptr("b3multi"), ptr("jaeger"), ptr("xray"), ptr("ottrace")}, }, Resource: &Resource{ - Attributes: Attributes{ - "service.name": "unknown_service", + Attributes: []AttributeNameValue{ + {Name: "service.name", Value: "unknown_service"}, + {Name: "string_key", Type: &AttributeNameValueType{Value: "string"}, Value: "value"}, + {Name: "bool_key", Type: &AttributeNameValueType{Value: "bool"}, Value: true}, + {Name: "int_key", Type: &AttributeNameValueType{Value: "int"}, Value: float64(1)}, + {Name: "double_key", Type: &AttributeNameValueType{Value: "double"}, Value: 1.1}, + {Name: "string_array_key", Type: &AttributeNameValueType{Value: "string_array"}, Value: []interface{}{"value1", "value2"}}, + {Name: "bool_array_key", Type: &AttributeNameValueType{Value: "bool_array"}, Value: []interface{}{true, false}}, + {Name: "int_array_key", Type: &AttributeNameValueType{Value: "int_array"}, Value: []interface{}{float64(1), float64(2)}}, + {Name: "double_array_key", Type: &AttributeNameValueType{Value: "double_array"}, Value: []interface{}{1.1, 2.2}}, }, + AttributesList: ptr("service.namespace=my-namespace,service.version=1.0.0"), Detectors: &Detectors{ Attributes: &DetectorsAttributes{ Excluded: []string{"process.command_args"}, @@ -231,13 +326,14 @@ var v02OpenTelemetryConfig = OpenTelemetryConfiguration{ ClientCertificate: ptr("/app/cert.pem"), ClientKey: ptr("/app/cert.pem"), Compression: ptr("gzip"), - Endpoint: "http://localhost:4318", - Headers: Headers{ - "api-key": "1234", + Endpoint: ptr("http://localhost:4318/v1/traces"), + Headers: []NameStringValuePair{ + {Name: "api-key", Value: ptr("1234")}, }, - Insecure: ptr(false), - Protocol: "http/protobuf", - Timeout: ptr(10000), + HeadersList: ptr("api-key=1234"), + Insecure: ptr(false), + Protocol: ptr("http/protobuf"), + Timeout: ptr(10000), }, }, MaxExportBatchSize: ptr(512), @@ -249,7 +345,7 @@ var v02OpenTelemetryConfig = OpenTelemetryConfiguration{ Batch: &BatchSpanProcessor{ Exporter: SpanExporter{ Zipkin: &Zipkin{ - Endpoint: "http://localhost:9411/api/v2/spans", + Endpoint: ptr("http://localhost:9411/api/v2/spans"), Timeout: ptr(10000), }, }, @@ -300,7 +396,7 @@ func TestParseYAML(t *testing.T) { wantErr: nil, wantType: &OpenTelemetryConfiguration{ Disabled: ptr(false), - FileFormat: "0.1", + FileFormat: ptr("0.1"), }, }, { @@ -310,9 +406,19 @@ func TestParseYAML(t *testing.T) { line 2: cannot unmarshal !!str ` + "`notabool`" + ` into bool`), }, { - name: "valid v0.2 config", - input: "v0.2.yaml", - wantType: &v02OpenTelemetryConfig, + name: "valid v0.2 config", + input: "v0.2.yaml", + wantErr: errors.New(`yaml: unmarshal errors: + line 81: cannot unmarshal !!map into []config.NameStringValuePair + line 185: cannot unmarshal !!map into []config.NameStringValuePair + line 244: cannot unmarshal !!seq into config.IncludeExclude + line 305: cannot unmarshal !!map into []config.NameStringValuePair + line 408: cannot unmarshal !!map into []config.AttributeNameValue`), + }, + { + name: "valid v0.3 config", + input: "v0.3.yaml", + wantType: &v03OpenTelemetryConfig, }, } @@ -345,7 +451,7 @@ func TestSerializeJSON(t *testing.T) { wantErr: nil, wantType: OpenTelemetryConfiguration{ Disabled: ptr(false), - FileFormat: "0.1", + FileFormat: ptr("0.1"), }, }, { @@ -354,9 +460,14 @@ func TestSerializeJSON(t *testing.T) { wantErr: errors.New(`json: cannot unmarshal string into Go struct field Plain.disabled of type bool`), }, { - name: "valid v0.2 config", - input: "v0.2.json", - wantType: v02OpenTelemetryConfig, + name: "valid v0.2 config", + input: "v0.2.json", + wantErr: errors.New(`json: cannot unmarshal object into Go struct field LogRecordProcessor.logger_provider.processors.batch of type []config.NameStringValuePair`), + }, + { + name: "valid v0.3 config", + input: "v0.3.json", + wantType: v03OpenTelemetryConfig, }, } diff --git a/config/generated_config.go b/config/generated_config.go index 2315641db64..a00d6a9f010 100644 --- a/config/generated_config.go +++ b/config/generated_config.go @@ -18,7 +18,80 @@ type AttributeLimits struct { AdditionalProperties interface{} } -type Attributes map[string]interface{} +type AttributeNameValue struct { + // Name corresponds to the JSON schema field "name". + Name string `json:"name" yaml:"name" mapstructure:"name"` + + // Type corresponds to the JSON schema field "type". + Type *AttributeNameValueType `json:"type,omitempty" yaml:"type,omitempty" mapstructure:"type,omitempty"` + + // Value corresponds to the JSON schema field "value". + Value interface{} `json:"value" yaml:"value" mapstructure:"value"` +} + +type AttributeNameValueType struct { + Value interface{} +} + +// MarshalJSON implements json.Marshaler. +func (j *AttributeNameValueType) MarshalJSON() ([]byte, error) { + return json.Marshal(j.Value) +} + +var enumValues_AttributeNameValueType = []interface{}{ + nil, + "string", + "bool", + "int", + "double", + "string_array", + "bool_array", + "int_array", + "double_array", +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *AttributeNameValueType) UnmarshalJSON(b []byte) error { + var v struct { + Value interface{} + } + if err := json.Unmarshal(b, &v.Value); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_AttributeNameValueType { + if reflect.DeepEqual(v.Value, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_AttributeNameValueType, v.Value) + } + *j = AttributeNameValueType(v) + return nil +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *AttributeNameValue) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + if _, ok := raw["name"]; raw != nil && !ok { + return fmt.Errorf("field name in AttributeNameValue: required") + } + if _, ok := raw["value"]; raw != nil && !ok { + return fmt.Errorf("field value in AttributeNameValue: required") + } + type Plain AttributeNameValue + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = AttributeNameValue(plain) + return nil +} type BatchLogRecordProcessor struct { // ExportTimeout corresponds to the JSON schema field "export_timeout". @@ -109,7 +182,75 @@ type DetectorsAttributes struct { Included []string `json:"included,omitempty" yaml:"included,omitempty" mapstructure:"included,omitempty"` } -type Headers map[string]string +type GeneralInstrumentation struct { + // Http corresponds to the JSON schema field "http". + Http *GeneralInstrumentationHttp `json:"http,omitempty" yaml:"http,omitempty" mapstructure:"http,omitempty"` + + // Peer corresponds to the JSON schema field "peer". + Peer *GeneralInstrumentationPeer `json:"peer,omitempty" yaml:"peer,omitempty" mapstructure:"peer,omitempty"` +} + +type GeneralInstrumentationHttp struct { + // Client corresponds to the JSON schema field "client". + Client *GeneralInstrumentationHttpClient `json:"client,omitempty" yaml:"client,omitempty" mapstructure:"client,omitempty"` + + // Server corresponds to the JSON schema field "server". + Server *GeneralInstrumentationHttpServer `json:"server,omitempty" yaml:"server,omitempty" mapstructure:"server,omitempty"` +} + +type GeneralInstrumentationHttpClient struct { + // RequestCapturedHeaders corresponds to the JSON schema field + // "request_captured_headers". + RequestCapturedHeaders []string `json:"request_captured_headers,omitempty" yaml:"request_captured_headers,omitempty" mapstructure:"request_captured_headers,omitempty"` + + // ResponseCapturedHeaders corresponds to the JSON schema field + // "response_captured_headers". + ResponseCapturedHeaders []string `json:"response_captured_headers,omitempty" yaml:"response_captured_headers,omitempty" mapstructure:"response_captured_headers,omitempty"` +} + +type GeneralInstrumentationHttpServer struct { + // RequestCapturedHeaders corresponds to the JSON schema field + // "request_captured_headers". + RequestCapturedHeaders []string `json:"request_captured_headers,omitempty" yaml:"request_captured_headers,omitempty" mapstructure:"request_captured_headers,omitempty"` + + // ResponseCapturedHeaders corresponds to the JSON schema field + // "response_captured_headers". + ResponseCapturedHeaders []string `json:"response_captured_headers,omitempty" yaml:"response_captured_headers,omitempty" mapstructure:"response_captured_headers,omitempty"` +} + +type GeneralInstrumentationPeer struct { + // ServiceMapping corresponds to the JSON schema field "service_mapping". + ServiceMapping []GeneralInstrumentationPeerServiceMappingElem `json:"service_mapping,omitempty" yaml:"service_mapping,omitempty" mapstructure:"service_mapping,omitempty"` +} + +type GeneralInstrumentationPeerServiceMappingElem struct { + // Peer corresponds to the JSON schema field "peer". + Peer string `json:"peer" yaml:"peer" mapstructure:"peer"` + + // Service corresponds to the JSON schema field "service". + Service string `json:"service" yaml:"service" mapstructure:"service"` +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *GeneralInstrumentationPeerServiceMappingElem) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + if _, ok := raw["peer"]; raw != nil && !ok { + return fmt.Errorf("field peer in GeneralInstrumentationPeerServiceMappingElem: required") + } + if _, ok := raw["service"]; raw != nil && !ok { + return fmt.Errorf("field service in GeneralInstrumentationPeerServiceMappingElem: required") + } + type Plain GeneralInstrumentationPeerServiceMappingElem + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = GeneralInstrumentationPeerServiceMappingElem(plain) + return nil +} type IncludeExclude struct { // Excluded corresponds to the JSON schema field "excluded". @@ -119,6 +260,46 @@ type IncludeExclude struct { Included []string `json:"included,omitempty" yaml:"included,omitempty" mapstructure:"included,omitempty"` } +type Instrumentation struct { + // Cpp corresponds to the JSON schema field "cpp". + Cpp LanguageSpecificInstrumentation `json:"cpp,omitempty" yaml:"cpp,omitempty" mapstructure:"cpp,omitempty"` + + // Dotnet corresponds to the JSON schema field "dotnet". + Dotnet LanguageSpecificInstrumentation `json:"dotnet,omitempty" yaml:"dotnet,omitempty" mapstructure:"dotnet,omitempty"` + + // Erlang corresponds to the JSON schema field "erlang". + Erlang LanguageSpecificInstrumentation `json:"erlang,omitempty" yaml:"erlang,omitempty" mapstructure:"erlang,omitempty"` + + // General corresponds to the JSON schema field "general". + General *GeneralInstrumentation `json:"general,omitempty" yaml:"general,omitempty" mapstructure:"general,omitempty"` + + // Go corresponds to the JSON schema field "go". + Go LanguageSpecificInstrumentation `json:"go,omitempty" yaml:"go,omitempty" mapstructure:"go,omitempty"` + + // Java corresponds to the JSON schema field "java". + Java LanguageSpecificInstrumentation `json:"java,omitempty" yaml:"java,omitempty" mapstructure:"java,omitempty"` + + // Js corresponds to the JSON schema field "js". + Js LanguageSpecificInstrumentation `json:"js,omitempty" yaml:"js,omitempty" mapstructure:"js,omitempty"` + + // Php corresponds to the JSON schema field "php". + Php LanguageSpecificInstrumentation `json:"php,omitempty" yaml:"php,omitempty" mapstructure:"php,omitempty"` + + // Python corresponds to the JSON schema field "python". + Python LanguageSpecificInstrumentation `json:"python,omitempty" yaml:"python,omitempty" mapstructure:"python,omitempty"` + + // Ruby corresponds to the JSON schema field "ruby". + Ruby LanguageSpecificInstrumentation `json:"ruby,omitempty" yaml:"ruby,omitempty" mapstructure:"ruby,omitempty"` + + // Rust corresponds to the JSON schema field "rust". + Rust LanguageSpecificInstrumentation `json:"rust,omitempty" yaml:"rust,omitempty" mapstructure:"rust,omitempty"` + + // Swift corresponds to the JSON schema field "swift". + Swift LanguageSpecificInstrumentation `json:"swift,omitempty" yaml:"swift,omitempty" mapstructure:"swift,omitempty"` +} + +type LanguageSpecificInstrumentation map[string]interface{} + type LogRecordExporter struct { // Console corresponds to the JSON schema field "console". Console Console `json:"console,omitempty" yaml:"console,omitempty" mapstructure:"console,omitempty"` @@ -165,27 +346,55 @@ type MeterProvider struct { Views []View `json:"views,omitempty" yaml:"views,omitempty" mapstructure:"views,omitempty"` } -type MetricExporter struct { - // Console corresponds to the JSON schema field "console". - Console Console `json:"console,omitempty" yaml:"console,omitempty" mapstructure:"console,omitempty"` - - // OTLP corresponds to the JSON schema field "otlp". - OTLP *OTLPMetric `json:"otlp,omitempty" yaml:"otlp,omitempty" mapstructure:"otlp,omitempty"` - - // Prometheus corresponds to the JSON schema field "prometheus". - Prometheus *Prometheus `json:"prometheus,omitempty" yaml:"prometheus,omitempty" mapstructure:"prometheus,omitempty"` +type MetricProducer struct { + // Opencensus corresponds to the JSON schema field "opencensus". + Opencensus MetricProducerOpencensus `json:"opencensus,omitempty" yaml:"opencensus,omitempty" mapstructure:"opencensus,omitempty"` AdditionalProperties interface{} } +type MetricProducerOpencensus map[string]interface{} + type MetricReader struct { // Periodic corresponds to the JSON schema field "periodic". Periodic *PeriodicMetricReader `json:"periodic,omitempty" yaml:"periodic,omitempty" mapstructure:"periodic,omitempty"` + // Producers corresponds to the JSON schema field "producers". + Producers []MetricProducer `json:"producers,omitempty" yaml:"producers,omitempty" mapstructure:"producers,omitempty"` + // Pull corresponds to the JSON schema field "pull". Pull *PullMetricReader `json:"pull,omitempty" yaml:"pull,omitempty" mapstructure:"pull,omitempty"` } +type NameStringValuePair struct { + // Name corresponds to the JSON schema field "name". + Name string `json:"name" yaml:"name" mapstructure:"name"` + + // Value corresponds to the JSON schema field "value". + Value *string `json:"value" yaml:"value" mapstructure:"value"` +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *NameStringValuePair) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + if _, ok := raw["name"]; raw != nil && !ok { + return fmt.Errorf("field name in NameStringValuePair: required") + } + if _, ok := raw["value"]; raw != nil && !ok { + return fmt.Errorf("field value in NameStringValuePair: required") + } + type Plain NameStringValuePair + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = NameStringValuePair(plain) + return nil +} + type OTLP struct { // Certificate corresponds to the JSON schema field "certificate". Certificate *string `json:"certificate,omitempty" yaml:"certificate,omitempty" mapstructure:"certificate,omitempty"` @@ -200,16 +409,19 @@ type OTLP struct { Compression *string `json:"compression,omitempty" yaml:"compression,omitempty" mapstructure:"compression,omitempty"` // Endpoint corresponds to the JSON schema field "endpoint". - Endpoint string `json:"endpoint" yaml:"endpoint" mapstructure:"endpoint"` + Endpoint *string `json:"endpoint" yaml:"endpoint" mapstructure:"endpoint"` // Headers corresponds to the JSON schema field "headers". - Headers Headers `json:"headers,omitempty" yaml:"headers,omitempty" mapstructure:"headers,omitempty"` + Headers []NameStringValuePair `json:"headers,omitempty" yaml:"headers,omitempty" mapstructure:"headers,omitempty"` + + // HeadersList corresponds to the JSON schema field "headers_list". + HeadersList *string `json:"headers_list,omitempty" yaml:"headers_list,omitempty" mapstructure:"headers_list,omitempty"` // Insecure corresponds to the JSON schema field "insecure". Insecure *bool `json:"insecure,omitempty" yaml:"insecure,omitempty" mapstructure:"insecure,omitempty"` // Protocol corresponds to the JSON schema field "protocol". - Protocol string `json:"protocol" yaml:"protocol" mapstructure:"protocol"` + Protocol *string `json:"protocol" yaml:"protocol" mapstructure:"protocol"` // Timeout corresponds to the JSON schema field "timeout". Timeout *int `json:"timeout,omitempty" yaml:"timeout,omitempty" mapstructure:"timeout,omitempty"` @@ -233,16 +445,19 @@ type OTLPMetric struct { DefaultHistogramAggregation *OTLPMetricDefaultHistogramAggregation `json:"default_histogram_aggregation,omitempty" yaml:"default_histogram_aggregation,omitempty" mapstructure:"default_histogram_aggregation,omitempty"` // Endpoint corresponds to the JSON schema field "endpoint". - Endpoint string `json:"endpoint" yaml:"endpoint" mapstructure:"endpoint"` + Endpoint *string `json:"endpoint" yaml:"endpoint" mapstructure:"endpoint"` // Headers corresponds to the JSON schema field "headers". - Headers Headers `json:"headers,omitempty" yaml:"headers,omitempty" mapstructure:"headers,omitempty"` + Headers []NameStringValuePair `json:"headers,omitempty" yaml:"headers,omitempty" mapstructure:"headers,omitempty"` + + // HeadersList corresponds to the JSON schema field "headers_list". + HeadersList *string `json:"headers_list,omitempty" yaml:"headers_list,omitempty" mapstructure:"headers_list,omitempty"` // Insecure corresponds to the JSON schema field "insecure". Insecure *bool `json:"insecure,omitempty" yaml:"insecure,omitempty" mapstructure:"insecure,omitempty"` // Protocol corresponds to the JSON schema field "protocol". - Protocol string `json:"protocol" yaml:"protocol" mapstructure:"protocol"` + Protocol *string `json:"protocol" yaml:"protocol" mapstructure:"protocol"` // TemporalityPreference corresponds to the JSON schema field // "temporality_preference". @@ -332,7 +547,10 @@ type OpenTelemetryConfiguration struct { Disabled *bool `json:"disabled,omitempty" yaml:"disabled,omitempty" mapstructure:"disabled,omitempty"` // FileFormat corresponds to the JSON schema field "file_format". - FileFormat string `json:"file_format" yaml:"file_format" mapstructure:"file_format"` + FileFormat *string `json:"file_format" yaml:"file_format" mapstructure:"file_format"` + + // Instrumentation corresponds to the JSON schema field "instrumentation". + Instrumentation *Instrumentation `json:"instrumentation,omitempty" yaml:"instrumentation,omitempty" mapstructure:"instrumentation,omitempty"` // LoggerProvider corresponds to the JSON schema field "logger_provider". LoggerProvider *LoggerProvider `json:"logger_provider,omitempty" yaml:"logger_provider,omitempty" mapstructure:"logger_provider,omitempty"` @@ -372,7 +590,7 @@ func (j *OpenTelemetryConfiguration) UnmarshalJSON(b []byte) error { type PeriodicMetricReader struct { // Exporter corresponds to the JSON schema field "exporter". - Exporter MetricExporter `json:"exporter" yaml:"exporter" mapstructure:"exporter"` + Exporter PushMetricExporter `json:"exporter" yaml:"exporter" mapstructure:"exporter"` // Interval corresponds to the JSON schema field "interval". Interval *int `json:"interval,omitempty" yaml:"interval,omitempty" mapstructure:"interval,omitempty"` @@ -422,14 +640,21 @@ type Prometheus struct { type Propagator struct { // Composite corresponds to the JSON schema field "composite". - Composite []string `json:"composite,omitempty" yaml:"composite,omitempty" mapstructure:"composite,omitempty"` + Composite []*string `json:"composite,omitempty" yaml:"composite,omitempty" mapstructure:"composite,omitempty"` + + AdditionalProperties interface{} +} + +type PullMetricExporter struct { + // Prometheus corresponds to the JSON schema field "prometheus". + Prometheus *Prometheus `json:"prometheus,omitempty" yaml:"prometheus,omitempty" mapstructure:"prometheus,omitempty"` AdditionalProperties interface{} } type PullMetricReader struct { // Exporter corresponds to the JSON schema field "exporter". - Exporter MetricExporter `json:"exporter" yaml:"exporter" mapstructure:"exporter"` + Exporter PullMetricExporter `json:"exporter" yaml:"exporter" mapstructure:"exporter"` } // UnmarshalJSON implements json.Unmarshaler. @@ -450,9 +675,22 @@ func (j *PullMetricReader) UnmarshalJSON(b []byte) error { return nil } +type PushMetricExporter struct { + // Console corresponds to the JSON schema field "console". + Console Console `json:"console,omitempty" yaml:"console,omitempty" mapstructure:"console,omitempty"` + + // OTLP corresponds to the JSON schema field "otlp". + OTLP *OTLPMetric `json:"otlp,omitempty" yaml:"otlp,omitempty" mapstructure:"otlp,omitempty"` + + AdditionalProperties interface{} +} + type Resource struct { // Attributes corresponds to the JSON schema field "attributes". - Attributes Attributes `json:"attributes,omitempty" yaml:"attributes,omitempty" mapstructure:"attributes,omitempty"` + Attributes []AttributeNameValue `json:"attributes,omitempty" yaml:"attributes,omitempty" mapstructure:"attributes,omitempty"` + + // AttributesList corresponds to the JSON schema field "attributes_list". + AttributesList *string `json:"attributes_list,omitempty" yaml:"attributes_list,omitempty" mapstructure:"attributes_list,omitempty"` // Detectors corresponds to the JSON schema field "detectors". Detectors *Detectors `json:"detectors,omitempty" yaml:"detectors,omitempty" mapstructure:"detectors,omitempty"` @@ -695,7 +933,7 @@ type ViewStream struct { Aggregation *ViewStreamAggregation `json:"aggregation,omitempty" yaml:"aggregation,omitempty" mapstructure:"aggregation,omitempty"` // AttributeKeys corresponds to the JSON schema field "attribute_keys". - AttributeKeys []string `json:"attribute_keys,omitempty" yaml:"attribute_keys,omitempty" mapstructure:"attribute_keys,omitempty"` + AttributeKeys *IncludeExclude `json:"attribute_keys,omitempty" yaml:"attribute_keys,omitempty" mapstructure:"attribute_keys,omitempty"` // Description corresponds to the JSON schema field "description". Description *string `json:"description,omitempty" yaml:"description,omitempty" mapstructure:"description,omitempty"` @@ -755,7 +993,7 @@ type ViewStreamAggregationSum map[string]interface{} type Zipkin struct { // Endpoint corresponds to the JSON schema field "endpoint". - Endpoint string `json:"endpoint" yaml:"endpoint" mapstructure:"endpoint"` + Endpoint *string `json:"endpoint" yaml:"endpoint" mapstructure:"endpoint"` // Timeout corresponds to the JSON schema field "timeout". Timeout *int `json:"timeout,omitempty" yaml:"timeout,omitempty" mapstructure:"timeout,omitempty"` diff --git a/config/testdata/v0.3.json b/config/testdata/v0.3.json new file mode 100644 index 00000000000..b789a9dfdb0 --- /dev/null +++ b/config/testdata/v0.3.json @@ -0,0 +1,419 @@ +{ + "file_format": "0.3", + "disabled": false, + "attribute_limits": { + "attribute_value_length_limit": 4096, + "attribute_count_limit": 128 + }, + "logger_provider": { + "processors": [ + { + "batch": { + "schedule_delay": 5000, + "export_timeout": 30000, + "max_queue_size": 2048, + "max_export_batch_size": 512, + "exporter": { + "otlp": { + "protocol": "http/protobuf", + "endpoint": "http://localhost:4318/v1/logs", + "certificate": "/app/cert.pem", + "client_key": "/app/cert.pem", + "client_certificate": "/app/cert.pem", + "headers": [ + { + "name": "api-key", + "value": "1234" + } + ], + "headers_list": "api-key=1234", + "compression": "gzip", + "timeout": 10000, + "insecure": false + } + } + } + }, + { + "simple": { + "exporter": { + "console": {} + } + } + } + ], + "limits": { + "attribute_value_length_limit": 4096, + "attribute_count_limit": 128 + } + }, + "meter_provider": { + "readers": [ + { + "pull": { + "exporter": { + "prometheus": { + "host": "localhost", + "port": 9464, + "without_units": false, + "without_type_suffix": false, + "without_scope_info": false, + "with_resource_constant_labels": { + "included": [ + "service*" + ], + "excluded": [ + "service.attr1" + ] + } + } + } + }, + "producers": [ + { + "opencensus": {} + } + ] + }, + { + "periodic": { + "interval": 5000, + "timeout": 30000, + "exporter": { + "otlp": { + "protocol": "http/protobuf", + "endpoint": "http://localhost:4318/v1/metrics", + "certificate": "/app/cert.pem", + "client_key": "/app/cert.pem", + "client_certificate": "/app/cert.pem", + "headers": [ + { + "name": "api-key", + "value": "1234" + } + ], + "headers_list": "api-key=1234", + "compression": "gzip", + "timeout": 10000, + "insecure": false, + "temporality_preference": "delta", + "default_histogram_aggregation": "base2_exponential_bucket_histogram" + } + } + }, + "producers": [ + { + "prometheus": {} + } + ] + }, + { + "periodic": { + "exporter": { + "console": {} + } + } + } + ], + "views": [ + { + "selector": { + "instrument_name": "my-instrument", + "instrument_type": "histogram", + "unit": "ms", + "meter_name": "my-meter", + "meter_version": "1.0.0", + "meter_schema_url": "https://opentelemetry.io/schemas/1.16.0" + }, + "stream": { + "name": "new_instrument_name", + "description": "new_description", + "aggregation": { + "explicit_bucket_histogram": { + "boundaries": [ + 0, + 5, + 10, + 25, + 50, + 75, + 100, + 250, + 500, + 750, + 1000, + 2500, + 5000, + 7500, + 10000 + ], + "record_min_max": true + } + }, + "attribute_keys": { + "included": [ + "key1", + "key2" + ], + "excluded": [ + "key3" + ] + } + } + } + ] + }, + "propagator": { + "composite": [ + "tracecontext", + "baggage", + "b3", + "b3multi", + "jaeger", + "xray", + "ottrace" + ] + }, + "tracer_provider": { + "processors": [ + { + "batch": { + "schedule_delay": 5000, + "export_timeout": 30000, + "max_queue_size": 2048, + "max_export_batch_size": 512, + "exporter": { + "otlp": { + "protocol": "http/protobuf", + "endpoint": "http://localhost:4318/v1/traces", + "certificate": "/app/cert.pem", + "client_key": "/app/cert.pem", + "client_certificate": "/app/cert.pem", + "headers": [ + { + "name": "api-key", + "value": "1234" + } + ], + "headers_list": "api-key=1234", + "compression": "gzip", + "timeout": 10000, + "insecure": false + } + } + } + }, + { + "batch": { + "exporter": { + "zipkin": { + "endpoint": "http://localhost:9411/api/v2/spans", + "timeout": 10000 + } + } + } + }, + { + "simple": { + "exporter": { + "console": {} + } + } + } + ], + "limits": { + "attribute_value_length_limit": 4096, + "attribute_count_limit": 128, + "event_count_limit": 128, + "link_count_limit": 128, + "event_attribute_count_limit": 128, + "link_attribute_count_limit": 128 + }, + "sampler": { + "parent_based": { + "root": { + "trace_id_ratio_based": { + "ratio": 0.0001 + } + }, + "remote_parent_sampled": { + "always_on": {} + }, + "remote_parent_not_sampled": { + "always_off": {} + }, + "local_parent_sampled": { + "always_on": {} + }, + "local_parent_not_sampled": { + "always_off": {} + } + } + } + }, + "resource": { + "attributes": [ + { + "name": "service.name", + "value": "unknown_service" + }, + { + "name": "string_key", + "value": "value", + "type": "string" + }, + { + "name": "bool_key", + "value": true, + "type": "bool" + }, + { + "name": "int_key", + "value": 1, + "type": "int" + }, + { + "name": "double_key", + "value": 1.1, + "type": "double" + }, + { + "name": "string_array_key", + "value": [ + "value1", + "value2" + ], + "type": "string_array" + }, + { + "name": "bool_array_key", + "value": [ + true, + false + ], + "type": "bool_array" + }, + { + "name": "int_array_key", + "value": [ + 1, + 2 + ], + "type": "int_array" + }, + { + "name": "double_array_key", + "value": [ + 1.1, + 2.2 + ], + "type": "double_array" + } + ], + "attributes_list": "service.namespace=my-namespace,service.version=1.0.0", + "detectors": { + "attributes": { + "included": [ + "process.*" + ], + "excluded": [ + "process.command_args" + ] + } + }, + "schema_url": "https://opentelemetry.io/schemas/1.16.0" + }, + "instrumentation": { + "general": { + "peer": { + "service_mapping": [ + { + "peer": "1.2.3.4", + "service": "FooService" + }, + { + "peer": "2.3.4.5", + "service": "BarService" + } + ] + }, + "http": { + "client": { + "request_captured_headers": [ + "Content-Type", + "Accept" + ], + "response_captured_headers": [ + "Content-Type", + "Content-Encoding" + ] + }, + "server": { + "request_captured_headers": [ + "Content-Type", + "Accept" + ], + "response_captured_headers": [ + "Content-Type", + "Content-Encoding" + ] + } + } + }, + "cpp": { + "example": { + "property": "value" + } + }, + "dotnet": { + "example": { + "property": "value" + } + }, + "erlang": { + "example": { + "property": "value" + } + }, + "go": { + "example": { + "property": "value" + } + }, + "java": { + "example": { + "property": "value" + } + }, + "js": { + "example": { + "property": "value" + } + }, + "php": { + "example": { + "property": "value" + } + }, + "python": { + "example": { + "property": "value" + } + }, + "ruby": { + "example": { + "property": "value" + } + }, + "rust": { + "example": { + "property": "value" + } + }, + "swift": { + "example": { + "property": "value" + } + } + } +} \ No newline at end of file diff --git a/config/testdata/v0.3.yaml b/config/testdata/v0.3.yaml new file mode 100644 index 00000000000..04f2a314e4e --- /dev/null +++ b/config/testdata/v0.3.yaml @@ -0,0 +1,466 @@ +# kitchen-sink.yaml demonstrates all configurable surface area, including explanatory comments. +# +# It DOES NOT represent expected real world configuration, as it makes strange configuration +# choices in an effort to exercise the full surface area. +# +# Configuration values are set to their defaults when default values are defined. + +# The file format version. +file_format: "0.3" + +# Configure if the SDK is disabled or not. This is not required to be provided to ensure the SDK isn't disabled, the default value when this is not provided is for the SDK to be enabled. +disabled: false + +# Configure general attribute limits. See also tracer_provider.limits, logger_provider.limits. +attribute_limits: + # Configure max attribute value size. + attribute_value_length_limit: 4096 + # Configure max attribute count. + attribute_count_limit: 128 + +# Configure logger provider. +logger_provider: + # Configure log record processors. + processors: + - # Configure a batch log record processor. + batch: + # Configure delay interval (in milliseconds) between two consecutive exports. + schedule_delay: 5000 + # Configure maximum allowed time (in milliseconds) to export data. + export_timeout: 30000 + # Configure maximum queue size. + max_queue_size: 2048 + # Configure maximum batch size. + max_export_batch_size: 512 + # Configure exporter. + exporter: + # Configure exporter to be OTLP. + otlp: + # Configure protocol. + protocol: http/protobuf + # Configure endpoint. + endpoint: http://localhost:4318/v1/logs + # Configure certificate. + certificate: /app/cert.pem + # Configure mTLS private client key. + client_key: /app/cert.pem + # Configure mTLS client certificate. + client_certificate: /app/cert.pem + # Configure headers. Entries have higher priority than entries from .headers_list. + headers: + - name: api-key + value: "1234" + # Configure headers. Entries have lower priority than entries from .headers. + # The value is a list of comma separated key-value pairs matching the format of OTEL_EXPORTER_OTLP_HEADERS. See https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#configuration-options for details. + headers_list: "api-key=1234" + # Configure compression. + compression: gzip + # Configure max time (in milliseconds) to wait for each export. + timeout: 10000 + # Configure client transport security for the exporter's connection. + insecure: false + - # Configure a simple log record processor. + simple: + # Configure exporter. + exporter: + # Configure exporter to be console. + console: {} + # Configure log record limits. See also attribute_limits. + limits: + # Configure max attribute value size. Overrides .attribute_limits.attribute_value_length_limit. + attribute_value_length_limit: 4096 + # Configure max attribute count. Overrides .attribute_limits.attribute_count_limit. + attribute_count_limit: 128 + +# Configure meter provider. +meter_provider: + # Configure metric readers. + readers: + - # Configure a pull based metric reader. + pull: + # Configure exporter. + exporter: + # Configure exporter to be prometheus. + prometheus: + # Configure host. + host: localhost + # Configure port. + port: 9464 + # Configure Prometheus Exporter to produce metrics without a unit suffix or UNIT metadata. + without_units: false + # Configure Prometheus Exporter to produce metrics without a type suffix. + without_type_suffix: false + # Configure Prometheus Exporter to produce metrics without a scope info metric. + without_scope_info: false + # Configure Prometheus Exporter to add resource attributes as metrics attributes. + with_resource_constant_labels: + # Configure resource attributes to be included. If not set, no resource attributes are included. + # Attribute keys from resources are evaluated to match as follows: + # * If the value of the attribute key exactly matches. + # * If the value of the attribute key matches the wildcard pattern, where '?' matches any single character and '*' matches any number of characters including none. + included: + - "service*" + # Configure resource attributes to be excluded. Applies after .with_resource_constant_labels.included (i.e. excluded has higher priority than included). + # Attribute keys from resources are evaluated to match as follows: + # * If the value of the attribute key exactly matches. + # * If the value of the attribute key matches the wildcard pattern, where '?' matches any single character and '*' matches any number of characters including none. + excluded: + - "service.attr1" + # Configure metric producers. + producers: + - # Configure metric producer to be opencensus. + opencensus: {} + - # Configure a periodic metric reader. + periodic: + # Configure delay interval (in milliseconds) between start of two consecutive exports. + interval: 5000 + # Configure maximum allowed time (in milliseconds) to export data. + timeout: 30000 + # Configure exporter. + exporter: + # Configure exporter to be OTLP. + otlp: + # Configure protocol. + protocol: http/protobuf + # Configure endpoint. + endpoint: http://localhost:4318/v1/metrics + # Configure certificate. + certificate: /app/cert.pem + # Configure mTLS private client key. + client_key: /app/cert.pem + # Configure mTLS client certificate. + client_certificate: /app/cert.pem + # Configure headers. Entries have higher priority than entries from .headers_list. + headers: + - name: api-key + value: "1234" + # Configure headers. Entries have lower priority than entries from .headers. + # The value is a list of comma separated key-value pairs matching the format of OTEL_EXPORTER_OTLP_HEADERS. See https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#configuration-options for details. + headers_list: "api-key=1234" + # Configure compression. + compression: gzip + # Configure max time (in milliseconds) to wait for each export. + timeout: 10000 + # Configure client transport security for the exporter's connection. + insecure: false + # Configure temporality preference. + temporality_preference: delta + # Configure default histogram aggregation. + default_histogram_aggregation: base2_exponential_bucket_histogram + # Configure metric producers. + producers: + - # Configure metric producer to be prometheus. + prometheus: {} + - # Configure a periodic metric reader. + periodic: + # Configure exporter. + exporter: + # Configure exporter to be console. + console: {} + # Configure views. Each view has a selector which determines the instrument(s) it applies to, and a configuration for the resulting stream(s). + views: + - # Configure view selector. + selector: + # Configure instrument name selection criteria. + instrument_name: my-instrument + # Configure instrument type selection criteria. + instrument_type: histogram + # Configure the instrument unit selection criteria. + unit: ms + # Configure meter name selection criteria. + meter_name: my-meter + # Configure meter version selection criteria. + meter_version: 1.0.0 + # Configure meter schema url selection criteria. + meter_schema_url: https://opentelemetry.io/schemas/1.16.0 + # Configure view stream. + stream: + # Configure metric name of the resulting stream(s). + name: new_instrument_name + # Configure metric description of the resulting stream(s). + description: new_description + # Configure aggregation of the resulting stream(s). Known values include: default, drop, explicit_bucket_histogram, base2_exponential_bucket_histogram, last_value, sum. + aggregation: + # Configure aggregation to be explicit_bucket_histogram. + explicit_bucket_histogram: + # Configure bucket boundaries. + boundaries: + [ + 0.0, + 5.0, + 10.0, + 25.0, + 50.0, + 75.0, + 100.0, + 250.0, + 500.0, + 750.0, + 1000.0, + 2500.0, + 5000.0, + 7500.0, + 10000.0 + ] + # Configure record min and max. + record_min_max: true + # Configure attribute keys retained in the resulting stream(s). + attribute_keys: + # Configure list of attribute keys to include in the resulting stream(s). All other attributes are dropped. If not set, stream attributes are not configured. + included: + - key1 + - key2 + # Configure list of attribute keys to exclude from the resulting stream(s). Applies after .attribute_keys.included (i.e. excluded has higher priority than included). + excluded: + - key3 + +# Configure text map context propagators. +propagator: + # Configure the set of propagators to include in the composite text map propagator. + composite: [ tracecontext, baggage, b3, b3multi, jaeger, xray, ottrace ] + +# Configure tracer provider. +tracer_provider: + # Configure span processors. + processors: + - # Configure a batch span processor. + batch: + # Configure delay interval (in milliseconds) between two consecutive exports. + schedule_delay: 5000 + # Configure maximum allowed time (in milliseconds) to export data. + export_timeout: 30000 + # Configure maximum queue size. + max_queue_size: 2048 + # Configure maximum batch size. + max_export_batch_size: 512 + # Configure exporter. + exporter: + # Configure exporter to be OTLP. + otlp: + # Configure protocol. + protocol: http/protobuf + # Configure endpoint. + endpoint: http://localhost:4318/v1/traces + # Configure certificate. + certificate: /app/cert.pem + # Configure mTLS private client key. + client_key: /app/cert.pem + # Configure mTLS client certificate. + client_certificate: /app/cert.pem + # Configure headers. Entries have higher priority than entries from .headers_list. + headers: + - name: api-key + value: "1234" + # Configure headers. Entries have lower priority than entries from .headers. + # The value is a list of comma separated key-value pairs matching the format of OTEL_EXPORTER_OTLP_HEADERS. See https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#configuration-options for details. + headers_list: "api-key=1234" + # Configure compression. + compression: gzip + # Configure max time (in milliseconds) to wait for each export. + timeout: 10000 + # Configure client transport security for the exporter's connection. + insecure: false + - # Configure a batch span processor. + batch: + # Configure exporter. + exporter: + # Configure exporter to be zipkin. + zipkin: + # Configure endpoint. + endpoint: http://localhost:9411/api/v2/spans + # Configure max time (in milliseconds) to wait for each export. + timeout: 10000 + - # Configure a simple span processor. + simple: + # Configure exporter. + exporter: + # Configure exporter to be console. + console: {} + # Configure span limits. See also attribute_limits. + limits: + # Configure max attribute value size. Overrides .attribute_limits.attribute_value_length_limit. + attribute_value_length_limit: 4096 + # Configure max attribute count. Overrides .attribute_limits.attribute_count_limit. + attribute_count_limit: 128 + # Configure max span event count. + event_count_limit: 128 + # Configure max span link count. + link_count_limit: 128 + # Configure max attributes per span event. + event_attribute_count_limit: 128 + # Configure max attributes per span link. + link_attribute_count_limit: 128 + # Configure the sampler. + sampler: + # Configure sampler to be parent_based. + parent_based: + # Configure root sampler. + root: + # Configure sampler to be trace_id_ratio_based. + trace_id_ratio_based: + # Configure trace_id_ratio. + ratio: 0.0001 + # Configure remote_parent_sampled sampler. + remote_parent_sampled: + # Configure sampler to be always_on. + always_on: {} + # Configure remote_parent_not_sampled sampler. + remote_parent_not_sampled: + # Configure sampler to be always_off. + always_off: {} + # Configure local_parent_sampled sampler. + local_parent_sampled: + # Configure sampler to be always_on. + always_on: {} + # Configure local_parent_not_sampled sampler. + local_parent_not_sampled: + # Configure sampler to be always_off. + always_off: {} + +# Configure resource for all signals. +resource: + # Configure resource attributes. Entries have higher priority than entries from .resource.attributes_list. + # Entries must contain .name nand .value, and may optionally include .type, which defaults ot "string" if not set. The value must match the type. Values for .type include: string, bool, int, double, string_array, bool_array, int_array, double_array. + attributes: + - name: service.name + value: unknown_service + - name: string_key + value: value + type: string + - name: bool_key + value: true + type: bool + - name: int_key + value: 1 + type: int + - name: double_key + value: 1.1 + type: double + - name: string_array_key + value: [ "value1", "value2" ] + type: string_array + - name: bool_array_key + value: [ true, false ] + type: bool_array + - name: int_array_key + value: [ 1, 2 ] + type: int_array + - name: double_array_key + value: [ 1.1, 2.2 ] + type: double_array + # Configure resource attributes. Entries have lower priority than entries from .resource.attributes. + # The value is a list of comma separated key-value pairs matching the format of OTEL_RESOURCE_ATTRIBUTES. See https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/configuration/sdk-environment-variables.md#general-sdk-configuration for details. + attributes_list: "service.namespace=my-namespace,service.version=1.0.0" + # Configure resource detectors. + detectors: + # Configure attributes provided by resource detectors. + attributes: + # Configure list of attribute key patterns to include from resource detectors. If not set, all attributes are included. + # Attribute keys from resource detectors are evaluated to match as follows: + # * If the value of the attribute key exactly matches. + # * If the value of the attribute key matches the wildcard pattern, where '?' matches any single character and '*' matches any number of characters including none. + included: + - process.* + # Configure list of attribute key patterns to exclude from resource detectors. Applies after .resource.detectors.attributes.included (i.e. excluded has higher priority than included). + # Attribute keys from resource detectors are evaluated to match as follows: + # * If the value of the attribute key exactly matches. + # * If the value of the attribute key matches the wildcard pattern, where '?' matches any single character and '*' matches any number of characters including none. + excluded: + - process.command_args + # Configure resource schema URL. + schema_url: https://opentelemetry.io/schemas/1.16.0 + +# Configure instrumentation. +instrumentation: + # Configure general SemConv options that may apply to multiple languages and instrumentations. + # Instrumenation may merge general config options with the language specific configuration at .instrumentation.. + general: + # Configure instrumentations following the peer semantic conventions. + # See peer semantic conventions: https://opentelemetry.io/docs/specs/semconv/attributes-registry/peer/ + peer: + # Configure the service mapping for instrumentations following peer.service semantic conventions. + # Each entry is a key value pair where "peer" defines the IP address and "service" defines the corresponding logical name of the service. + # See peer.service semantic conventions: https://opentelemetry.io/docs/specs/semconv/general/attributes/#general-remote-service-attributes + service_mapping: + - peer: 1.2.3.4 + service: FooService + - peer: 2.3.4.5 + service: BarService + # Configure instrumentations following the http semantic conventions. + # See http semantic conventions: https://opentelemetry.io/docs/specs/semconv/http/ + http: + # Configure instrumentations following the http client semantic conventions. + client: + # Configure headers to capture for outbound http requests. + request_captured_headers: + - Content-Type + - Accept + # Configure headers to capture for outbound http responses. + response_captured_headers: + - Content-Type + - Content-Encoding + # Configure instrumentations following the http server semantic conventions. + server: + # Configure headers to capture for inbound http requests. + request_captured_headers: + - Content-Type + - Accept + # Configure headers to capture for outbound http responses. + response_captured_headers: + - Content-Type + - Content-Encoding + # Configure C++ language-specific instrumentation libraries. + cpp: + # Configure the instrumentation corresponding to key "example". + example: + property: "value" + # Configure .NET language-specific instrumentation libraries. + dotnet: + # Configure the instrumentation corresponding to key "example". + example: + property: "value" + # Configure Erlang language-specific instrumentation libraries. + erlang: + # Configure the instrumentation corresponding to key "example". + example: + property: "value" + # Configure Go language-specific instrumentation libraries. + go: + # Configure the instrumentation corresponding to key "example". + example: + property: "value" + # Configure Java language-specific instrumentation libraries. + java: + # Configure the instrumentation corresponding to key "example". + example: + property: "value" + # Configure JavaScript language-specific instrumentation libraries. + js: + # Configure the instrumentation corresponding to key "example". + example: + property: "value" + # Configure PHP language-specific instrumentation libraries. + php: + # Configure the instrumentation corresponding to key "example". + example: + property: "value" + # Configure Python language-specific instrumentation libraries. + python: + # Configure the instrumentation corresponding to key "example". + example: + property: "value" + # Configure Ruby language-specific instrumentation libraries. + ruby: + # Configure the instrumentation corresponding to key "example". + example: + property: "value" + # Configure Rust language-specific instrumentation libraries. + rust: + # Configure the instrumentation corresponding to key "example". + example: + property: "value" + # Configure Swift language-specific instrumentation libraries. + swift: + # Configure the instrumentation corresponding to key "example". + example: + property: "value"