diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index da8e07390f0..07846a00faa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -133,9 +133,9 @@ jobs: test-compatibility: runs-on: ubuntu-latest needs: [compatibility-test] + if: always() steps: - name: Test if compatibility-test workflow passed run: | echo ${{ needs.compatibility-test.result }} test ${{ needs.compatibility-test.result }} == "success" - diff --git a/.github/workflows/links-fail-fast.yml b/.github/workflows/links-fail-fast.yml index 0b7e23e43f5..473c56ff782 100644 --- a/.github/workflows/links-fail-fast.yml +++ b/.github/workflows/links-fail-fast.yml @@ -25,4 +25,5 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: fail: true - args: --max-concurrency 5 --cache --max-cache-age 1d . + # TODO: Remove 429s exception once https://github.com/open-telemetry/opentelemetry-go-contrib/issues/6183 is resolved + args: --max-concurrency 5 --cache --max-cache-age 1d --accept 100..=103,200..=299,429 . diff --git a/.github/workflows/links.yml b/.github/workflows/links.yml index 19a7368d900..1ffb4e8d2ec 100644 --- a/.github/workflows/links.yml +++ b/.github/workflows/links.yml @@ -30,7 +30,8 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - args: --max-concurrency 1 --cache --max-cache-age 1d . + # TODO: Remove 429s exception once https://github.com/open-telemetry/opentelemetry-go-contrib/issues/6183 is resolved + args: --max-concurrency 1 --cache --max-cache-age 1d --accept 100..=103,200..=299,429 . - name: Create Issue From File if: steps.lychee.outputs.exit_code != 0 diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ee9267202d..f5aedaeb416 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,23 +14,32 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Move examples from `go.opentelemetry.io/otel` to this repository under `examples` directory. (#6158) - Support yaml/json struct tags for generated code in `go.opentelemetry.io/contrib/config`. (#5433) - Add support for parsing YAML configuration via `ParseYAML` in `go.opentelemetry.io/contrib/config`. (#5433) +- Add support for temporality preference configuration in `go.opentelemetry.io/contrib/config`. (#5860) - Parsing via ParseYAML in `go.opentelemetry.io/contrib/config` now support environment variables in the format `${VAR_NAME}`. (#6215) ### Changed - The function signature of `NewLogProcessor` in `go.opentelemetry.io/contrib/processors/minsev` has changed to accept the added `Severitier` interface instead of a `log.Severity`. (#6116) - `NewSDK` in `go.opentelemetry.io/contrib/config` now returns a no-op SDK if `disabled` is set to `true`. (#6185) +- The deprecated `go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/otelecho` package has found a Code Owner. + The package is no longer deprecated. (#6207) ### Fixed - Possible nil dereference panic in `go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace`. (#5965) +- `logrus.Level` transformed to appropriate `log.Severity` in `go.opentelemetry.io/contrib/bridges/otellogrus`. (#6191) ### Removed - The `Minimum` field of the `LogProcessor` in `go.opentelemetry.io/contrib/processors/minsev` is removed. Use `NewLogProcessor` to configure this setting. (#6116) +- The deprecated `go.opentelemetry.io/contrib/instrumentation/gopkg.in/macaron.v1/otelmacaron` package is removed. (#6186) - The deprecated `go.opentelemetry.io/contrib/samplers/aws/xray` package is removed. (#6187) +### Changed + +- Updated `go.opentelemetry.io/contrib/config` to use the [v0.3.0](https://github.com/open-telemetry/opentelemetry-configuration/releases/tag/v0.3.0) release of schema which includes backwards incompatible changes. (#6126) + diff --git a/CODEOWNERS b/CODEOWNERS index 47b50e98c1a..9281c6cc426 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -47,10 +47,9 @@ instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/ @open-te instrumentation/github.com/emicklei/go-restful/otelrestful/ @open-telemetry/go-approvers @dashpole instrumentation/github.com/gin-gonic/gin/otelgin/ @open-telemetry/go-approvers instrumentation/github.com/gorilla/mux/otelmux/ @open-telemetry/go-approvers @akats7 -instrumentation/github.com/labstack/echo/otelecho/ @open-telemetry/go-approvers +instrumentation/github.com/labstack/echo/otelecho/ @open-telemetry/go-approvers @scorpionknifes instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/ @open-telemetry/go-approvers instrumentation/google.golang.org/grpc/otelgrpc/ @open-telemetry/go-approvers @dashpole -instrumentation/gopkg.in/macaron.v1/otelmacaron/ @open-telemetry/go-approvers instrumentation/host/ @open-telemetry/go-approvers @dmathieu instrumentation/net/http/httptrace/otelhttptrace/ @open-telemetry/go-approvers @dmathieu diff --git a/Makefile b/Makefile index 5489e46e065..7538aa25320 100644 --- a/Makefile +++ b/Makefile @@ -309,7 +309,7 @@ update-all-otel-deps: OPENTELEMETRY_CONFIGURATION_JSONSCHEMA_SRC_DIR=tmp/opentelememetry-configuration # The SHA matching the current version of the opentelemetry-configuration schema to use -OPENTELEMETRY_CONFIGURATION_JSONSCHEMA_VERSION=v0.2.0 +OPENTELEMETRY_CONFIGURATION_JSONSCHEMA_VERSION=v0.3.0 # Cleanup temporary directory genjsonschema-cleanup: @@ -326,6 +326,7 @@ genjsonschema: genjsonschema-cleanup $(GOJSONSCHEMA) --capitalization OTLP \ --struct-name-from-title \ --package config \ + --only-models \ --output ${GENERATED_CONFIG} \ ${OPENTELEMETRY_CONFIGURATION_JSONSCHEMA_SRC_DIR}/schema/opentelemetry_configuration.json @echo Modify jsonschema generated files. diff --git a/bridges/otellogrus/hook.go b/bridges/otellogrus/hook.go index 4d06e03dc75..6ebe85d138f 100644 --- a/bridges/otellogrus/hook.go +++ b/bridges/otellogrus/hook.go @@ -16,13 +16,15 @@ // set. // - Fields are transformed and set as the attributes. // -// The Level is transformed by using the static offset to the OpenTelemetry +// The Level is transformed to the OpenTelemetry // Severity types. For example: // // - [logrus.DebugLevel] is transformed to [log.SeverityDebug] -// - [logrus.InfoLevel] is transformed to [log.SeverityTrace4] -// - [logrus.WarnLevel] is transformed to [log.SeverityTrace3] -// - [logrus.ErrorLevel] is transformed to [log.SeverityTrace2] +// - [logrus.InfoLevel] is transformed to [log.SeverityInfo] +// - [logrus.WarnLevel] is transformed to [log.SeverityWarn] +// - [logrus.ErrorLevel] is transformed to [log.SeverityError] +// - [logrus.FatalLevel] is transformed to [log.SeverityFatal] +// - [logrus.PanicLevel] is transformed to [log.SeverityFatal4] // // Field values are transformed based on their type into log attributes, or // into a string value if there is no matching type. @@ -164,9 +166,7 @@ func (h *Hook) convertEntry(e *logrus.Entry) log.Record { var record log.Record record.SetTimestamp(e.Time) record.SetBody(log.StringValue(e.Message)) - - const sevOffset = logrus.Level(log.SeverityDebug) - logrus.DebugLevel - record.SetSeverity(log.Severity(e.Level + sevOffset)) + record.SetSeverity(convertSeverity(e.Level)) record.AddAttributes(convertFields(e.Data)...) return record @@ -183,6 +183,30 @@ func convertFields(fields logrus.Fields) []log.KeyValue { return kvs } +func convertSeverity(level logrus.Level) log.Severity { + switch level { + case logrus.PanicLevel: + // PanicLevel is not supported by OpenTelemetry, use Fatal4 as the highest severity. + return log.SeverityFatal4 + case logrus.FatalLevel: + return log.SeverityFatal + case logrus.ErrorLevel: + return log.SeverityError + case logrus.WarnLevel: + return log.SeverityWarn + case logrus.InfoLevel: + return log.SeverityInfo + case logrus.DebugLevel: + return log.SeverityDebug + case logrus.TraceLevel: + return log.SeverityTrace + default: + // If the level is not recognized, use SeverityUndefined as the lowest severity. + // we should never reach this point as logrus only uses the above levels. + return log.SeverityUndefined + } +} + func convertValue(v interface{}) log.Value { switch v := v.(type) { case bool: diff --git a/bridges/otellogrus/hook_test.go b/bridges/otellogrus/hook_test.go index 271ee0f7373..6e95bb93ddd 100644 --- a/bridges/otellogrus/hook_test.go +++ b/bridges/otellogrus/hook_test.go @@ -162,7 +162,7 @@ func TestHookFire(t *testing.T) { wantRecords: map[string][]log.Record{ name: { - buildRecord(log.StringValue(""), time.Time{}, 0, nil), + buildRecord(log.StringValue(""), time.Time{}, log.SeverityFatal4, nil), }, }, }, @@ -173,18 +173,84 @@ func TestHookFire(t *testing.T) { }, wantRecords: map[string][]log.Record{ name: { - buildRecord(log.StringValue(""), now, 0, nil), + buildRecord(log.StringValue(""), now, log.SeverityFatal4, nil), }, }, }, { - name: "emits a log entry with severity level", + name: "emits a log entry with panic severity level", + entry: &logrus.Entry{ + Level: logrus.PanicLevel, + }, + wantRecords: map[string][]log.Record{ + name: { + buildRecord(log.StringValue(""), time.Time{}, log.SeverityFatal4, nil), + }, + }, + }, + { + name: "emits a log entry with fatal severity level", entry: &logrus.Entry{ Level: logrus.FatalLevel, }, wantRecords: map[string][]log.Record{ name: { - buildRecord(log.StringValue(""), time.Time{}, log.SeverityTrace1, nil), + buildRecord(log.StringValue(""), time.Time{}, log.SeverityFatal, nil), + }, + }, + }, + { + name: "emits a log entry with error severity level", + entry: &logrus.Entry{ + Level: logrus.ErrorLevel, + }, + wantRecords: map[string][]log.Record{ + name: { + buildRecord(log.StringValue(""), time.Time{}, log.SeverityError, nil), + }, + }, + }, + { + name: "emits a log entry with warn severity level", + entry: &logrus.Entry{ + Level: logrus.WarnLevel, + }, + wantRecords: map[string][]log.Record{ + name: { + buildRecord(log.StringValue(""), time.Time{}, log.SeverityWarn, nil), + }, + }, + }, + { + name: "emits a log entry with info severity level", + entry: &logrus.Entry{ + Level: logrus.InfoLevel, + }, + wantRecords: map[string][]log.Record{ + name: { + buildRecord(log.StringValue(""), time.Time{}, log.SeverityInfo, nil), + }, + }, + }, + { + name: "emits a log entry with info severity level", + entry: &logrus.Entry{ + Level: logrus.DebugLevel, + }, + wantRecords: map[string][]log.Record{ + name: { + buildRecord(log.StringValue(""), time.Time{}, log.SeverityDebug, nil), + }, + }, + }, + { + name: "emits a log entry with info severity level", + entry: &logrus.Entry{ + Level: logrus.TraceLevel, + }, + wantRecords: map[string][]log.Record{ + name: { + buildRecord(log.StringValue(""), time.Time{}, log.SeverityTrace, nil), }, }, }, @@ -197,7 +263,7 @@ func TestHookFire(t *testing.T) { }, wantRecords: map[string][]log.Record{ name: { - buildRecord(log.StringValue(""), time.Time{}, 0, []log.KeyValue{ + buildRecord(log.StringValue(""), time.Time{}, log.SeverityFatal4, []log.KeyValue{ log.String("hello", "world"), }), }, diff --git a/config/config.go b/config/config.go index 41fc5b10e73..22bce7b4eee 100644 --- a/config/config.go +++ b/config/config.go @@ -165,3 +165,11 @@ 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 { + output[v.Name] = *v.Value + } + return output +} diff --git a/config/config_json.go b/config/config_json.go new file mode 100644 index 00000000000..147c595d91b --- /dev/null +++ b/config/config_json.go @@ -0,0 +1,374 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package config // import "go.opentelemetry.io/contrib/config" + +import ( + "encoding/json" + "fmt" + "reflect" +) + +// MarshalJSON implements json.Marshaler. +func (j *AttributeNameValueType) MarshalJSON() ([]byte, error) { + return json.Marshal(j.Value) +} + +var enumValuesAttributeNameValueType = []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 enumValuesAttributeNameValueType { + if reflect.DeepEqual(v.Value, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValuesAttributeNameValueType, v.Value) + } + *j = AttributeNameValueType(v) + return nil +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *BatchLogRecordProcessor) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + if _, ok := raw["exporter"]; raw != nil && !ok { + return fmt.Errorf("field exporter in BatchLogRecordProcessor: required") + } + type Plain BatchLogRecordProcessor + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = BatchLogRecordProcessor(plain) + return nil +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *BatchSpanProcessor) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + if _, ok := raw["exporter"]; raw != nil && !ok { + return fmt.Errorf("field exporter in BatchSpanProcessor: required") + } + type Plain BatchSpanProcessor + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = BatchSpanProcessor(plain) + return nil +} + +// 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 +} + +// 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 +} + +var enumValuesOTLPMetricDefaultHistogramAggregation = []interface{}{ + "explicit_bucket_histogram", + "base2_exponential_bucket_histogram", +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *OTLPMetricDefaultHistogramAggregation) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValuesOTLPMetricDefaultHistogramAggregation { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValuesOTLPMetricDefaultHistogramAggregation, v) + } + *j = OTLPMetricDefaultHistogramAggregation(v) + return nil +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *OTLPMetric) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + if _, ok := raw["endpoint"]; raw != nil && !ok { + return fmt.Errorf("field endpoint in OTLPMetric: required") + } + if _, ok := raw["protocol"]; raw != nil && !ok { + return fmt.Errorf("field protocol in OTLPMetric: required") + } + type Plain OTLPMetric + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = OTLPMetric(plain) + return nil +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *OTLP) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + if _, ok := raw["endpoint"]; raw != nil && !ok { + return fmt.Errorf("field endpoint in OTLP: required") + } + if _, ok := raw["protocol"]; raw != nil && !ok { + return fmt.Errorf("field protocol in OTLP: required") + } + type Plain OTLP + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = OTLP(plain) + return nil +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *OpenTelemetryConfiguration) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + if _, ok := raw["file_format"]; raw != nil && !ok { + return fmt.Errorf("field file_format in OpenTelemetryConfiguration: required") + } + type Plain OpenTelemetryConfiguration + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = OpenTelemetryConfiguration(plain) + return nil +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *PeriodicMetricReader) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + if _, ok := raw["exporter"]; raw != nil && !ok { + return fmt.Errorf("field exporter in PeriodicMetricReader: required") + } + type Plain PeriodicMetricReader + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = PeriodicMetricReader(plain) + return nil +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *PullMetricReader) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + if _, ok := raw["exporter"]; raw != nil && !ok { + return fmt.Errorf("field exporter in PullMetricReader: required") + } + type Plain PullMetricReader + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = PullMetricReader(plain) + return nil +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *SimpleLogRecordProcessor) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + if _, ok := raw["exporter"]; raw != nil && !ok { + return fmt.Errorf("field exporter in SimpleLogRecordProcessor: required") + } + type Plain SimpleLogRecordProcessor + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = SimpleLogRecordProcessor(plain) + return nil +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *SimpleSpanProcessor) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + if _, ok := raw["exporter"]; raw != nil && !ok { + return fmt.Errorf("field exporter in SimpleSpanProcessor: required") + } + type Plain SimpleSpanProcessor + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = SimpleSpanProcessor(plain) + return nil +} + +var enumValuesViewSelectorInstrumentType = []interface{}{ + "counter", + "histogram", + "observable_counter", + "observable_gauge", + "observable_up_down_counter", + "up_down_counter", +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *ViewSelectorInstrumentType) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValuesViewSelectorInstrumentType { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValuesViewSelectorInstrumentType, v) + } + *j = ViewSelectorInstrumentType(v) + return nil +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *Zipkin) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + if _, ok := raw["endpoint"]; raw != nil && !ok { + return fmt.Errorf("field endpoint in Zipkin: required") + } + type Plain Zipkin + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = Zipkin(plain) + 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 + } + if plain.Type != nil && plain.Type.Value == "int" { + val, ok := plain.Value.(float64) + if ok { + plain.Value = int(val) + } + } + if plain.Type != nil && plain.Type.Value == "int_array" { + m, ok := plain.Value.([]interface{}) + if ok { + var vals []interface{} + for _, v := range m { + val, ok := v.(float64) + if ok { + vals = append(vals, int(val)) + } else { + vals = append(vals, val) + } + } + plain.Value = vals + } + } + + *j = AttributeNameValue(plain) + return nil +} diff --git a/config/config_test.go b/config/config_test.go index 3aef2445f9b..903744d269d 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: 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{}{1, 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, }, } @@ -379,7 +485,7 @@ func TestSerializeJSON(t *testing.T) { wantErr: nil, wantType: OpenTelemetryConfiguration{ Disabled: ptr(false), - FileFormat: "0.1", + FileFormat: ptr("0.1"), }, }, { @@ -388,9 +494,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/config_yaml.go b/config/config_yaml.go new file mode 100644 index 00000000000..88234178880 --- /dev/null +++ b/config/config_yaml.go @@ -0,0 +1,42 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package config // import "go.opentelemetry.io/contrib/config" + +import ( + "fmt" + "reflect" +) + +// UnmarshalYAML implements yaml.Unmarshaler. +func (j *AttributeNameValueType) UnmarshalYAML(unmarshal func(interface{}) error) error { + var v struct { + Value interface{} + } + if err := unmarshal(&v.Value); err != nil { + return err + } + var ok bool + for _, expected := range enumValuesAttributeNameValueType { + if reflect.DeepEqual(v.Value, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValuesAttributeNameValueType, v.Value) + } + *j = AttributeNameValueType(v) + return nil +} + +// UnmarshalYAML implements yaml.Unmarshaler. +func (j *LanguageSpecificInstrumentation) UnmarshalYAML(unmarshal func(interface{}) error) error { + var raw map[string]interface{} + if err := unmarshal(&raw); err != nil { + return err + } + + *j = raw + return nil +} diff --git a/config/generated_config.go b/config/generated_config.go index 2315641db64..fbf69c3927e 100644 --- a/config/generated_config.go +++ b/config/generated_config.go @@ -2,10 +2,6 @@ package config -import "encoding/json" -import "fmt" -import "reflect" - type AttributeLimits struct { // AttributeCountLimit corresponds to the JSON schema field // "attribute_count_limit". @@ -18,7 +14,20 @@ 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{} +} type BatchLogRecordProcessor struct { // ExportTimeout corresponds to the JSON schema field "export_timeout". @@ -38,24 +47,6 @@ type BatchLogRecordProcessor struct { ScheduleDelay *int `json:"schedule_delay,omitempty" yaml:"schedule_delay,omitempty" mapstructure:"schedule_delay,omitempty"` } -// UnmarshalJSON implements json.Unmarshaler. -func (j *BatchLogRecordProcessor) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { - return err - } - if _, ok := raw["exporter"]; raw != nil && !ok { - return fmt.Errorf("field exporter in BatchLogRecordProcessor: required") - } - type Plain BatchLogRecordProcessor - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err - } - *j = BatchLogRecordProcessor(plain) - return nil -} - type BatchSpanProcessor struct { // ExportTimeout corresponds to the JSON schema field "export_timeout". ExportTimeout *int `json:"export_timeout,omitempty" yaml:"export_timeout,omitempty" mapstructure:"export_timeout,omitempty"` @@ -74,24 +65,6 @@ type BatchSpanProcessor struct { ScheduleDelay *int `json:"schedule_delay,omitempty" yaml:"schedule_delay,omitempty" mapstructure:"schedule_delay,omitempty"` } -// UnmarshalJSON implements json.Unmarshaler. -func (j *BatchSpanProcessor) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { - return err - } - if _, ok := raw["exporter"]; raw != nil && !ok { - return fmt.Errorf("field exporter in BatchSpanProcessor: required") - } - type Plain BatchSpanProcessor - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err - } - *j = BatchSpanProcessor(plain) - return nil -} - type Common map[string]interface{} type Console map[string]interface{} @@ -109,7 +82,54 @@ 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"` +} type IncludeExclude struct { // Excluded corresponds to the JSON schema field "excluded". @@ -119,6 +139,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 +225,34 @@ 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"` +} + type OTLP struct { // Certificate corresponds to the JSON schema field "certificate". Certificate *string `json:"certificate,omitempty" yaml:"certificate,omitempty" mapstructure:"certificate,omitempty"` @@ -200,16 +267,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 +303,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". @@ -257,73 +330,6 @@ type OTLPMetricDefaultHistogramAggregation string const OTLPMetricDefaultHistogramAggregationBase2ExponentialBucketHistogram OTLPMetricDefaultHistogramAggregation = "base2_exponential_bucket_histogram" const OTLPMetricDefaultHistogramAggregationExplicitBucketHistogram OTLPMetricDefaultHistogramAggregation = "explicit_bucket_histogram" -var enumValues_OTLPMetricDefaultHistogramAggregation = []interface{}{ - "explicit_bucket_histogram", - "base2_exponential_bucket_histogram", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *OTLPMetricDefaultHistogramAggregation) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_OTLPMetricDefaultHistogramAggregation { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_OTLPMetricDefaultHistogramAggregation, v) - } - *j = OTLPMetricDefaultHistogramAggregation(v) - return nil -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *OTLPMetric) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { - return err - } - if _, ok := raw["endpoint"]; raw != nil && !ok { - return fmt.Errorf("field endpoint in OTLPMetric: required") - } - if _, ok := raw["protocol"]; raw != nil && !ok { - return fmt.Errorf("field protocol in OTLPMetric: required") - } - type Plain OTLPMetric - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err - } - *j = OTLPMetric(plain) - return nil -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *OTLP) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { - return err - } - if _, ok := raw["endpoint"]; raw != nil && !ok { - return fmt.Errorf("field endpoint in OTLP: required") - } - if _, ok := raw["protocol"]; raw != nil && !ok { - return fmt.Errorf("field protocol in OTLP: required") - } - type Plain OTLP - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err - } - *j = OTLP(plain) - return nil -} - type OpenTelemetryConfiguration struct { // AttributeLimits corresponds to the JSON schema field "attribute_limits". AttributeLimits *AttributeLimits `json:"attribute_limits,omitempty" yaml:"attribute_limits,omitempty" mapstructure:"attribute_limits,omitempty"` @@ -332,7 +338,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"` @@ -352,27 +361,9 @@ type OpenTelemetryConfiguration struct { AdditionalProperties interface{} } -// UnmarshalJSON implements json.Unmarshaler. -func (j *OpenTelemetryConfiguration) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { - return err - } - if _, ok := raw["file_format"]; raw != nil && !ok { - return fmt.Errorf("field file_format in OpenTelemetryConfiguration: required") - } - type Plain OpenTelemetryConfiguration - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err - } - *j = OpenTelemetryConfiguration(plain) - return nil -} - 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"` @@ -381,24 +372,6 @@ type PeriodicMetricReader struct { Timeout *int `json:"timeout,omitempty" yaml:"timeout,omitempty" mapstructure:"timeout,omitempty"` } -// UnmarshalJSON implements json.Unmarshaler. -func (j *PeriodicMetricReader) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { - return err - } - if _, ok := raw["exporter"]; raw != nil && !ok { - return fmt.Errorf("field exporter in PeriodicMetricReader: required") - } - type Plain PeriodicMetricReader - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err - } - *j = PeriodicMetricReader(plain) - return nil -} - type Prometheus struct { // Host corresponds to the JSON schema field "host". Host *string `json:"host,omitempty" yaml:"host,omitempty" mapstructure:"host,omitempty"` @@ -422,37 +395,39 @@ 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"` -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *PullMetricReader) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { - return err - } - if _, ok := raw["exporter"]; raw != nil && !ok { - return fmt.Errorf("field exporter in PullMetricReader: required") - } - type Plain PullMetricReader - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err - } - *j = PullMetricReader(plain) - return nil + Exporter PullMetricExporter `json:"exporter" yaml:"exporter" mapstructure:"exporter"` +} + +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"` @@ -525,47 +500,11 @@ type SimpleLogRecordProcessor struct { Exporter LogRecordExporter `json:"exporter" yaml:"exporter" mapstructure:"exporter"` } -// UnmarshalJSON implements json.Unmarshaler. -func (j *SimpleLogRecordProcessor) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { - return err - } - if _, ok := raw["exporter"]; raw != nil && !ok { - return fmt.Errorf("field exporter in SimpleLogRecordProcessor: required") - } - type Plain SimpleLogRecordProcessor - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err - } - *j = SimpleLogRecordProcessor(plain) - return nil -} - type SimpleSpanProcessor struct { // Exporter corresponds to the JSON schema field "exporter". Exporter SpanExporter `json:"exporter" yaml:"exporter" mapstructure:"exporter"` } -// UnmarshalJSON implements json.Unmarshaler. -func (j *SimpleSpanProcessor) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { - return err - } - if _, ok := raw["exporter"]; raw != nil && !ok { - return fmt.Errorf("field exporter in SimpleSpanProcessor: required") - } - type Plain SimpleSpanProcessor - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err - } - *j = SimpleSpanProcessor(plain) - return nil -} - type SpanExporter struct { // Console corresponds to the JSON schema field "console". Console Console `json:"console,omitempty" yaml:"console,omitempty" mapstructure:"console,omitempty"` @@ -661,41 +600,12 @@ const ViewSelectorInstrumentTypeObservableGauge ViewSelectorInstrumentType = "ob const ViewSelectorInstrumentTypeObservableUpDownCounter ViewSelectorInstrumentType = "observable_up_down_counter" const ViewSelectorInstrumentTypeUpDownCounter ViewSelectorInstrumentType = "up_down_counter" -var enumValues_ViewSelectorInstrumentType = []interface{}{ - "counter", - "histogram", - "observable_counter", - "observable_gauge", - "observable_up_down_counter", - "up_down_counter", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *ViewSelectorInstrumentType) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_ViewSelectorInstrumentType { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ViewSelectorInstrumentType, v) - } - *j = ViewSelectorInstrumentType(v) - return nil -} - type ViewStream struct { // Aggregation corresponds to the JSON schema field "aggregation". 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,26 +665,8 @@ 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"` } - -// UnmarshalJSON implements json.Unmarshaler. -func (j *Zipkin) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { - return err - } - if _, ok := raw["endpoint"]; raw != nil && !ok { - return fmt.Errorf("field endpoint in Zipkin: required") - } - type Plain Zipkin - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err - } - *j = Zipkin(plain) - return nil -} diff --git a/config/go.mod b/config/go.mod index e397a557e20..f70e83b150f 100644 --- a/config/go.mod +++ b/config/go.mod @@ -44,8 +44,8 @@ require ( golang.org/x/net v0.30.0 // indirect golang.org/x/sys v0.26.0 // indirect golang.org/x/text v0.19.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240930140551-af27646dc61f // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20241007155032-5fefd90f89a9 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 // indirect google.golang.org/grpc v1.67.1 // indirect google.golang.org/protobuf v1.35.1 // indirect ) diff --git a/config/go.sum b/config/go.sum index 8223fa25921..dbc860c228e 100644 --- a/config/go.sum +++ b/config/go.sum @@ -85,10 +85,10 @@ golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= -google.golang.org/genproto/googleapis/api v0.0.0-20240930140551-af27646dc61f h1:jTm13A2itBi3La6yTGqn8bVSrc3ZZ1r8ENHlIXBfnRA= -google.golang.org/genproto/googleapis/api v0.0.0-20240930140551-af27646dc61f/go.mod h1:CLGoBuH1VHxAUXVPP8FfPwPEVJB6lz3URE5mY2SuayE= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f h1:cUMEy+8oS78BWIH9OWazBkzbr090Od9tWBNtZHkOhf0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/genproto/googleapis/api v0.0.0-20241007155032-5fefd90f89a9 h1:T6rh4haD3GVYsgEfWExoCZA2o2FmbNyKpTuAxbEFPTg= +google.golang.org/genproto/googleapis/api v0.0.0-20241007155032-5fefd90f89a9/go.mod h1:wp2WsuBYj6j8wUdo3ToZsdxxixbvQNAHqVJrTgi5E5M= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 h1:QCqS/PdaHTSWGvupk2F/ehwHtGc0/GYkT+3GAcR1CCc= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= diff --git a/config/log.go b/config/log.go index f30b37c8a45..7b9eff8497c 100644 --- a/config/log.go +++ b/config/log.go @@ -75,12 +75,12 @@ func logExporter(ctx context.Context, exporter LogRecordExporter) (sdklog.Export ) } - if exporter.OTLP != nil { - switch exporter.OTLP.Protocol { + if exporter.OTLP != nil && exporter.OTLP.Protocol != nil { + switch *exporter.OTLP.Protocol { case protocolProtobufHTTP: return otlpHTTPLogExporter(ctx, exporter.OTLP) default: - return nil, fmt.Errorf("unsupported protocol %q", exporter.OTLP.Protocol) + return nil, fmt.Errorf("unsupported protocol %q", *exporter.OTLP.Protocol) } } return nil, errors.New("no valid log exporter") @@ -120,8 +120,8 @@ func batchLogProcessor(blp *BatchLogRecordProcessor, exp sdklog.Exporter) (*sdkl func otlpHTTPLogExporter(ctx context.Context, otlpConfig *OTLP) (sdklog.Exporter, error) { var opts []otlploghttp.Option - if len(otlpConfig.Endpoint) > 0 { - u, err := url.ParseRequestURI(otlpConfig.Endpoint) + if otlpConfig.Endpoint != nil { + u, err := url.ParseRequestURI(*otlpConfig.Endpoint) if err != nil { return nil, err } @@ -148,7 +148,7 @@ func otlpHTTPLogExporter(ctx context.Context, otlpConfig *OTLP) (sdklog.Exporter opts = append(opts, otlploghttp.WithTimeout(time.Millisecond*time.Duration(*otlpConfig.Timeout))) } if len(otlpConfig.Headers) > 0 { - opts = append(opts, otlploghttp.WithHeaders(otlpConfig.Headers)) + opts = append(opts, otlploghttp.WithHeaders(toStringMap(otlpConfig.Headers))) } return otlploghttp.New(ctx, opts...) diff --git a/config/log_test.go b/config/log_test.go index 88318dc369d..1fa978f4f16 100644 --- a/config/log_test.go +++ b/config/log_test.go @@ -98,7 +98,7 @@ func TestLogProcessor(t *testing.T) { MaxExportBatchSize: ptr(-1), Exporter: LogRecordExporter{ OTLP: &OTLP{ - Protocol: "http/protobuf", + Protocol: ptr("http/protobuf"), }, }, }, @@ -112,7 +112,7 @@ func TestLogProcessor(t *testing.T) { ExportTimeout: ptr(-2), Exporter: LogRecordExporter{ OTLP: &OTLP{ - Protocol: "http/protobuf", + Protocol: ptr("http/protobuf"), }, }, }, @@ -127,7 +127,7 @@ func TestLogProcessor(t *testing.T) { MaxQueueSize: ptr(-3), Exporter: LogRecordExporter{ OTLP: &OTLP{ - Protocol: "http/protobuf", + Protocol: ptr("http/protobuf"), }, }, }, @@ -141,7 +141,7 @@ func TestLogProcessor(t *testing.T) { ScheduleDelay: ptr(-4), Exporter: LogRecordExporter{ OTLP: &OTLP{ - Protocol: "http/protobuf", + Protocol: ptr("http/protobuf"), }, }, }, @@ -182,12 +182,12 @@ func TestLogProcessor(t *testing.T) { ScheduleDelay: ptr(0), Exporter: LogRecordExporter{ OTLP: &OTLP{ - Protocol: "http/protobuf", - Endpoint: "http://localhost:4318", + Protocol: ptr("http/protobuf"), + Endpoint: ptr("http://localhost:4318"), Compression: ptr("gzip"), Timeout: ptr(1000), - Headers: map[string]string{ - "test": "test1", + Headers: []NameStringValuePair{ + {Name: "test", Value: ptr("test1")}, }, }, }, @@ -205,12 +205,12 @@ func TestLogProcessor(t *testing.T) { ScheduleDelay: ptr(0), Exporter: LogRecordExporter{ OTLP: &OTLP{ - Protocol: "http/protobuf", - Endpoint: "http://localhost:4318/path/123", + Protocol: ptr("http/protobuf"), + Endpoint: ptr("http://localhost:4318/path/123"), Compression: ptr("none"), Timeout: ptr(1000), - Headers: map[string]string{ - "test": "test1", + Headers: []NameStringValuePair{ + {Name: "test", Value: ptr("test1")}, }, }, }, @@ -228,11 +228,11 @@ func TestLogProcessor(t *testing.T) { ScheduleDelay: ptr(0), Exporter: LogRecordExporter{ OTLP: &OTLP{ - Protocol: "http/protobuf", + Protocol: ptr("http/protobuf"), Compression: ptr("gzip"), Timeout: ptr(1000), - Headers: map[string]string{ - "test": "test1", + Headers: []NameStringValuePair{ + {Name: "test", Value: ptr("test1")}, }, }, }, @@ -250,12 +250,12 @@ func TestLogProcessor(t *testing.T) { ScheduleDelay: ptr(0), Exporter: LogRecordExporter{ OTLP: &OTLP{ - Protocol: "http/protobuf", - Endpoint: "localhost:4318", + Protocol: ptr("http/protobuf"), + Endpoint: ptr("localhost:4318"), Compression: ptr("gzip"), Timeout: ptr(1000), - Headers: map[string]string{ - "test": "test1", + Headers: []NameStringValuePair{ + {Name: "test", Value: ptr("test1")}, }, }, }, @@ -273,12 +273,12 @@ func TestLogProcessor(t *testing.T) { ScheduleDelay: ptr(0), Exporter: LogRecordExporter{ OTLP: &OTLP{ - Protocol: "invalid", - Endpoint: "https://10.0.0.0:443", + Protocol: ptr("invalid"), + Endpoint: ptr("https://10.0.0.0:443"), Compression: ptr("gzip"), Timeout: ptr(1000), - Headers: map[string]string{ - "test": "test1", + Headers: []NameStringValuePair{ + {Name: "test", Value: ptr("test1")}, }, }, }, @@ -296,12 +296,12 @@ func TestLogProcessor(t *testing.T) { ScheduleDelay: ptr(0), Exporter: LogRecordExporter{ OTLP: &OTLP{ - Protocol: "http/protobuf", - Endpoint: " ", + Protocol: ptr("http/protobuf"), + Endpoint: ptr(" "), Compression: ptr("gzip"), Timeout: ptr(1000), - Headers: map[string]string{ - "test": "test1", + Headers: []NameStringValuePair{ + {Name: "test", Value: ptr("test1")}, }, }, }, @@ -319,12 +319,12 @@ func TestLogProcessor(t *testing.T) { ScheduleDelay: ptr(0), Exporter: LogRecordExporter{ OTLP: &OTLP{ - Protocol: "http/protobuf", - Endpoint: "localhost:4318", + Protocol: ptr("http/protobuf"), + Endpoint: ptr("localhost:4318"), Compression: ptr("none"), Timeout: ptr(1000), - Headers: map[string]string{ - "test": "test1", + Headers: []NameStringValuePair{ + {Name: "test", Value: ptr("test1")}, }, }, }, @@ -342,12 +342,12 @@ func TestLogProcessor(t *testing.T) { ScheduleDelay: ptr(0), Exporter: LogRecordExporter{ OTLP: &OTLP{ - Protocol: "http/protobuf", - Endpoint: "localhost:4318", + Protocol: ptr("http/protobuf"), + Endpoint: ptr("localhost:4318"), Compression: ptr("invalid"), Timeout: ptr(1000), - Headers: map[string]string{ - "test": "test1", + Headers: []NameStringValuePair{ + {Name: "test", Value: ptr("test1")}, }, }, }, @@ -381,12 +381,12 @@ func TestLogProcessor(t *testing.T) { Simple: &SimpleLogRecordProcessor{ Exporter: LogRecordExporter{ OTLP: &OTLP{ - Protocol: "http/protobuf", - Endpoint: "localhost:4318", + Protocol: ptr("http/protobuf"), + Endpoint: ptr("localhost:4318"), Compression: ptr("gzip"), Timeout: ptr(1000), - Headers: map[string]string{ - "test": "test1", + Headers: []NameStringValuePair{ + {Name: "test", Value: ptr("test1")}, }, }, }, diff --git a/config/metric.go b/config/metric.go index 38b294172fb..743d594456e 100644 --- a/config/metric.go +++ b/config/metric.go @@ -28,6 +28,7 @@ import ( "go.opentelemetry.io/otel/metric/noop" "go.opentelemetry.io/otel/sdk/instrumentation" sdkmetric "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.opentelemetry.io/otel/sdk/resource" ) @@ -92,14 +93,14 @@ func metricReader(ctx context.Context, r MetricReader) (sdkmetric.Reader, error) return nil, errors.New("no valid metric reader") } -func pullReader(ctx context.Context, exporter MetricExporter) (sdkmetric.Reader, error) { +func pullReader(ctx context.Context, exporter PullMetricExporter) (sdkmetric.Reader, error) { if exporter.Prometheus != nil { return prometheusReader(ctx, exporter.Prometheus) } return nil, errors.New("no valid metric exporter") } -func periodicExporter(ctx context.Context, exporter MetricExporter, opts ...sdkmetric.PeriodicReaderOption) (sdkmetric.Reader, error) { +func periodicExporter(ctx context.Context, exporter PushMetricExporter, opts ...sdkmetric.PeriodicReaderOption) (sdkmetric.Reader, error) { if exporter.Console != nil && exporter.OTLP != nil { return nil, errors.New("must not specify multiple exporters") } @@ -115,16 +116,16 @@ func periodicExporter(ctx context.Context, exporter MetricExporter, opts ...sdkm } return sdkmetric.NewPeriodicReader(exp, opts...), nil } - if exporter.OTLP != nil { + if exporter.OTLP != nil && exporter.OTLP.Protocol != nil { var err error var exp sdkmetric.Exporter - switch exporter.OTLP.Protocol { + switch *exporter.OTLP.Protocol { case protocolProtobufHTTP: exp, err = otlpHTTPMetricExporter(ctx, exporter.OTLP) case protocolProtobufGRPC: exp, err = otlpGRPCMetricExporter(ctx, exporter.OTLP) default: - return nil, fmt.Errorf("unsupported protocol %q", exporter.OTLP.Protocol) + return nil, fmt.Errorf("unsupported protocol %q", *exporter.OTLP.Protocol) } if err != nil { return nil, err @@ -137,8 +138,8 @@ func periodicExporter(ctx context.Context, exporter MetricExporter, opts ...sdkm func otlpHTTPMetricExporter(ctx context.Context, otlpConfig *OTLPMetric) (sdkmetric.Exporter, error) { opts := []otlpmetrichttp.Option{} - if len(otlpConfig.Endpoint) > 0 { - u, err := url.ParseRequestURI(otlpConfig.Endpoint) + if otlpConfig.Endpoint != nil { + u, err := url.ParseRequestURI(*otlpConfig.Endpoint) if err != nil { return nil, err } @@ -165,7 +166,19 @@ func otlpHTTPMetricExporter(ctx context.Context, otlpConfig *OTLPMetric) (sdkmet opts = append(opts, otlpmetrichttp.WithTimeout(time.Millisecond*time.Duration(*otlpConfig.Timeout))) } if len(otlpConfig.Headers) > 0 { - opts = append(opts, otlpmetrichttp.WithHeaders(otlpConfig.Headers)) + opts = append(opts, otlpmetrichttp.WithHeaders(toStringMap(otlpConfig.Headers))) + } + if otlpConfig.TemporalityPreference != nil { + switch *otlpConfig.TemporalityPreference { + case "delta": + opts = append(opts, otlpmetrichttp.WithTemporalitySelector(deltaTemporality)) + case "cumulative": + opts = append(opts, otlpmetrichttp.WithTemporalitySelector(cumulativeTemporality)) + case "lowmemory": + opts = append(opts, otlpmetrichttp.WithTemporalitySelector(lowMemory)) + default: + return nil, fmt.Errorf("unsupported temporality preference %q", *otlpConfig.TemporalityPreference) + } } return otlpmetrichttp.New(ctx, opts...) @@ -174,8 +187,8 @@ func otlpHTTPMetricExporter(ctx context.Context, otlpConfig *OTLPMetric) (sdkmet func otlpGRPCMetricExporter(ctx context.Context, otlpConfig *OTLPMetric) (sdkmetric.Exporter, error) { var opts []otlpmetricgrpc.Option - if len(otlpConfig.Endpoint) > 0 { - u, err := url.ParseRequestURI(otlpConfig.Endpoint) + if otlpConfig.Endpoint != nil { + u, err := url.ParseRequestURI(*otlpConfig.Endpoint) if err != nil { return nil, err } @@ -187,7 +200,7 @@ func otlpGRPCMetricExporter(ctx context.Context, otlpConfig *OTLPMetric) (sdkmet if u.Host != "" { opts = append(opts, otlpmetricgrpc.WithEndpoint(u.Host)) } else { - opts = append(opts, otlpmetricgrpc.WithEndpoint(otlpConfig.Endpoint)) + opts = append(opts, otlpmetricgrpc.WithEndpoint(*otlpConfig.Endpoint)) } if u.Scheme == "http" { opts = append(opts, otlpmetricgrpc.WithInsecure()) @@ -208,12 +221,82 @@ func otlpGRPCMetricExporter(ctx context.Context, otlpConfig *OTLPMetric) (sdkmet opts = append(opts, otlpmetricgrpc.WithTimeout(time.Millisecond*time.Duration(*otlpConfig.Timeout))) } if len(otlpConfig.Headers) > 0 { - opts = append(opts, otlpmetricgrpc.WithHeaders(otlpConfig.Headers)) + opts = append(opts, otlpmetricgrpc.WithHeaders(toStringMap(otlpConfig.Headers))) + } + if otlpConfig.TemporalityPreference != nil { + switch *otlpConfig.TemporalityPreference { + case "delta": + opts = append(opts, otlpmetricgrpc.WithTemporalitySelector(deltaTemporality)) + case "cumulative": + opts = append(opts, otlpmetricgrpc.WithTemporalitySelector(cumulativeTemporality)) + case "lowmemory": + opts = append(opts, otlpmetricgrpc.WithTemporalitySelector(lowMemory)) + default: + return nil, fmt.Errorf("unsupported temporality preference %q", *otlpConfig.TemporalityPreference) + } } return otlpmetricgrpc.New(ctx, opts...) } +func cumulativeTemporality(sdkmetric.InstrumentKind) metricdata.Temporality { + return metricdata.CumulativeTemporality +} + +func deltaTemporality(ik sdkmetric.InstrumentKind) metricdata.Temporality { + switch ik { + case sdkmetric.InstrumentKindCounter, sdkmetric.InstrumentKindHistogram, sdkmetric.InstrumentKindObservableCounter: + return metricdata.DeltaTemporality + default: + return metricdata.CumulativeTemporality + } +} + +func lowMemory(ik sdkmetric.InstrumentKind) metricdata.Temporality { + switch ik { + case sdkmetric.InstrumentKindCounter, sdkmetric.InstrumentKindHistogram: + return metricdata.DeltaTemporality + default: + return metricdata.CumulativeTemporality + } +} + +// newIncludeExcludeFilter returns a Filter that includes attributes +// in the include list and excludes attributes in the excludes list. +// It returns an error if an attribute is in both lists +// +// If IncludeExclude is empty a include-all filter is returned. +func newIncludeExcludeFilter(lists *IncludeExclude) (attribute.Filter, error) { + if lists == nil { + return func(kv attribute.KeyValue) bool { return true }, nil + } + + included := make(map[attribute.Key]struct{}) + for _, k := range lists.Included { + included[attribute.Key(k)] = struct{}{} + } + excluded := make(map[attribute.Key]struct{}) + for _, k := range lists.Excluded { + if _, ok := included[attribute.Key(k)]; ok { + return nil, fmt.Errorf("attribute cannot be in both include and exclude list: %s", k) + } + excluded[attribute.Key(k)] = struct{}{} + } + return func(kv attribute.KeyValue) bool { + // check if a value is excluded first + if _, ok := excluded[kv.Key]; ok { + return false + } + + if len(included) == 0 { + return true + } + + _, ok := included[kv.Key] + return ok + }, nil +} + func prometheusReader(ctx context.Context, prometheusConfig *Prometheus) (sdkmetric.Reader, error) { var opts []otelprom.Option if prometheusConfig.Host == nil { @@ -232,20 +315,11 @@ func prometheusReader(ctx context.Context, prometheusConfig *Prometheus) (sdkmet opts = append(opts, otelprom.WithoutUnits()) } if prometheusConfig.WithResourceConstantLabels != nil { - if prometheusConfig.WithResourceConstantLabels.Included != nil { - var keys []attribute.Key - for _, val := range prometheusConfig.WithResourceConstantLabels.Included { - keys = append(keys, attribute.Key(val)) - } - otelprom.WithResourceAsConstantLabels(attribute.NewAllowKeysFilter(keys...)) - } - if prometheusConfig.WithResourceConstantLabels.Excluded != nil { - var keys []attribute.Key - for _, val := range prometheusConfig.WithResourceConstantLabels.Included { - keys = append(keys, attribute.Key(val)) - } - otelprom.WithResourceAsConstantLabels(attribute.NewDenyKeysFilter(keys...)) + f, err := newIncludeExcludeFilter(prometheusConfig.WithResourceConstantLabels) + if err != nil { + return nil, err } + otelprom.WithResourceAsConstantLabels(f) } reg := prometheus.NewRegistry() @@ -306,7 +380,11 @@ func view(v View) (sdkmetric.View, error) { return nil, err } - return sdkmetric.NewView(inst, stream(v.Stream)), nil + s, err := stream(v.Stream) + if err != nil { + return nil, err + } + return sdkmetric.NewView(inst, s), nil } func instrument(vs ViewSelector) (sdkmetric.Instrument, error) { @@ -331,25 +409,21 @@ func instrument(vs ViewSelector) (sdkmetric.Instrument, error) { return inst, nil } -func stream(vs *ViewStream) sdkmetric.Stream { +func stream(vs *ViewStream) (sdkmetric.Stream, error) { if vs == nil { - return sdkmetric.Stream{} + return sdkmetric.Stream{}, nil } + f, err := newIncludeExcludeFilter(vs.AttributeKeys) + if err != nil { + return sdkmetric.Stream{}, err + } return sdkmetric.Stream{ Name: strOrEmpty(vs.Name), Description: strOrEmpty(vs.Description), Aggregation: aggregation(vs.Aggregation), - AttributeFilter: attributeFilter(vs.AttributeKeys), - } -} - -func attributeFilter(attributeKeys []string) attribute.Filter { - var attrKeys []attribute.Key - for _, attrStr := range attributeKeys { - attrKeys = append(attrKeys, attribute.Key(attrStr)) - } - return attribute.NewAllowKeysFilter(attrKeys...) + AttributeFilter: f, + }, nil } func aggregation(aggr *ViewStreamAggregation) sdkmetric.Aggregation { diff --git a/config/metric_test.go b/config/metric_test.go index ad45fbdf35f..8d7ced508ca 100644 --- a/config/metric_test.go +++ b/config/metric_test.go @@ -6,6 +6,7 @@ package config import ( "context" "errors" + "fmt" "net/url" "reflect" "testing" @@ -66,7 +67,7 @@ func TestMeterProvider(t *testing.T) { }, { Periodic: &PeriodicMetricReader{ - Exporter: MetricExporter{ + Exporter: PushMetricExporter{ Console: Console{}, OTLP: &OTLPMetric{}, }, @@ -122,7 +123,7 @@ func TestReader(t *testing.T) { name: "pull/prometheus-no-host", reader: MetricReader{ Pull: &PullMetricReader{ - Exporter: MetricExporter{ + Exporter: PullMetricExporter{ Prometheus: &Prometheus{}, }, }, @@ -133,7 +134,7 @@ func TestReader(t *testing.T) { name: "pull/prometheus-no-port", reader: MetricReader{ Pull: &PullMetricReader{ - Exporter: MetricExporter{ + Exporter: PullMetricExporter{ Prometheus: &Prometheus{ Host: ptr("localhost"), }, @@ -146,7 +147,7 @@ func TestReader(t *testing.T) { name: "pull/prometheus", reader: MetricReader{ Pull: &PullMetricReader{ - Exporter: MetricExporter{ + Exporter: PullMetricExporter{ Prometheus: &Prometheus{ Host: ptr("localhost"), Port: ptr(8888), @@ -167,9 +168,9 @@ func TestReader(t *testing.T) { name: "periodic/otlp-exporter-invalid-protocol", reader: MetricReader{ Periodic: &PeriodicMetricReader{ - Exporter: MetricExporter{ + Exporter: PushMetricExporter{ OTLP: &OTLPMetric{ - Protocol: "http/invalid", + Protocol: ptr("http/invalid"), }, }, }, @@ -180,14 +181,14 @@ func TestReader(t *testing.T) { name: "periodic/otlp-grpc-exporter", reader: MetricReader{ Periodic: &PeriodicMetricReader{ - Exporter: MetricExporter{ + Exporter: PushMetricExporter{ OTLP: &OTLPMetric{ - Protocol: "grpc/protobuf", - Endpoint: "http://localhost:4318", + Protocol: ptr("grpc/protobuf"), + Endpoint: ptr("http://localhost:4318"), Compression: ptr("gzip"), Timeout: ptr(1000), - Headers: map[string]string{ - "test": "test1", + Headers: []NameStringValuePair{ + {Name: "test", Value: ptr("test1")}, }, }, }, @@ -199,14 +200,14 @@ func TestReader(t *testing.T) { name: "periodic/otlp-grpc-exporter-with-path", reader: MetricReader{ Periodic: &PeriodicMetricReader{ - Exporter: MetricExporter{ + Exporter: PushMetricExporter{ OTLP: &OTLPMetric{ - Protocol: "grpc/protobuf", - Endpoint: "http://localhost:4318/path/123", + Protocol: ptr("grpc/protobuf"), + Endpoint: ptr("http://localhost:4318/path/123"), Compression: ptr("gzip"), Timeout: ptr(1000), - Headers: map[string]string{ - "test": "test1", + Headers: []NameStringValuePair{ + {Name: "test", Value: ptr("test1")}, }, }, }, @@ -218,13 +219,13 @@ func TestReader(t *testing.T) { name: "periodic/otlp-grpc-exporter-no-endpoint", reader: MetricReader{ Periodic: &PeriodicMetricReader{ - Exporter: MetricExporter{ + Exporter: PushMetricExporter{ OTLP: &OTLPMetric{ - Protocol: "grpc/protobuf", + Protocol: ptr("grpc/protobuf"), Compression: ptr("gzip"), Timeout: ptr(1000), - Headers: map[string]string{ - "test": "test1", + Headers: []NameStringValuePair{ + {Name: "test", Value: ptr("test1")}, }, }, }, @@ -236,14 +237,14 @@ func TestReader(t *testing.T) { name: "periodic/otlp-grpc-exporter-no-scheme", reader: MetricReader{ Periodic: &PeriodicMetricReader{ - Exporter: MetricExporter{ + Exporter: PushMetricExporter{ OTLP: &OTLPMetric{ - Protocol: "grpc/protobuf", - Endpoint: "localhost:4318", + Protocol: ptr("grpc/protobuf"), + Endpoint: ptr("localhost:4318"), Compression: ptr("gzip"), Timeout: ptr(1000), - Headers: map[string]string{ - "test": "test1", + Headers: []NameStringValuePair{ + {Name: "test", Value: ptr("test1")}, }, }, }, @@ -255,14 +256,14 @@ func TestReader(t *testing.T) { name: "periodic/otlp-grpc-invalid-endpoint", reader: MetricReader{ Periodic: &PeriodicMetricReader{ - Exporter: MetricExporter{ + Exporter: PushMetricExporter{ OTLP: &OTLPMetric{ - Protocol: "grpc/protobuf", - Endpoint: " ", + Protocol: ptr("grpc/protobuf"), + Endpoint: ptr(" "), Compression: ptr("gzip"), Timeout: ptr(1000), - Headers: map[string]string{ - "test": "test1", + Headers: []NameStringValuePair{ + {Name: "test", Value: ptr("test1")}, }, }, }, @@ -271,17 +272,17 @@ func TestReader(t *testing.T) { wantErr: &url.Error{Op: "parse", URL: " ", Err: errors.New("invalid URI for request")}, }, { - name: "periodic/grpc-http-none-compression", + name: "periodic/otlp-grpc-none-compression", reader: MetricReader{ Periodic: &PeriodicMetricReader{ - Exporter: MetricExporter{ + Exporter: PushMetricExporter{ OTLP: &OTLPMetric{ - Protocol: "grpc/protobuf", - Endpoint: "localhost:4318", + Protocol: ptr("grpc/protobuf"), + Endpoint: ptr("localhost:4318"), Compression: ptr("none"), Timeout: ptr(1000), - Headers: map[string]string{ - "test": "test1", + Headers: []NameStringValuePair{ + {Name: "test", Value: ptr("test1")}, }, }, }, @@ -289,18 +290,98 @@ func TestReader(t *testing.T) { }, wantReader: sdkmetric.NewPeriodicReader(otlpGRPCExporter), }, + { + name: "periodic/otlp-grpc-delta-temporality", + reader: MetricReader{ + Periodic: &PeriodicMetricReader{ + Exporter: PushMetricExporter{ + OTLP: &OTLPMetric{ + Protocol: ptr("grpc/protobuf"), + Endpoint: ptr("localhost:4318"), + Compression: ptr("none"), + Timeout: ptr(1000), + Headers: []NameStringValuePair{ + {Name: "test", Value: ptr("test1")}, + }, + TemporalityPreference: ptr("delta"), + }, + }, + }, + }, + wantReader: sdkmetric.NewPeriodicReader(otlpGRPCExporter), + }, + { + name: "periodic/otlp-grpc-cumulative-temporality", + reader: MetricReader{ + Periodic: &PeriodicMetricReader{ + Exporter: PushMetricExporter{ + OTLP: &OTLPMetric{ + Protocol: ptr("grpc/protobuf"), + Endpoint: ptr("localhost:4318"), + Compression: ptr("none"), + Timeout: ptr(1000), + Headers: []NameStringValuePair{ + {Name: "test", Value: ptr("test1")}, + }, + TemporalityPreference: ptr("cumulative"), + }, + }, + }, + }, + wantReader: sdkmetric.NewPeriodicReader(otlpGRPCExporter), + }, + { + name: "periodic/otlp-grpc-lowmemory-temporality", + reader: MetricReader{ + Periodic: &PeriodicMetricReader{ + Exporter: PushMetricExporter{ + OTLP: &OTLPMetric{ + Protocol: ptr("grpc/protobuf"), + Endpoint: ptr("localhost:4318"), + Compression: ptr("none"), + Timeout: ptr(1000), + Headers: []NameStringValuePair{ + {Name: "test", Value: ptr("test1")}, + }, + TemporalityPreference: ptr("lowmemory"), + }, + }, + }, + }, + wantReader: sdkmetric.NewPeriodicReader(otlpGRPCExporter), + }, + { + name: "periodic/otlp-grpc-invalid-temporality", + reader: MetricReader{ + Periodic: &PeriodicMetricReader{ + Exporter: PushMetricExporter{ + OTLP: &OTLPMetric{ + Protocol: ptr("grpc/protobuf"), + Endpoint: ptr("localhost:4318"), + Compression: ptr("none"), + Timeout: ptr(1000), + Headers: []NameStringValuePair{ + {Name: "test", Value: ptr("test1")}, + }, + TemporalityPreference: ptr("invalid"), + }, + }, + }, + }, + wantErr: errors.New("unsupported temporality preference \"invalid\""), + }, { name: "periodic/otlp-grpc-invalid-compression", reader: MetricReader{ Periodic: &PeriodicMetricReader{ - Exporter: MetricExporter{ + Exporter: PushMetricExporter{ OTLP: &OTLPMetric{ - Protocol: "grpc/protobuf", - Endpoint: "localhost:4318", + Protocol: ptr("grpc/protobuf"), + Endpoint: ptr("localhost:4318"), Compression: ptr("invalid"), Timeout: ptr(1000), - Headers: map[string]string{ - "test": "test1", + Headers: []NameStringValuePair{ + {Name: "test", Value: ptr("test1")}, }, }, }, @@ -312,14 +393,14 @@ func TestReader(t *testing.T) { name: "periodic/otlp-http-exporter", reader: MetricReader{ Periodic: &PeriodicMetricReader{ - Exporter: MetricExporter{ + Exporter: PushMetricExporter{ OTLP: &OTLPMetric{ - Protocol: "http/protobuf", - Endpoint: "http://localhost:4318", + Protocol: ptr("http/protobuf"), + Endpoint: ptr("http://localhost:4318"), Compression: ptr("gzip"), Timeout: ptr(1000), - Headers: map[string]string{ - "test": "test1", + Headers: []NameStringValuePair{ + {Name: "test", Value: ptr("test1")}, }, }, }, @@ -331,14 +412,14 @@ func TestReader(t *testing.T) { name: "periodic/otlp-http-exporter-with-path", reader: MetricReader{ Periodic: &PeriodicMetricReader{ - Exporter: MetricExporter{ + Exporter: PushMetricExporter{ OTLP: &OTLPMetric{ - Protocol: "http/protobuf", - Endpoint: "http://localhost:4318/path/123", + Protocol: ptr("http/protobuf"), + Endpoint: ptr("http://localhost:4318/path/123"), Compression: ptr("gzip"), Timeout: ptr(1000), - Headers: map[string]string{ - "test": "test1", + Headers: []NameStringValuePair{ + {Name: "test", Value: ptr("test1")}, }, }, }, @@ -350,13 +431,13 @@ func TestReader(t *testing.T) { name: "periodic/otlp-http-exporter-no-endpoint", reader: MetricReader{ Periodic: &PeriodicMetricReader{ - Exporter: MetricExporter{ + Exporter: PushMetricExporter{ OTLP: &OTLPMetric{ - Protocol: "http/protobuf", + Protocol: ptr("http/protobuf"), Compression: ptr("gzip"), Timeout: ptr(1000), - Headers: map[string]string{ - "test": "test1", + Headers: []NameStringValuePair{ + {Name: "test", Value: ptr("test1")}, }, }, }, @@ -368,14 +449,14 @@ func TestReader(t *testing.T) { name: "periodic/otlp-http-exporter-no-scheme", reader: MetricReader{ Periodic: &PeriodicMetricReader{ - Exporter: MetricExporter{ + Exporter: PushMetricExporter{ OTLP: &OTLPMetric{ - Protocol: "http/protobuf", - Endpoint: "localhost:4318", + Protocol: ptr("http/protobuf"), + Endpoint: ptr("localhost:4318"), Compression: ptr("gzip"), Timeout: ptr(1000), - Headers: map[string]string{ - "test": "test1", + Headers: []NameStringValuePair{ + {Name: "test", Value: ptr("test1")}, }, }, }, @@ -387,14 +468,14 @@ func TestReader(t *testing.T) { name: "periodic/otlp-http-invalid-endpoint", reader: MetricReader{ Periodic: &PeriodicMetricReader{ - Exporter: MetricExporter{ + Exporter: PushMetricExporter{ OTLP: &OTLPMetric{ - Protocol: "http/protobuf", - Endpoint: " ", + Protocol: ptr("http/protobuf"), + Endpoint: ptr(" "), Compression: ptr("gzip"), Timeout: ptr(1000), - Headers: map[string]string{ - "test": "test1", + Headers: []NameStringValuePair{ + {Name: "test", Value: ptr("test1")}, }, }, }, @@ -406,33 +487,113 @@ func TestReader(t *testing.T) { name: "periodic/otlp-http-none-compression", reader: MetricReader{ Periodic: &PeriodicMetricReader{ - Exporter: MetricExporter{ + Exporter: PushMetricExporter{ + OTLP: &OTLPMetric{ + Protocol: ptr("http/protobuf"), + Endpoint: ptr("localhost:4318"), + Compression: ptr("none"), + Timeout: ptr(1000), + Headers: []NameStringValuePair{ + {Name: "test", Value: ptr("test1")}, + }, + }, + }, + }, + }, + wantReader: sdkmetric.NewPeriodicReader(otlpHTTPExporter), + }, + { + name: "periodic/otlp-http-cumulative-temporality", + reader: MetricReader{ + Periodic: &PeriodicMetricReader{ + Exporter: PushMetricExporter{ + OTLP: &OTLPMetric{ + Protocol: ptr("http/protobuf"), + Endpoint: ptr("localhost:4318"), + Compression: ptr("none"), + Timeout: ptr(1000), + Headers: []NameStringValuePair{ + {Name: "test", Value: ptr("test1")}, + }, + TemporalityPreference: ptr("cumulative"), + }, + }, + }, + }, + wantReader: sdkmetric.NewPeriodicReader(otlpHTTPExporter), + }, + { + name: "periodic/otlp-http-lowmemory-temporality", + reader: MetricReader{ + Periodic: &PeriodicMetricReader{ + Exporter: PushMetricExporter{ + OTLP: &OTLPMetric{ + Protocol: ptr("http/protobuf"), + Endpoint: ptr("localhost:4318"), + Compression: ptr("none"), + Timeout: ptr(1000), + Headers: []NameStringValuePair{ + {Name: "test", Value: ptr("test1")}, + }, + TemporalityPreference: ptr("lowmemory"), + }, + }, + }, + }, + wantReader: sdkmetric.NewPeriodicReader(otlpHTTPExporter), + }, + { + name: "periodic/otlp-http-delta-temporality", + reader: MetricReader{ + Periodic: &PeriodicMetricReader{ + Exporter: PushMetricExporter{ OTLP: &OTLPMetric{ - Protocol: "http/protobuf", - Endpoint: "localhost:4318", + Protocol: ptr("http/protobuf"), + Endpoint: ptr("localhost:4318"), Compression: ptr("none"), Timeout: ptr(1000), - Headers: map[string]string{ - "test": "test1", + Headers: []NameStringValuePair{ + {Name: "test", Value: ptr("test1")}, }, + TemporalityPreference: ptr("delta"), }, }, }, }, wantReader: sdkmetric.NewPeriodicReader(otlpHTTPExporter), }, + { + name: "periodic/otlp-http-invalid-temporality", + reader: MetricReader{ + Periodic: &PeriodicMetricReader{ + Exporter: PushMetricExporter{ + OTLP: &OTLPMetric{ + Protocol: ptr("http/protobuf"), + Endpoint: ptr("localhost:4318"), + Compression: ptr("none"), + Timeout: ptr(1000), + Headers: []NameStringValuePair{ + {Name: "test", Value: ptr("test1")}, + }, + TemporalityPreference: ptr("invalid"), + }, + }, + }, + }, + wantErr: errors.New("unsupported temporality preference \"invalid\""), + }, { name: "periodic/otlp-http-invalid-compression", reader: MetricReader{ Periodic: &PeriodicMetricReader{ - Exporter: MetricExporter{ + Exporter: PushMetricExporter{ OTLP: &OTLPMetric{ - Protocol: "http/protobuf", - Endpoint: "localhost:4318", + Protocol: ptr("http/protobuf"), + Endpoint: ptr("localhost:4318"), Compression: ptr("invalid"), Timeout: ptr(1000), - Headers: map[string]string{ - "test": "test1", + Headers: []NameStringValuePair{ + {Name: "test", Value: ptr("test1")}, }, }, }, @@ -444,7 +605,7 @@ func TestReader(t *testing.T) { name: "periodic/no-exporter", reader: MetricReader{ Periodic: &PeriodicMetricReader{ - Exporter: MetricExporter{}, + Exporter: PushMetricExporter{}, }, }, wantErr: errors.New("no valid metric exporter"), @@ -453,7 +614,7 @@ func TestReader(t *testing.T) { name: "periodic/console-exporter", reader: MetricReader{ Periodic: &PeriodicMetricReader{ - Exporter: MetricExporter{ + Exporter: PushMetricExporter{ Console: Console{}, }, }, @@ -466,7 +627,7 @@ func TestReader(t *testing.T) { Periodic: &PeriodicMetricReader{ Interval: ptr(30_000), Timeout: ptr(5_000), - Exporter: MetricExporter{ + Exporter: PushMetricExporter{ Console: Console{}, }, }, @@ -719,7 +880,7 @@ func TestView(t *testing.T) { Stream: &ViewStream{ Name: ptr("new_name"), Description: ptr("new_description"), - AttributeKeys: []string{"foo", "bar"}, + AttributeKeys: ptr(IncludeExclude{Included: []string{"foo", "bar"}}), Aggregation: &ViewStreamAggregation{Sum: make(ViewStreamAggregationSum)}, }, }, @@ -917,29 +1078,49 @@ func TestAggregation(t *testing.T) { } } -func TestAttributeFilter(t *testing.T) { +func TestNewIncludeExcludeFilter(t *testing.T) { testCases := []struct { name string - attributeKeys []string + attributeKeys *IncludeExclude wantPass []string wantFail []string }{ { name: "empty", - attributeKeys: []string{}, - wantPass: nil, - wantFail: []string{"foo", "bar"}, + attributeKeys: nil, + wantPass: []string{"foo", "bar"}, + wantFail: nil, }, { - name: "filter", - attributeKeys: []string{"foo"}, - wantPass: []string{"foo"}, - wantFail: []string{"bar"}, + name: "filter-with-include", + attributeKeys: ptr(IncludeExclude{ + Included: []string{"foo"}, + }), + wantPass: []string{"foo"}, + wantFail: []string{"bar"}, + }, + { + name: "filter-with-exclude", + attributeKeys: ptr(IncludeExclude{ + Excluded: []string{"foo"}, + }), + wantPass: []string{"bar"}, + wantFail: []string{"foo"}, + }, + { + name: "filter-with-include-and-exclude", + attributeKeys: ptr(IncludeExclude{ + Included: []string{"bar"}, + Excluded: []string{"foo"}, + }), + wantPass: []string{"bar"}, + wantFail: []string{"foo"}, }, } for _, tt := range testCases { t.Run(tt.name, func(t *testing.T) { - got := attributeFilter(tt.attributeKeys) + got, err := newIncludeExcludeFilter(tt.attributeKeys) + require.NoError(t, err) for _, pass := range tt.wantPass { require.True(t, got(attribute.KeyValue{Key: attribute.Key(pass), Value: attribute.StringValue("")})) } @@ -949,3 +1130,11 @@ func TestAttributeFilter(t *testing.T) { }) } } + +func TestNewIncludeExcludeFilterError(t *testing.T) { + _, err := newIncludeExcludeFilter(ptr(IncludeExclude{ + Included: []string{"foo"}, + Excluded: []string{"foo"}, + })) + require.Equal(t, fmt.Errorf("attribute cannot be in both include and exclude list: foo"), err) +} diff --git a/config/resource.go b/config/resource.go index 020d6660b23..1e62d29c295 100644 --- a/config/resource.go +++ b/config/resource.go @@ -51,8 +51,8 @@ func newResource(res *Resource) (*resource.Resource, error) { } var attrs []attribute.KeyValue - for k, v := range res.Attributes { - attrs = append(attrs, keyVal(k, v)) + for _, v := range res.Attributes { + attrs = append(attrs, keyVal(v.Name, v.Value)) } return resource.Merge(resource.Default(), diff --git a/config/resource_test.go b/config/resource_test.go index 3ae78565069..b51650429b0 100644 --- a/config/resource_test.go +++ b/config/resource_test.go @@ -63,8 +63,8 @@ func TestNewResource(t *testing.T) { name: "resource-with-attributes-invalid-schema", config: &Resource{ SchemaUrl: ptr("https://opentelemetry.io/invalid-schema"), - Attributes: Attributes{ - "service.name": "service-a", + Attributes: []AttributeNameValue{ + {Name: "service.name", Value: "service-a"}, }, }, wantResource: resource.NewSchemaless(res.Attributes()...), @@ -73,8 +73,8 @@ func TestNewResource(t *testing.T) { { name: "resource-with-attributes-and-schema", config: &Resource{ - Attributes: Attributes{ - "service.name": "service-a", + Attributes: []AttributeNameValue{ + {Name: "service.name", Value: "service-a"}, }, SchemaUrl: ptr(semconv.SchemaURL), }, @@ -83,23 +83,23 @@ func TestNewResource(t *testing.T) { { name: "resource-with-additional-attributes-and-schema", config: &Resource{ - Attributes: Attributes{ - "service.name": "service-a", - "attr-bool": true, - "attr-int64": int64(-164), - "attr-uint64": uint64(164), - "attr-float64": float64(64.0), - "attr-int8": int8(-18), - "attr-uint8": uint8(18), - "attr-int16": int16(-116), - "attr-uint16": uint16(116), - "attr-int32": int32(-132), - "attr-uint32": uint32(132), - "attr-float32": float32(32.0), - "attr-int": int(-1), - "attr-uint": uint(1), - "attr-string": "string-val", - "attr-default": other, + Attributes: []AttributeNameValue{ + {Name: "service.name", Value: "service-a"}, + {Name: "attr-bool", Value: true}, + {Name: "attr-int64", Value: int64(-164)}, + {Name: "attr-uint64", Value: uint64(164)}, + {Name: "attr-float64", Value: float64(64.0)}, + {Name: "attr-int8", Value: int8(-18)}, + {Name: "attr-uint8", Value: uint8(18)}, + {Name: "attr-int16", Value: int16(-116)}, + {Name: "attr-uint16", Value: uint16(116)}, + {Name: "attr-int32", Value: int32(-132)}, + {Name: "attr-uint32", Value: uint32(132)}, + {Name: "attr-float32", Value: float32(32.0)}, + {Name: "attr-int", Value: int(-1)}, + {Name: "attr-uint", Value: uint(1)}, + {Name: "attr-string", Value: "string-val"}, + {Name: "attr-default", Value: other}, }, SchemaUrl: ptr(semconv.SchemaURL), }, 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" diff --git a/config/trace.go b/config/trace.go index aff4c3584ec..b80c8958a47 100644 --- a/config/trace.go +++ b/config/trace.go @@ -52,14 +52,14 @@ func spanExporter(ctx context.Context, exporter SpanExporter) (sdktrace.SpanExpo stdouttrace.WithPrettyPrint(), ) } - if exporter.OTLP != nil { - switch exporter.OTLP.Protocol { + if exporter.OTLP != nil && exporter.OTLP.Protocol != nil { + switch *exporter.OTLP.Protocol { case protocolProtobufHTTP: return otlpHTTPSpanExporter(ctx, exporter.OTLP) case protocolProtobufGRPC: return otlpGRPCSpanExporter(ctx, exporter.OTLP) default: - return nil, fmt.Errorf("unsupported protocol %q", exporter.OTLP.Protocol) + return nil, fmt.Errorf("unsupported protocol %q", *exporter.OTLP.Protocol) } } return nil, errors.New("no valid span exporter") @@ -89,8 +89,8 @@ func spanProcessor(ctx context.Context, processor SpanProcessor) (sdktrace.SpanP func otlpGRPCSpanExporter(ctx context.Context, otlpConfig *OTLP) (sdktrace.SpanExporter, error) { var opts []otlptracegrpc.Option - if len(otlpConfig.Endpoint) > 0 { - u, err := url.ParseRequestURI(otlpConfig.Endpoint) + if otlpConfig.Endpoint != nil { + u, err := url.ParseRequestURI(*otlpConfig.Endpoint) if err != nil { return nil, err } @@ -102,7 +102,7 @@ func otlpGRPCSpanExporter(ctx context.Context, otlpConfig *OTLP) (sdktrace.SpanE if u.Host != "" { opts = append(opts, otlptracegrpc.WithEndpoint(u.Host)) } else { - opts = append(opts, otlptracegrpc.WithEndpoint(otlpConfig.Endpoint)) + opts = append(opts, otlptracegrpc.WithEndpoint(*otlpConfig.Endpoint)) } if u.Scheme == "http" { @@ -124,7 +124,7 @@ func otlpGRPCSpanExporter(ctx context.Context, otlpConfig *OTLP) (sdktrace.SpanE opts = append(opts, otlptracegrpc.WithTimeout(time.Millisecond*time.Duration(*otlpConfig.Timeout))) } if len(otlpConfig.Headers) > 0 { - opts = append(opts, otlptracegrpc.WithHeaders(otlpConfig.Headers)) + opts = append(opts, otlptracegrpc.WithHeaders(toStringMap(otlpConfig.Headers))) } return otlptracegrpc.New(ctx, opts...) @@ -133,8 +133,8 @@ func otlpGRPCSpanExporter(ctx context.Context, otlpConfig *OTLP) (sdktrace.SpanE func otlpHTTPSpanExporter(ctx context.Context, otlpConfig *OTLP) (sdktrace.SpanExporter, error) { var opts []otlptracehttp.Option - if len(otlpConfig.Endpoint) > 0 { - u, err := url.ParseRequestURI(otlpConfig.Endpoint) + if otlpConfig.Endpoint != nil { + u, err := url.ParseRequestURI(*otlpConfig.Endpoint) if err != nil { return nil, err } @@ -161,7 +161,7 @@ func otlpHTTPSpanExporter(ctx context.Context, otlpConfig *OTLP) (sdktrace.SpanE opts = append(opts, otlptracehttp.WithTimeout(time.Millisecond*time.Duration(*otlpConfig.Timeout))) } if len(otlpConfig.Headers) > 0 { - opts = append(opts, otlptracehttp.WithHeaders(otlpConfig.Headers)) + opts = append(opts, otlptracehttp.WithHeaders(toStringMap(otlpConfig.Headers))) } return otlptracehttp.New(ctx, opts...) diff --git a/config/trace_test.go b/config/trace_test.go index 4f4a197770e..b526886242a 100644 --- a/config/trace_test.go +++ b/config/trace_test.go @@ -209,7 +209,7 @@ func TestSpanProcessor(t *testing.T) { ScheduleDelay: ptr(0), Exporter: SpanExporter{ OTLP: &OTLP{ - Protocol: "http/invalid", + Protocol: ptr("http/invalid"), }, }, }, @@ -226,11 +226,11 @@ func TestSpanProcessor(t *testing.T) { ScheduleDelay: ptr(0), Exporter: SpanExporter{ OTLP: &OTLP{ - Protocol: "grpc/protobuf", + Protocol: ptr("grpc/protobuf"), Compression: ptr("gzip"), Timeout: ptr(1000), - Headers: map[string]string{ - "test": "test1", + Headers: []NameStringValuePair{ + {Name: "test", Value: ptr("test1")}, }, }, }, @@ -248,12 +248,12 @@ func TestSpanProcessor(t *testing.T) { ScheduleDelay: ptr(0), Exporter: SpanExporter{ OTLP: &OTLP{ - Protocol: "grpc/protobuf", - Endpoint: "http://localhost:4317", + Protocol: ptr("grpc/protobuf"), + Endpoint: ptr("http://localhost:4317"), Compression: ptr("gzip"), Timeout: ptr(1000), - Headers: map[string]string{ - "test": "test1", + Headers: []NameStringValuePair{ + {Name: "test", Value: ptr("test1")}, }, }, }, @@ -271,12 +271,12 @@ func TestSpanProcessor(t *testing.T) { ScheduleDelay: ptr(0), Exporter: SpanExporter{ OTLP: &OTLP{ - Protocol: "grpc/protobuf", - Endpoint: "localhost:4317", + Protocol: ptr("grpc/protobuf"), + Endpoint: ptr("localhost:4317"), Compression: ptr("gzip"), Timeout: ptr(1000), - Headers: map[string]string{ - "test": "test1", + Headers: []NameStringValuePair{ + {Name: "test", Value: ptr("test1")}, }, }, }, @@ -294,12 +294,12 @@ func TestSpanProcessor(t *testing.T) { ScheduleDelay: ptr(0), Exporter: SpanExporter{ OTLP: &OTLP{ - Protocol: "grpc/protobuf", - Endpoint: " ", + Protocol: ptr("grpc/protobuf"), + Endpoint: ptr(" "), Compression: ptr("gzip"), Timeout: ptr(1000), - Headers: map[string]string{ - "test": "test1", + Headers: []NameStringValuePair{ + {Name: "test", Value: ptr("test1")}, }, }, }, @@ -317,12 +317,12 @@ func TestSpanProcessor(t *testing.T) { ScheduleDelay: ptr(0), Exporter: SpanExporter{ OTLP: &OTLP{ - Protocol: "grpc/protobuf", - Endpoint: "localhost:4317", + Protocol: ptr("grpc/protobuf"), + Endpoint: ptr("localhost:4317"), Compression: ptr("invalid"), Timeout: ptr(1000), - Headers: map[string]string{ - "test": "test1", + Headers: []NameStringValuePair{ + {Name: "test", Value: ptr("test1")}, }, }, }, @@ -340,12 +340,12 @@ func TestSpanProcessor(t *testing.T) { ScheduleDelay: ptr(0), Exporter: SpanExporter{ OTLP: &OTLP{ - Protocol: "http/protobuf", - Endpoint: "http://localhost:4318", + Protocol: ptr("http/protobuf"), + Endpoint: ptr("http://localhost:4318"), Compression: ptr("gzip"), Timeout: ptr(1000), - Headers: map[string]string{ - "test": "test1", + Headers: []NameStringValuePair{ + {Name: "test", Value: ptr("test1")}, }, }, }, @@ -363,12 +363,12 @@ func TestSpanProcessor(t *testing.T) { ScheduleDelay: ptr(0), Exporter: SpanExporter{ OTLP: &OTLP{ - Protocol: "http/protobuf", - Endpoint: "http://localhost:4318/path/123", + Protocol: ptr("http/protobuf"), + Endpoint: ptr("http://localhost:4318/path/123"), Compression: ptr("none"), Timeout: ptr(1000), - Headers: map[string]string{ - "test": "test1", + Headers: []NameStringValuePair{ + {Name: "test", Value: ptr("test1")}, }, }, }, @@ -386,11 +386,11 @@ func TestSpanProcessor(t *testing.T) { ScheduleDelay: ptr(0), Exporter: SpanExporter{ OTLP: &OTLP{ - Protocol: "http/protobuf", + Protocol: ptr("http/protobuf"), Compression: ptr("gzip"), Timeout: ptr(1000), - Headers: map[string]string{ - "test": "test1", + Headers: []NameStringValuePair{ + {Name: "test", Value: ptr("test1")}, }, }, }, @@ -408,12 +408,12 @@ func TestSpanProcessor(t *testing.T) { ScheduleDelay: ptr(0), Exporter: SpanExporter{ OTLP: &OTLP{ - Protocol: "http/protobuf", - Endpoint: "localhost:4318", + Protocol: ptr("http/protobuf"), + Endpoint: ptr("localhost:4318"), Compression: ptr("gzip"), Timeout: ptr(1000), - Headers: map[string]string{ - "test": "test1", + Headers: []NameStringValuePair{ + {Name: "test", Value: ptr("test1")}, }, }, }, @@ -431,12 +431,12 @@ func TestSpanProcessor(t *testing.T) { ScheduleDelay: ptr(0), Exporter: SpanExporter{ OTLP: &OTLP{ - Protocol: "http/protobuf", - Endpoint: " ", + Protocol: ptr("http/protobuf"), + Endpoint: ptr(" "), Compression: ptr("gzip"), Timeout: ptr(1000), - Headers: map[string]string{ - "test": "test1", + Headers: []NameStringValuePair{ + {Name: "test", Value: ptr("test1")}, }, }, }, @@ -454,12 +454,12 @@ func TestSpanProcessor(t *testing.T) { ScheduleDelay: ptr(0), Exporter: SpanExporter{ OTLP: &OTLP{ - Protocol: "http/protobuf", - Endpoint: "localhost:4318", + Protocol: ptr("http/protobuf"), + Endpoint: ptr("localhost:4318"), Compression: ptr("none"), Timeout: ptr(1000), - Headers: map[string]string{ - "test": "test1", + Headers: []NameStringValuePair{ + {Name: "test", Value: ptr("test1")}, }, }, }, @@ -477,12 +477,12 @@ func TestSpanProcessor(t *testing.T) { ScheduleDelay: ptr(0), Exporter: SpanExporter{ OTLP: &OTLP{ - Protocol: "http/protobuf", - Endpoint: "localhost:4318", + Protocol: ptr("http/protobuf"), + Endpoint: ptr("localhost:4318"), Compression: ptr("invalid"), Timeout: ptr(1000), - Headers: map[string]string{ - "test": "test1", + Headers: []NameStringValuePair{ + {Name: "test", Value: ptr("test1")}, }, }, }, diff --git a/detectors/aws/eks/go.mod b/detectors/aws/eks/go.mod index ca562dea0cd..c6f1910526d 100644 --- a/detectors/aws/eks/go.mod +++ b/detectors/aws/eks/go.mod @@ -48,9 +48,9 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/api v0.31.1 // indirect k8s.io/klog/v2 v2.130.1 // indirect - k8s.io/kube-openapi v0.0.0-20240903163716-9e1beecbcb38 // indirect + k8s.io/kube-openapi v0.0.0-20241009091222-67ed5848f094 // indirect k8s.io/utils v0.0.0-20240921022957-49e7df575cb6 // indirect - sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect + sigs.k8s.io/json v0.0.0-20241009153224-e386a8af8d30 // indirect sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect sigs.k8s.io/yaml v1.4.0 // indirect ) diff --git a/detectors/aws/eks/go.sum b/detectors/aws/eks/go.sum index c63d3af5ddb..2b5d26b1748 100644 --- a/detectors/aws/eks/go.sum +++ b/detectors/aws/eks/go.sum @@ -142,12 +142,12 @@ k8s.io/client-go v0.31.1 h1:f0ugtWSbWpxHR7sjVpQwuvw9a3ZKLXX0u0itkFXufb0= k8s.io/client-go v0.31.1/go.mod h1:sKI8871MJN2OyeqRlmA4W4KM9KBdBUpDLu/43eGemCg= k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= -k8s.io/kube-openapi v0.0.0-20240903163716-9e1beecbcb38 h1:1dWzkmJrrprYvjGwh9kEUxmcUV/CtNU8QM7h1FLWQOo= -k8s.io/kube-openapi v0.0.0-20240903163716-9e1beecbcb38/go.mod h1:coRQXBK9NxO98XUv3ZD6AK3xzHCxV6+b7lrquKwaKzA= +k8s.io/kube-openapi v0.0.0-20241009091222-67ed5848f094 h1:MErs8YA0abvOqJ8gIupA1Tz6PKXYUw34XsGlA7uSL1k= +k8s.io/kube-openapi v0.0.0-20241009091222-67ed5848f094/go.mod h1:7ioBJr1A6igWjsR2fxq2EZ0mlMwYLejazSIc2bzMp2U= k8s.io/utils v0.0.0-20240921022957-49e7df575cb6 h1:MDF6h2H/h4tbzmtIKTuctcwZmY0tY9mD9fNT47QO6HI= k8s.io/utils v0.0.0-20240921022957-49e7df575cb6/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= -sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= +sigs.k8s.io/json v0.0.0-20241009153224-e386a8af8d30 h1:ObU1vgTtAle8WwCKgcDkPjLJYwlazQpIjzSA0asMhy4= +sigs.k8s.io/json v0.0.0-20241009153224-e386a8af8d30/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08= sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= diff --git a/examples/otel-collector/go.mod b/examples/otel-collector/go.mod index ab869be6a16..2992e2a993e 100644 --- a/examples/otel-collector/go.mod +++ b/examples/otel-collector/go.mod @@ -24,7 +24,7 @@ require ( golang.org/x/net v0.30.0 // indirect golang.org/x/sys v0.26.0 // indirect golang.org/x/text v0.19.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240930140551-af27646dc61f // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20241007155032-5fefd90f89a9 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 // indirect google.golang.org/protobuf v1.35.1 // indirect ) diff --git a/examples/otel-collector/go.sum b/examples/otel-collector/go.sum index e3cf39a994f..4719945bd80 100644 --- a/examples/otel-collector/go.sum +++ b/examples/otel-collector/go.sum @@ -43,10 +43,10 @@ golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= -google.golang.org/genproto/googleapis/api v0.0.0-20240930140551-af27646dc61f h1:jTm13A2itBi3La6yTGqn8bVSrc3ZZ1r8ENHlIXBfnRA= -google.golang.org/genproto/googleapis/api v0.0.0-20240930140551-af27646dc61f/go.mod h1:CLGoBuH1VHxAUXVPP8FfPwPEVJB6lz3URE5mY2SuayE= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f h1:cUMEy+8oS78BWIH9OWazBkzbr090Od9tWBNtZHkOhf0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/genproto/googleapis/api v0.0.0-20241007155032-5fefd90f89a9 h1:T6rh4haD3GVYsgEfWExoCZA2o2FmbNyKpTuAxbEFPTg= +google.golang.org/genproto/googleapis/api v0.0.0-20241007155032-5fefd90f89a9/go.mod h1:wp2WsuBYj6j8wUdo3ToZsdxxixbvQNAHqVJrTgi5E5M= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 h1:QCqS/PdaHTSWGvupk2F/ehwHtGc0/GYkT+3GAcR1CCc= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= diff --git a/exporters/autoexport/go.mod b/exporters/autoexport/go.mod index 2adb42ac7dd..2d6de73c7b6 100644 --- a/exporters/autoexport/go.mod +++ b/exporters/autoexport/go.mod @@ -47,8 +47,8 @@ require ( golang.org/x/net v0.30.0 // indirect golang.org/x/sys v0.26.0 // indirect golang.org/x/text v0.19.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240930140551-af27646dc61f // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20241007155032-5fefd90f89a9 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 // indirect google.golang.org/grpc v1.67.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/autoexport/go.sum b/exporters/autoexport/go.sum index 90d302bc72a..da2e5947763 100644 --- a/exporters/autoexport/go.sum +++ b/exporters/autoexport/go.sum @@ -87,10 +87,10 @@ golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= -google.golang.org/genproto/googleapis/api v0.0.0-20240930140551-af27646dc61f h1:jTm13A2itBi3La6yTGqn8bVSrc3ZZ1r8ENHlIXBfnRA= -google.golang.org/genproto/googleapis/api v0.0.0-20240930140551-af27646dc61f/go.mod h1:CLGoBuH1VHxAUXVPP8FfPwPEVJB6lz3URE5mY2SuayE= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f h1:cUMEy+8oS78BWIH9OWazBkzbr090Od9tWBNtZHkOhf0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/genproto/googleapis/api v0.0.0-20241007155032-5fefd90f89a9 h1:T6rh4haD3GVYsgEfWExoCZA2o2FmbNyKpTuAxbEFPTg= +google.golang.org/genproto/googleapis/api v0.0.0-20241007155032-5fefd90f89a9/go.mod h1:wp2WsuBYj6j8wUdo3ToZsdxxixbvQNAHqVJrTgi5E5M= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 h1:QCqS/PdaHTSWGvupk2F/ehwHtGc0/GYkT+3GAcR1CCc= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= diff --git a/instrumentation/README.md b/instrumentation/README.md index fbc8e0ac657..77fe61c45c1 100644 --- a/instrumentation/README.md +++ b/instrumentation/README.md @@ -49,7 +49,6 @@ The following instrumentation packages are provided for popular Go packages and | [github.com/labstack/echo](./github.com/labstack/echo/otelecho) | | ✓ | | [go.mongodb.org/mongo-driver](./go.mongodb.org/mongo-driver/mongo/otelmongo) | | ✓ | | [google.golang.org/grpc](./google.golang.org/grpc/otelgrpc) | ✓ | ✓ | -| [gopkg.in/macaron.v1](./gopkg.in/macaron.v1/otelmacaron) | | ✓ | | [host](./host) | ✓ | | | [net/http](./net/http/otelhttp) | ✓ | ✓ | | [net/http/httptrace](./net/http/httptrace/otelhttptrace) | | ✓ | diff --git a/instrumentation/github.com/aws/aws-lambda-go/otellambda/example/go.mod b/instrumentation/github.com/aws/aws-lambda-go/otellambda/example/go.mod index 8d835c0dbfc..bd625ed5e24 100644 --- a/instrumentation/github.com/aws/aws-lambda-go/otellambda/example/go.mod +++ b/instrumentation/github.com/aws/aws-lambda-go/otellambda/example/go.mod @@ -11,8 +11,8 @@ replace ( require ( github.com/aws/aws-lambda-go v1.47.0 - github.com/aws/aws-sdk-go-v2/config v1.27.41 - github.com/aws/aws-sdk-go-v2/service/s3 v1.65.0 + github.com/aws/aws-sdk-go-v2/config v1.27.43 + github.com/aws/aws-sdk-go-v2/service/s3 v1.65.2 go.opentelemetry.io/contrib/detectors/aws/lambda v0.55.0 go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-lambda-go/otellambda v0.55.0 go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws v0.55.0 @@ -23,24 +23,24 @@ require ( ) require ( - github.com/aws/aws-sdk-go-v2 v1.32.0 // indirect + github.com/aws/aws-sdk-go-v2 v1.32.2 // indirect github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.6 // indirect - github.com/aws/aws-sdk-go-v2/credentials v1.17.39 // indirect - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.15 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.19 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.19 // indirect + github.com/aws/aws-sdk-go-v2/credentials v1.17.41 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.17 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.21 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.21 // indirect github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect - github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.19 // indirect - github.com/aws/aws-sdk-go-v2/service/dynamodb v1.36.0 // indirect + github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.21 // indirect + github.com/aws/aws-sdk-go-v2/service/dynamodb v1.36.2 // indirect github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.4.0 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.10.0 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.0 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.0 // indirect - github.com/aws/aws-sdk-go-v2/service/sqs v1.36.0 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.24.0 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.0 // indirect - github.com/aws/aws-sdk-go-v2/service/sts v1.32.0 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.4.2 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.10.2 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.2 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.2 // indirect + github.com/aws/aws-sdk-go-v2/service/sqs v1.36.2 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.24.2 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.2 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.32.2 // indirect github.com/aws/smithy-go v1.22.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/go-logr/logr v1.4.2 // indirect diff --git a/instrumentation/github.com/aws/aws-lambda-go/otellambda/example/go.sum b/instrumentation/github.com/aws/aws-lambda-go/otellambda/example/go.sum index e8e1e306ad5..76369864671 100644 --- a/instrumentation/github.com/aws/aws-lambda-go/otellambda/example/go.sum +++ b/instrumentation/github.com/aws/aws-lambda-go/otellambda/example/go.sum @@ -1,45 +1,45 @@ github.com/aws/aws-lambda-go v1.47.0 h1:0H8s0vumYx/YKs4sE7YM0ktwL2eWse+kfopsRI1sXVI= github.com/aws/aws-lambda-go v1.47.0/go.mod h1:dpMpZgvWx5vuQJfBt0zqBha60q7Dd7RfgJv23DymV8A= -github.com/aws/aws-sdk-go-v2 v1.32.0 h1:GuHp7GvMN74PXD5C97KT5D87UhIy4bQPkflQKbfkndg= -github.com/aws/aws-sdk-go-v2 v1.32.0/go.mod h1:2SK5n0a2karNTv5tbP1SjsX0uhttou00v/HpXKM1ZUo= +github.com/aws/aws-sdk-go-v2 v1.32.2 h1:AkNLZEyYMLnx/Q/mSKkcMqwNFXMAvFto9bNsHqcTduI= +github.com/aws/aws-sdk-go-v2 v1.32.2/go.mod h1:2SK5n0a2karNTv5tbP1SjsX0uhttou00v/HpXKM1ZUo= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.6 h1:pT3hpW0cOHRJx8Y0DfJUEQuqPild8jRGmSFmBgvydr0= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.6/go.mod h1:j/I2++U0xX+cr44QjHay4Cvxj6FUbnxrgmqN3H1jTZA= -github.com/aws/aws-sdk-go-v2/config v1.27.41 h1:esG3WpmEuNJ6F4kVFLumN8nCfA5VBav1KKb3JPx83O4= -github.com/aws/aws-sdk-go-v2/config v1.27.41/go.mod h1:haUg09ebP+ClvPjU3EB/xe0HF9PguO19PD2fdjM2X14= -github.com/aws/aws-sdk-go-v2/credentials v1.17.39 h1:tmVexAhoGqJxNE2oc4/SJqL+Jz1x1iCPt5ts9XcqZCU= -github.com/aws/aws-sdk-go-v2/credentials v1.17.39/go.mod h1:zgOdbDI9epE608PdboJ87CYvPIejAgFevazeJW6iauQ= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.15 h1:kGjlNc2IXXcxPDcfMyCshNCjVgxUhC/vTJv7NvC9wKk= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.15/go.mod h1:rk/HmqPo+dX0Uv0Q1+4w3QKFdICEGSsTYz1hRWvH8UI= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.19 h1:Q/k5wCeJkSWs+62kDfOillkNIJ5NqmE3iOfm48g/W8c= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.19/go.mod h1:Wns1C66VvtA2Bv/cUBuKZKQKdjo7EVMhp90aAa+8oTI= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.19 h1:AYLE0lUfKvN6icFTR/p+NmD1amYKTbqHQ1Nm+jwE6BM= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.19/go.mod h1:1giLakj64GjuH1NBzF/DXqly5DWHtMTaOzRZ53nFX0I= +github.com/aws/aws-sdk-go-v2/config v1.27.43 h1:p33fDDihFC390dhhuv8nOmX419wjOSDQRb+USt20RrU= +github.com/aws/aws-sdk-go-v2/config v1.27.43/go.mod h1:pYhbtvg1siOOg8h5an77rXle9tVG8T+BWLWAo7cOukc= +github.com/aws/aws-sdk-go-v2/credentials v1.17.41 h1:7gXo+Axmp+R4Z+AK8YFQO0ZV3L0gizGINCOWxSLY9W8= +github.com/aws/aws-sdk-go-v2/credentials v1.17.41/go.mod h1:u4Eb8d3394YLubphT4jLEwN1rLNq2wFOlT6OuxFwPzU= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.17 h1:TMH3f/SCAWdNtXXVPPu5D6wrr4G5hI1rAxbcocKfC7Q= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.17/go.mod h1:1ZRXLdTpzdJb9fwTMXiLipENRxkGMTn1sfKexGllQCw= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.21 h1:UAsR3xA31QGf79WzpG/ixT9FZvQlh5HY1NRqSHBNOCk= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.21/go.mod h1:JNr43NFf5L9YaG3eKTm7HQzls9J+A9YYcGI5Quh1r2Y= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.21 h1:6jZVETqmYCadGFvrYEQfC5fAQmlo80CeL5psbno6r0s= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.21/go.mod h1:1SR0GbLlnN3QUmYaflZNiH1ql+1qrSiB2vwcJ+4UM60= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 h1:VaRN3TlFdd6KxX1x3ILT5ynH6HvKgqdiXoTxAF4HQcQ= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1/go.mod h1:FbtygfRFze9usAadmnGJNc8KsP346kEe+y2/oyhGAGc= -github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.19 h1:FKdiFzTxlTRO71p0C7VrLbkkdW8qfMKF5+ej6bTmkT0= -github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.19/go.mod h1:abO3pCj7WLQPTllnSeYImqFfkGrmJV0JovWo/gqT5N0= -github.com/aws/aws-sdk-go-v2/service/dynamodb v1.36.0 h1:PGMSBO1pE60sOFtXn1wAeW78dZPm/TLdQaAH75on0PU= -github.com/aws/aws-sdk-go-v2/service/dynamodb v1.36.0/go.mod h1:H55uOPvyanrZuglrbwznvoeEuPftohECjADdw9q9gQk= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.21 h1:7edmS3VOBDhK00b/MwGtGglCm7hhwNYnjJs/PgFdMQE= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.21/go.mod h1:Q9o5h4HoIWG8XfzxqiuK/CGUbepCJ8uTlaE3bAbxytQ= +github.com/aws/aws-sdk-go-v2/service/dynamodb v1.36.2 h1:kJqyYcGqhWFmXqjRrtFFD4Oc9FXiskhsll2xnlpe8Do= +github.com/aws/aws-sdk-go-v2/service/dynamodb v1.36.2/go.mod h1:+t2Zc5VNOzhaWzpGE+cEYZADsgAAQT5v55AO+fhU+2s= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0 h1:TToQNkvGguu209puTojY/ozlqy2d/SFNcoLIqTFi42g= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0/go.mod h1:0jp+ltwkf+SwG2fm/PKo8t4y8pJSgOCO4D8Lz3k0aHQ= -github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.4.0 h1:FQNWhRuSq8QwW74GtU0MrveNhZbqvHsA4dkA9w8fTDQ= -github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.4.0/go.mod h1:j/zZ3zmWfGCK91K73YsfHP53BSTLSjL/y6YN39XbBLM= -github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.10.0 h1:6a3DyPi2Yl0MnUoYG3hA5oKhEnUubbMoayWoQ/7cQEc= -github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.10.0/go.mod h1:ZBgfcYPfH0uj3671EVyBcReSif2qlTKe9xQkiRqY3lg= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.0 h1:AdbiDUgQZmM28rDIZbiSwFxz8+3B94aOXxzs6oH+EA0= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.0/go.mod h1:uV476Bd80tiDTX4X2redMtagQUg65aU/gzPojSJ4kSI= -github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.0 h1:1NKXS8XfhMM0bg5wVYa/eOH8AM2f6JijugbKEyQFTIg= -github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.0/go.mod h1:ph931DUfVfgrhZR7py9olSvHCiRpvaGxNvlWBcXxFds= -github.com/aws/aws-sdk-go-v2/service/s3 v1.65.0 h1:2dSm7frMrw2tdJ0QvyccQNJyPGaP24dyDgZ6h1QJMGU= -github.com/aws/aws-sdk-go-v2/service/s3 v1.65.0/go.mod h1:4XSVpw66upN8wND3JZA29eXl2NOZvfFVq7DIP6xvfuQ= -github.com/aws/aws-sdk-go-v2/service/sqs v1.36.0 h1:t+b3U3fmUiuXyeBhp9c3BpaEQS7bzp/CoGCuj8DW6r8= -github.com/aws/aws-sdk-go-v2/service/sqs v1.36.0/go.mod h1:ICKQNsIj2Q6IXn5nF+ADptwAM9jX5JFWbnIfRR+6SqE= -github.com/aws/aws-sdk-go-v2/service/sso v1.24.0 h1:71FvP6XFj53NK+YiAEGVzeiccLVeFnHOCvMig0zOHsE= -github.com/aws/aws-sdk-go-v2/service/sso v1.24.0/go.mod h1:UVJqtKXSd9YppRKgdBIkyv7qgbSGv5DchM3yX0BN2mU= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.0 h1:Uco4o19bi3AmBapImNzuMk+rfzlui52BDyVK1UfJeRA= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.0/go.mod h1:+HLFhCpnG08hBee8bUdfd1mBK+rFKPt4O5igR9lXDfk= -github.com/aws/aws-sdk-go-v2/service/sts v1.32.0 h1:GiQUjZM2KUZX68o/LpZ1xqxYMuvoxpRrOwYARYog3vc= -github.com/aws/aws-sdk-go-v2/service/sts v1.32.0/go.mod h1:dKnu7M4MAS2SDlng1ytxd03H+y0LoUfEQ5E2VaaSw/4= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.4.2 h1:4FMHqLfk0efmTqhXVRL5xYRqlEBNBiRI7N6w4jsEdd4= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.4.2/go.mod h1:LWoqeWlK9OZeJxsROW2RqrSPvQHKTpp69r/iDjwsSaw= +github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.10.2 h1:1G7TTQNPNv5fhCyIQGYk8FOggLgkzKq6c4Y1nOGzAOE= +github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.10.2/go.mod h1:+ybYGLXoF7bcD7wIcMcklxyABZQmuBf1cHUhvY6FGIo= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.2 h1:s7NA1SOw8q/5c0wr8477yOPp0z+uBaXBnLE0XYb0POA= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.2/go.mod h1:fnjjWyAW/Pj5HYOxl9LJqWtEwS7W2qgcRLWP+uWbss0= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.2 h1:t7iUP9+4wdc5lt3E41huP+GvQZJD38WLsgVp4iOtAjg= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.2/go.mod h1:/niFCtmuQNxqx9v8WAPq5qh7EH25U4BF6tjoyq9bObM= +github.com/aws/aws-sdk-go-v2/service/s3 v1.65.2 h1:yi8m+jepdp6foK14xXLGkYBenxnlcfJ45ka4Pg7fDSQ= +github.com/aws/aws-sdk-go-v2/service/s3 v1.65.2/go.mod h1:cB6oAuus7YXRZhWCc1wIwPywwZ1XwweNp2TVAEGYeB8= +github.com/aws/aws-sdk-go-v2/service/sqs v1.36.2 h1:kmbcoWgbzfh5a6rvfjOnfHSGEqD13qu1GfTPRZqg0FI= +github.com/aws/aws-sdk-go-v2/service/sqs v1.36.2/go.mod h1:/UPx74a3M0WYeT2yLQYG/qHhkPlPXd6TsppfGgy2COk= +github.com/aws/aws-sdk-go-v2/service/sso v1.24.2 h1:bSYXVyUzoTHoKalBmwaZxs97HU9DWWI3ehHSAMa7xOk= +github.com/aws/aws-sdk-go-v2/service/sso v1.24.2/go.mod h1:skMqY7JElusiOUjMJMOv1jJsP7YUg7DrhgqZZWuzu1U= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.2 h1:AhmO1fHINP9vFYUE0LHzCWg/LfUWUF+zFPEcY9QXb7o= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.2/go.mod h1:o8aQygT2+MVP0NaV6kbdE1YnnIM8RRVQzoeUH45GOdI= +github.com/aws/aws-sdk-go-v2/service/sts v1.32.2 h1:CiS7i0+FUe+/YY1GvIBLLrR/XNGZ4CtM1Ll0XavNuVo= +github.com/aws/aws-sdk-go-v2/service/sts v1.32.2/go.mod h1:HtaiBI8CjYoNVde8arShXb94UbQQi9L4EMr6D+xGBwo= github.com/aws/smithy-go v1.22.0 h1:uunKnWlcoL3zO7q+gG2Pk53joueEOsnNB28QdMsmiMM= github.com/aws/smithy-go v1.22.0/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/instrumentation/github.com/aws/aws-lambda-go/otellambda/xrayconfig/go.mod b/instrumentation/github.com/aws/aws-lambda-go/otellambda/xrayconfig/go.mod index cd3601702df..09e461c1a53 100644 --- a/instrumentation/github.com/aws/aws-lambda-go/otellambda/xrayconfig/go.mod +++ b/instrumentation/github.com/aws/aws-lambda-go/otellambda/xrayconfig/go.mod @@ -35,8 +35,8 @@ require ( golang.org/x/net v0.30.0 // indirect golang.org/x/sys v0.26.0 // indirect golang.org/x/text v0.19.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240930140551-af27646dc61f // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20241007155032-5fefd90f89a9 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 // indirect google.golang.org/protobuf v1.35.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/instrumentation/github.com/aws/aws-lambda-go/otellambda/xrayconfig/go.sum b/instrumentation/github.com/aws/aws-lambda-go/otellambda/xrayconfig/go.sum index 68df7e7dc17..02d5e9566e4 100644 --- a/instrumentation/github.com/aws/aws-lambda-go/otellambda/xrayconfig/go.sum +++ b/instrumentation/github.com/aws/aws-lambda-go/otellambda/xrayconfig/go.sum @@ -47,10 +47,10 @@ golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= -google.golang.org/genproto/googleapis/api v0.0.0-20240930140551-af27646dc61f h1:jTm13A2itBi3La6yTGqn8bVSrc3ZZ1r8ENHlIXBfnRA= -google.golang.org/genproto/googleapis/api v0.0.0-20240930140551-af27646dc61f/go.mod h1:CLGoBuH1VHxAUXVPP8FfPwPEVJB6lz3URE5mY2SuayE= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f h1:cUMEy+8oS78BWIH9OWazBkzbr090Od9tWBNtZHkOhf0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/genproto/googleapis/api v0.0.0-20241007155032-5fefd90f89a9 h1:T6rh4haD3GVYsgEfWExoCZA2o2FmbNyKpTuAxbEFPTg= +google.golang.org/genproto/googleapis/api v0.0.0-20241007155032-5fefd90f89a9/go.mod h1:wp2WsuBYj6j8wUdo3ToZsdxxixbvQNAHqVJrTgi5E5M= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 h1:QCqS/PdaHTSWGvupk2F/ehwHtGc0/GYkT+3GAcR1CCc= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= diff --git a/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/example/go.mod b/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/example/go.mod index f03a91fbced..3962cac8096 100644 --- a/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/example/go.mod +++ b/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/example/go.mod @@ -5,10 +5,10 @@ go 1.22 replace go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws => ../ require ( - github.com/aws/aws-sdk-go-v2 v1.32.0 - github.com/aws/aws-sdk-go-v2/config v1.27.41 - github.com/aws/aws-sdk-go-v2/service/dynamodb v1.36.0 - github.com/aws/aws-sdk-go-v2/service/s3 v1.65.0 + github.com/aws/aws-sdk-go-v2 v1.32.2 + github.com/aws/aws-sdk-go-v2/config v1.27.43 + github.com/aws/aws-sdk-go-v2/service/dynamodb v1.36.2 + github.com/aws/aws-sdk-go-v2/service/s3 v1.65.2 go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws v0.55.0 go.opentelemetry.io/otel v1.30.0 go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.30.0 @@ -18,21 +18,21 @@ require ( require ( github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.6 // indirect - github.com/aws/aws-sdk-go-v2/credentials v1.17.39 // indirect - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.15 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.19 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.19 // indirect + github.com/aws/aws-sdk-go-v2/credentials v1.17.41 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.17 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.21 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.21 // indirect github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect - github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.19 // indirect + github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.21 // indirect github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.4.0 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.10.0 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.0 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.0 // indirect - github.com/aws/aws-sdk-go-v2/service/sqs v1.36.0 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.24.0 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.0 // indirect - github.com/aws/aws-sdk-go-v2/service/sts v1.32.0 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.4.2 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.10.2 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.2 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.2 // indirect + github.com/aws/aws-sdk-go-v2/service/sqs v1.36.2 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.24.2 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.2 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.32.2 // indirect github.com/aws/smithy-go v1.22.0 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect diff --git a/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/example/go.sum b/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/example/go.sum index 2fb8278c21d..1d8e5f23750 100644 --- a/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/example/go.sum +++ b/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/example/go.sum @@ -1,43 +1,43 @@ -github.com/aws/aws-sdk-go-v2 v1.32.0 h1:GuHp7GvMN74PXD5C97KT5D87UhIy4bQPkflQKbfkndg= -github.com/aws/aws-sdk-go-v2 v1.32.0/go.mod h1:2SK5n0a2karNTv5tbP1SjsX0uhttou00v/HpXKM1ZUo= +github.com/aws/aws-sdk-go-v2 v1.32.2 h1:AkNLZEyYMLnx/Q/mSKkcMqwNFXMAvFto9bNsHqcTduI= +github.com/aws/aws-sdk-go-v2 v1.32.2/go.mod h1:2SK5n0a2karNTv5tbP1SjsX0uhttou00v/HpXKM1ZUo= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.6 h1:pT3hpW0cOHRJx8Y0DfJUEQuqPild8jRGmSFmBgvydr0= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.6/go.mod h1:j/I2++U0xX+cr44QjHay4Cvxj6FUbnxrgmqN3H1jTZA= -github.com/aws/aws-sdk-go-v2/config v1.27.41 h1:esG3WpmEuNJ6F4kVFLumN8nCfA5VBav1KKb3JPx83O4= -github.com/aws/aws-sdk-go-v2/config v1.27.41/go.mod h1:haUg09ebP+ClvPjU3EB/xe0HF9PguO19PD2fdjM2X14= -github.com/aws/aws-sdk-go-v2/credentials v1.17.39 h1:tmVexAhoGqJxNE2oc4/SJqL+Jz1x1iCPt5ts9XcqZCU= -github.com/aws/aws-sdk-go-v2/credentials v1.17.39/go.mod h1:zgOdbDI9epE608PdboJ87CYvPIejAgFevazeJW6iauQ= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.15 h1:kGjlNc2IXXcxPDcfMyCshNCjVgxUhC/vTJv7NvC9wKk= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.15/go.mod h1:rk/HmqPo+dX0Uv0Q1+4w3QKFdICEGSsTYz1hRWvH8UI= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.19 h1:Q/k5wCeJkSWs+62kDfOillkNIJ5NqmE3iOfm48g/W8c= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.19/go.mod h1:Wns1C66VvtA2Bv/cUBuKZKQKdjo7EVMhp90aAa+8oTI= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.19 h1:AYLE0lUfKvN6icFTR/p+NmD1amYKTbqHQ1Nm+jwE6BM= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.19/go.mod h1:1giLakj64GjuH1NBzF/DXqly5DWHtMTaOzRZ53nFX0I= +github.com/aws/aws-sdk-go-v2/config v1.27.43 h1:p33fDDihFC390dhhuv8nOmX419wjOSDQRb+USt20RrU= +github.com/aws/aws-sdk-go-v2/config v1.27.43/go.mod h1:pYhbtvg1siOOg8h5an77rXle9tVG8T+BWLWAo7cOukc= +github.com/aws/aws-sdk-go-v2/credentials v1.17.41 h1:7gXo+Axmp+R4Z+AK8YFQO0ZV3L0gizGINCOWxSLY9W8= +github.com/aws/aws-sdk-go-v2/credentials v1.17.41/go.mod h1:u4Eb8d3394YLubphT4jLEwN1rLNq2wFOlT6OuxFwPzU= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.17 h1:TMH3f/SCAWdNtXXVPPu5D6wrr4G5hI1rAxbcocKfC7Q= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.17/go.mod h1:1ZRXLdTpzdJb9fwTMXiLipENRxkGMTn1sfKexGllQCw= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.21 h1:UAsR3xA31QGf79WzpG/ixT9FZvQlh5HY1NRqSHBNOCk= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.21/go.mod h1:JNr43NFf5L9YaG3eKTm7HQzls9J+A9YYcGI5Quh1r2Y= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.21 h1:6jZVETqmYCadGFvrYEQfC5fAQmlo80CeL5psbno6r0s= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.21/go.mod h1:1SR0GbLlnN3QUmYaflZNiH1ql+1qrSiB2vwcJ+4UM60= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 h1:VaRN3TlFdd6KxX1x3ILT5ynH6HvKgqdiXoTxAF4HQcQ= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1/go.mod h1:FbtygfRFze9usAadmnGJNc8KsP346kEe+y2/oyhGAGc= -github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.19 h1:FKdiFzTxlTRO71p0C7VrLbkkdW8qfMKF5+ej6bTmkT0= -github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.19/go.mod h1:abO3pCj7WLQPTllnSeYImqFfkGrmJV0JovWo/gqT5N0= -github.com/aws/aws-sdk-go-v2/service/dynamodb v1.36.0 h1:PGMSBO1pE60sOFtXn1wAeW78dZPm/TLdQaAH75on0PU= -github.com/aws/aws-sdk-go-v2/service/dynamodb v1.36.0/go.mod h1:H55uOPvyanrZuglrbwznvoeEuPftohECjADdw9q9gQk= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.21 h1:7edmS3VOBDhK00b/MwGtGglCm7hhwNYnjJs/PgFdMQE= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.21/go.mod h1:Q9o5h4HoIWG8XfzxqiuK/CGUbepCJ8uTlaE3bAbxytQ= +github.com/aws/aws-sdk-go-v2/service/dynamodb v1.36.2 h1:kJqyYcGqhWFmXqjRrtFFD4Oc9FXiskhsll2xnlpe8Do= +github.com/aws/aws-sdk-go-v2/service/dynamodb v1.36.2/go.mod h1:+t2Zc5VNOzhaWzpGE+cEYZADsgAAQT5v55AO+fhU+2s= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0 h1:TToQNkvGguu209puTojY/ozlqy2d/SFNcoLIqTFi42g= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0/go.mod h1:0jp+ltwkf+SwG2fm/PKo8t4y8pJSgOCO4D8Lz3k0aHQ= -github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.4.0 h1:FQNWhRuSq8QwW74GtU0MrveNhZbqvHsA4dkA9w8fTDQ= -github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.4.0/go.mod h1:j/zZ3zmWfGCK91K73YsfHP53BSTLSjL/y6YN39XbBLM= -github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.10.0 h1:6a3DyPi2Yl0MnUoYG3hA5oKhEnUubbMoayWoQ/7cQEc= -github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.10.0/go.mod h1:ZBgfcYPfH0uj3671EVyBcReSif2qlTKe9xQkiRqY3lg= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.0 h1:AdbiDUgQZmM28rDIZbiSwFxz8+3B94aOXxzs6oH+EA0= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.0/go.mod h1:uV476Bd80tiDTX4X2redMtagQUg65aU/gzPojSJ4kSI= -github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.0 h1:1NKXS8XfhMM0bg5wVYa/eOH8AM2f6JijugbKEyQFTIg= -github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.0/go.mod h1:ph931DUfVfgrhZR7py9olSvHCiRpvaGxNvlWBcXxFds= -github.com/aws/aws-sdk-go-v2/service/s3 v1.65.0 h1:2dSm7frMrw2tdJ0QvyccQNJyPGaP24dyDgZ6h1QJMGU= -github.com/aws/aws-sdk-go-v2/service/s3 v1.65.0/go.mod h1:4XSVpw66upN8wND3JZA29eXl2NOZvfFVq7DIP6xvfuQ= -github.com/aws/aws-sdk-go-v2/service/sqs v1.36.0 h1:t+b3U3fmUiuXyeBhp9c3BpaEQS7bzp/CoGCuj8DW6r8= -github.com/aws/aws-sdk-go-v2/service/sqs v1.36.0/go.mod h1:ICKQNsIj2Q6IXn5nF+ADptwAM9jX5JFWbnIfRR+6SqE= -github.com/aws/aws-sdk-go-v2/service/sso v1.24.0 h1:71FvP6XFj53NK+YiAEGVzeiccLVeFnHOCvMig0zOHsE= -github.com/aws/aws-sdk-go-v2/service/sso v1.24.0/go.mod h1:UVJqtKXSd9YppRKgdBIkyv7qgbSGv5DchM3yX0BN2mU= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.0 h1:Uco4o19bi3AmBapImNzuMk+rfzlui52BDyVK1UfJeRA= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.0/go.mod h1:+HLFhCpnG08hBee8bUdfd1mBK+rFKPt4O5igR9lXDfk= -github.com/aws/aws-sdk-go-v2/service/sts v1.32.0 h1:GiQUjZM2KUZX68o/LpZ1xqxYMuvoxpRrOwYARYog3vc= -github.com/aws/aws-sdk-go-v2/service/sts v1.32.0/go.mod h1:dKnu7M4MAS2SDlng1ytxd03H+y0LoUfEQ5E2VaaSw/4= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.4.2 h1:4FMHqLfk0efmTqhXVRL5xYRqlEBNBiRI7N6w4jsEdd4= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.4.2/go.mod h1:LWoqeWlK9OZeJxsROW2RqrSPvQHKTpp69r/iDjwsSaw= +github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.10.2 h1:1G7TTQNPNv5fhCyIQGYk8FOggLgkzKq6c4Y1nOGzAOE= +github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.10.2/go.mod h1:+ybYGLXoF7bcD7wIcMcklxyABZQmuBf1cHUhvY6FGIo= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.2 h1:s7NA1SOw8q/5c0wr8477yOPp0z+uBaXBnLE0XYb0POA= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.2/go.mod h1:fnjjWyAW/Pj5HYOxl9LJqWtEwS7W2qgcRLWP+uWbss0= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.2 h1:t7iUP9+4wdc5lt3E41huP+GvQZJD38WLsgVp4iOtAjg= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.2/go.mod h1:/niFCtmuQNxqx9v8WAPq5qh7EH25U4BF6tjoyq9bObM= +github.com/aws/aws-sdk-go-v2/service/s3 v1.65.2 h1:yi8m+jepdp6foK14xXLGkYBenxnlcfJ45ka4Pg7fDSQ= +github.com/aws/aws-sdk-go-v2/service/s3 v1.65.2/go.mod h1:cB6oAuus7YXRZhWCc1wIwPywwZ1XwweNp2TVAEGYeB8= +github.com/aws/aws-sdk-go-v2/service/sqs v1.36.2 h1:kmbcoWgbzfh5a6rvfjOnfHSGEqD13qu1GfTPRZqg0FI= +github.com/aws/aws-sdk-go-v2/service/sqs v1.36.2/go.mod h1:/UPx74a3M0WYeT2yLQYG/qHhkPlPXd6TsppfGgy2COk= +github.com/aws/aws-sdk-go-v2/service/sso v1.24.2 h1:bSYXVyUzoTHoKalBmwaZxs97HU9DWWI3ehHSAMa7xOk= +github.com/aws/aws-sdk-go-v2/service/sso v1.24.2/go.mod h1:skMqY7JElusiOUjMJMOv1jJsP7YUg7DrhgqZZWuzu1U= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.2 h1:AhmO1fHINP9vFYUE0LHzCWg/LfUWUF+zFPEcY9QXb7o= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.2/go.mod h1:o8aQygT2+MVP0NaV6kbdE1YnnIM8RRVQzoeUH45GOdI= +github.com/aws/aws-sdk-go-v2/service/sts v1.32.2 h1:CiS7i0+FUe+/YY1GvIBLLrR/XNGZ4CtM1Ll0XavNuVo= +github.com/aws/aws-sdk-go-v2/service/sts v1.32.2/go.mod h1:HtaiBI8CjYoNVde8arShXb94UbQQi9L4EMr6D+xGBwo= github.com/aws/smithy-go v1.22.0 h1:uunKnWlcoL3zO7q+gG2Pk53joueEOsnNB28QdMsmiMM= github.com/aws/smithy-go v1.22.0/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/go.mod b/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/go.mod index 6a3b39231ec..4af6c4e55bf 100644 --- a/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/go.mod +++ b/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/go.mod @@ -3,9 +3,9 @@ module go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/ go 1.22 require ( - github.com/aws/aws-sdk-go-v2 v1.32.0 - github.com/aws/aws-sdk-go-v2/service/dynamodb v1.36.0 - github.com/aws/aws-sdk-go-v2/service/sqs v1.36.0 + github.com/aws/aws-sdk-go-v2 v1.32.2 + github.com/aws/aws-sdk-go-v2/service/dynamodb v1.36.2 + github.com/aws/aws-sdk-go-v2/service/sqs v1.36.2 github.com/aws/smithy-go v1.22.0 github.com/stretchr/testify v1.9.0 go.opentelemetry.io/otel v1.30.0 @@ -13,10 +13,10 @@ require ( ) require ( - github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.19 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.19 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.21 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.21 // indirect github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.10.0 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.10.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect diff --git a/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/go.sum b/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/go.sum index 35fca8f17ce..73c2fcd3a9b 100644 --- a/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/go.sum +++ b/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/go.sum @@ -1,17 +1,17 @@ -github.com/aws/aws-sdk-go-v2 v1.32.0 h1:GuHp7GvMN74PXD5C97KT5D87UhIy4bQPkflQKbfkndg= -github.com/aws/aws-sdk-go-v2 v1.32.0/go.mod h1:2SK5n0a2karNTv5tbP1SjsX0uhttou00v/HpXKM1ZUo= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.19 h1:Q/k5wCeJkSWs+62kDfOillkNIJ5NqmE3iOfm48g/W8c= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.19/go.mod h1:Wns1C66VvtA2Bv/cUBuKZKQKdjo7EVMhp90aAa+8oTI= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.19 h1:AYLE0lUfKvN6icFTR/p+NmD1amYKTbqHQ1Nm+jwE6BM= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.19/go.mod h1:1giLakj64GjuH1NBzF/DXqly5DWHtMTaOzRZ53nFX0I= -github.com/aws/aws-sdk-go-v2/service/dynamodb v1.36.0 h1:PGMSBO1pE60sOFtXn1wAeW78dZPm/TLdQaAH75on0PU= -github.com/aws/aws-sdk-go-v2/service/dynamodb v1.36.0/go.mod h1:H55uOPvyanrZuglrbwznvoeEuPftohECjADdw9q9gQk= +github.com/aws/aws-sdk-go-v2 v1.32.2 h1:AkNLZEyYMLnx/Q/mSKkcMqwNFXMAvFto9bNsHqcTduI= +github.com/aws/aws-sdk-go-v2 v1.32.2/go.mod h1:2SK5n0a2karNTv5tbP1SjsX0uhttou00v/HpXKM1ZUo= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.21 h1:UAsR3xA31QGf79WzpG/ixT9FZvQlh5HY1NRqSHBNOCk= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.21/go.mod h1:JNr43NFf5L9YaG3eKTm7HQzls9J+A9YYcGI5Quh1r2Y= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.21 h1:6jZVETqmYCadGFvrYEQfC5fAQmlo80CeL5psbno6r0s= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.21/go.mod h1:1SR0GbLlnN3QUmYaflZNiH1ql+1qrSiB2vwcJ+4UM60= +github.com/aws/aws-sdk-go-v2/service/dynamodb v1.36.2 h1:kJqyYcGqhWFmXqjRrtFFD4Oc9FXiskhsll2xnlpe8Do= +github.com/aws/aws-sdk-go-v2/service/dynamodb v1.36.2/go.mod h1:+t2Zc5VNOzhaWzpGE+cEYZADsgAAQT5v55AO+fhU+2s= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0 h1:TToQNkvGguu209puTojY/ozlqy2d/SFNcoLIqTFi42g= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0/go.mod h1:0jp+ltwkf+SwG2fm/PKo8t4y8pJSgOCO4D8Lz3k0aHQ= -github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.10.0 h1:6a3DyPi2Yl0MnUoYG3hA5oKhEnUubbMoayWoQ/7cQEc= -github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.10.0/go.mod h1:ZBgfcYPfH0uj3671EVyBcReSif2qlTKe9xQkiRqY3lg= -github.com/aws/aws-sdk-go-v2/service/sqs v1.36.0 h1:t+b3U3fmUiuXyeBhp9c3BpaEQS7bzp/CoGCuj8DW6r8= -github.com/aws/aws-sdk-go-v2/service/sqs v1.36.0/go.mod h1:ICKQNsIj2Q6IXn5nF+ADptwAM9jX5JFWbnIfRR+6SqE= +github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.10.2 h1:1G7TTQNPNv5fhCyIQGYk8FOggLgkzKq6c4Y1nOGzAOE= +github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.10.2/go.mod h1:+ybYGLXoF7bcD7wIcMcklxyABZQmuBf1cHUhvY6FGIo= +github.com/aws/aws-sdk-go-v2/service/sqs v1.36.2 h1:kmbcoWgbzfh5a6rvfjOnfHSGEqD13qu1GfTPRZqg0FI= +github.com/aws/aws-sdk-go-v2/service/sqs v1.36.2/go.mod h1:/UPx74a3M0WYeT2yLQYG/qHhkPlPXd6TsppfGgy2COk= github.com/aws/smithy-go v1.22.0 h1:uunKnWlcoL3zO7q+gG2Pk53joueEOsnNB28QdMsmiMM= github.com/aws/smithy-go v1.22.0/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/test/go.mod b/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/test/go.mod index fce78d8004e..37d1464fe29 100644 --- a/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/test/go.mod +++ b/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/test/go.mod @@ -3,9 +3,9 @@ module go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/ go 1.22 require ( - github.com/aws/aws-sdk-go-v2 v1.32.0 - github.com/aws/aws-sdk-go-v2/service/dynamodb v1.36.0 - github.com/aws/aws-sdk-go-v2/service/route53 v1.45.0 + github.com/aws/aws-sdk-go-v2 v1.32.2 + github.com/aws/aws-sdk-go-v2/service/dynamodb v1.36.2 + github.com/aws/aws-sdk-go-v2/service/route53 v1.45.2 github.com/aws/smithy-go v1.22.0 github.com/stretchr/testify v1.9.0 go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws v0.55.0 @@ -15,11 +15,11 @@ require ( ) require ( - github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.19 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.19 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.21 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.21 // indirect github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.10.0 // indirect - github.com/aws/aws-sdk-go-v2/service/sqs v1.36.0 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.10.2 // indirect + github.com/aws/aws-sdk-go-v2/service/sqs v1.36.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect diff --git a/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/test/go.sum b/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/test/go.sum index 8ddfbc7e4d5..6f36b75bdbb 100644 --- a/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/test/go.sum +++ b/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/test/go.sum @@ -1,19 +1,19 @@ -github.com/aws/aws-sdk-go-v2 v1.32.0 h1:GuHp7GvMN74PXD5C97KT5D87UhIy4bQPkflQKbfkndg= -github.com/aws/aws-sdk-go-v2 v1.32.0/go.mod h1:2SK5n0a2karNTv5tbP1SjsX0uhttou00v/HpXKM1ZUo= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.19 h1:Q/k5wCeJkSWs+62kDfOillkNIJ5NqmE3iOfm48g/W8c= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.19/go.mod h1:Wns1C66VvtA2Bv/cUBuKZKQKdjo7EVMhp90aAa+8oTI= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.19 h1:AYLE0lUfKvN6icFTR/p+NmD1amYKTbqHQ1Nm+jwE6BM= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.19/go.mod h1:1giLakj64GjuH1NBzF/DXqly5DWHtMTaOzRZ53nFX0I= -github.com/aws/aws-sdk-go-v2/service/dynamodb v1.36.0 h1:PGMSBO1pE60sOFtXn1wAeW78dZPm/TLdQaAH75on0PU= -github.com/aws/aws-sdk-go-v2/service/dynamodb v1.36.0/go.mod h1:H55uOPvyanrZuglrbwznvoeEuPftohECjADdw9q9gQk= +github.com/aws/aws-sdk-go-v2 v1.32.2 h1:AkNLZEyYMLnx/Q/mSKkcMqwNFXMAvFto9bNsHqcTduI= +github.com/aws/aws-sdk-go-v2 v1.32.2/go.mod h1:2SK5n0a2karNTv5tbP1SjsX0uhttou00v/HpXKM1ZUo= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.21 h1:UAsR3xA31QGf79WzpG/ixT9FZvQlh5HY1NRqSHBNOCk= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.21/go.mod h1:JNr43NFf5L9YaG3eKTm7HQzls9J+A9YYcGI5Quh1r2Y= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.21 h1:6jZVETqmYCadGFvrYEQfC5fAQmlo80CeL5psbno6r0s= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.21/go.mod h1:1SR0GbLlnN3QUmYaflZNiH1ql+1qrSiB2vwcJ+4UM60= +github.com/aws/aws-sdk-go-v2/service/dynamodb v1.36.2 h1:kJqyYcGqhWFmXqjRrtFFD4Oc9FXiskhsll2xnlpe8Do= +github.com/aws/aws-sdk-go-v2/service/dynamodb v1.36.2/go.mod h1:+t2Zc5VNOzhaWzpGE+cEYZADsgAAQT5v55AO+fhU+2s= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0 h1:TToQNkvGguu209puTojY/ozlqy2d/SFNcoLIqTFi42g= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0/go.mod h1:0jp+ltwkf+SwG2fm/PKo8t4y8pJSgOCO4D8Lz3k0aHQ= -github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.10.0 h1:6a3DyPi2Yl0MnUoYG3hA5oKhEnUubbMoayWoQ/7cQEc= -github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.10.0/go.mod h1:ZBgfcYPfH0uj3671EVyBcReSif2qlTKe9xQkiRqY3lg= -github.com/aws/aws-sdk-go-v2/service/route53 v1.45.0 h1:rwDRzOudNWFLRmpHIC6zZjGKovvgdfobPgXn/aXTdcs= -github.com/aws/aws-sdk-go-v2/service/route53 v1.45.0/go.mod h1:NAmFsZ4aGISCGa2nX+EGxPQGukb/z+XwriLW0i+EHKs= -github.com/aws/aws-sdk-go-v2/service/sqs v1.36.0 h1:t+b3U3fmUiuXyeBhp9c3BpaEQS7bzp/CoGCuj8DW6r8= -github.com/aws/aws-sdk-go-v2/service/sqs v1.36.0/go.mod h1:ICKQNsIj2Q6IXn5nF+ADptwAM9jX5JFWbnIfRR+6SqE= +github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.10.2 h1:1G7TTQNPNv5fhCyIQGYk8FOggLgkzKq6c4Y1nOGzAOE= +github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.10.2/go.mod h1:+ybYGLXoF7bcD7wIcMcklxyABZQmuBf1cHUhvY6FGIo= +github.com/aws/aws-sdk-go-v2/service/route53 v1.45.2 h1:P4ElvGTPph12a87YpxPDIqCvVICeYJFV32UMMS/TIPc= +github.com/aws/aws-sdk-go-v2/service/route53 v1.45.2/go.mod h1:zLKE53MjadFH0VYrDerAx25brxLYiSg4Vk3C+qPY4BQ= +github.com/aws/aws-sdk-go-v2/service/sqs v1.36.2 h1:kmbcoWgbzfh5a6rvfjOnfHSGEqD13qu1GfTPRZqg0FI= +github.com/aws/aws-sdk-go-v2/service/sqs v1.36.2/go.mod h1:/UPx74a3M0WYeT2yLQYG/qHhkPlPXd6TsppfGgy2COk= github.com/aws/smithy-go v1.22.0 h1:uunKnWlcoL3zO7q+gG2Pk53joueEOsnNB28QdMsmiMM= github.com/aws/smithy-go v1.22.0/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/instrumentation/github.com/labstack/echo/otelecho/doc.go b/instrumentation/github.com/labstack/echo/otelecho/doc.go index af3b07fb819..01fe0cb8587 100644 --- a/instrumentation/github.com/labstack/echo/otelecho/doc.go +++ b/instrumentation/github.com/labstack/echo/otelecho/doc.go @@ -6,11 +6,4 @@ // // Currently only the routing of a received message can be instrumented. To do // so, use the Middleware function. -// -// Deprecated: otelecho has no Code Owner. -// After August 21, 2024, it may no longer be supported and may stop -// receiving new releases unless a new Code Owner is found. See -// [this issue] if you would like to become the Code Owner of this module. -// -// [this issue]: https://github.com/open-telemetry/opentelemetry-go-contrib/issues/5550 package otelecho // import "go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/otelecho" diff --git a/instrumentation/github.com/labstack/echo/otelecho/example/README.md b/instrumentation/github.com/labstack/echo/otelecho/example/README.md index ec0e849e7d7..41b24e04931 100644 --- a/instrumentation/github.com/labstack/echo/otelecho/example/README.md +++ b/instrumentation/github.com/labstack/echo/otelecho/example/README.md @@ -1,7 +1,5 @@ # labstack echo instrumentation example -:warning: Deprecated: otelecho has no Code Owner. - An HTTP server using labstack echo and instrumentation. The server has a `/users/:id` endpoint. The server generates span information to `stdout`. diff --git a/instrumentation/github.com/labstack/echo/otelecho/example/go.mod b/instrumentation/github.com/labstack/echo/otelecho/example/go.mod index eb61d6cff5f..c1ee49cf4d6 100644 --- a/instrumentation/github.com/labstack/echo/otelecho/example/go.mod +++ b/instrumentation/github.com/labstack/echo/otelecho/example/go.mod @@ -1,4 +1,3 @@ -// Deprecated: otelecho has no Code Owner. module go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/otelecho/example go 1.22 diff --git a/instrumentation/github.com/labstack/echo/otelecho/example/server.go b/instrumentation/github.com/labstack/echo/otelecho/example/server.go index adfcd2da3c2..d6d5ce76c4c 100644 --- a/instrumentation/github.com/labstack/echo/otelecho/example/server.go +++ b/instrumentation/github.com/labstack/echo/otelecho/example/server.go @@ -10,7 +10,7 @@ import ( "github.com/labstack/echo/v4" - "go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/otelecho" // nolint:staticcheck // deprecated. + "go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/otelecho" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" stdout "go.opentelemetry.io/otel/exporters/stdout/stdouttrace" diff --git a/instrumentation/github.com/labstack/echo/otelecho/go.mod b/instrumentation/github.com/labstack/echo/otelecho/go.mod index da0bce1a120..dcc506fc7a5 100644 --- a/instrumentation/github.com/labstack/echo/otelecho/go.mod +++ b/instrumentation/github.com/labstack/echo/otelecho/go.mod @@ -1,4 +1,3 @@ -// Deprecated: otelecho has no Code Owner. module go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/otelecho go 1.22 diff --git a/instrumentation/github.com/labstack/echo/otelecho/test/doc.go b/instrumentation/github.com/labstack/echo/otelecho/test/doc.go index 1aeb939afdc..19d08241eb5 100644 --- a/instrumentation/github.com/labstack/echo/otelecho/test/doc.go +++ b/instrumentation/github.com/labstack/echo/otelecho/test/doc.go @@ -1,18 +1,9 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -/* -Package test validates the otelecho instrumentation with the default SDK. - -This package is in a separate module from the instrumentation it tests to -isolate the dependency of the default SDK and not impose this as a transitive -dependency for users. - -Deprecated: otelecho has no Code Owner. -After August 21, 2024, it may no longer be supported and may stop -receiving new releases unless a new Code Owner is found. See -[this issue] if you would like to become the Code Owner of this module. - -[this issue]: https://github.com/open-telemetry/opentelemetry-go-contrib/issues/5550 -*/ +// Package test validates the otelecho instrumentation with the default SDK. +// +// This package is in a separate module from the instrumentation it tests to +// isolate the dependency of the default SDK and not impose this as a transitive +// dependency for users. package test // import "go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/otelecho/test" diff --git a/instrumentation/github.com/labstack/echo/otelecho/test/echo_test.go b/instrumentation/github.com/labstack/echo/otelecho/test/echo_test.go index 2ca3e21cce5..905bb63dbd7 100644 --- a/instrumentation/github.com/labstack/echo/otelecho/test/echo_test.go +++ b/instrumentation/github.com/labstack/echo/otelecho/test/echo_test.go @@ -16,7 +16,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/otelecho" // nolint:staticcheck // deprecated. + "go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/otelecho" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/sdk/trace" diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/example/go.mod b/instrumentation/google.golang.org/grpc/otelgrpc/example/go.mod index ec08db13475..17f6ea1abd3 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/example/go.mod +++ b/instrumentation/google.golang.org/grpc/otelgrpc/example/go.mod @@ -22,6 +22,6 @@ require ( go.opentelemetry.io/otel/metric v1.30.0 // indirect golang.org/x/sys v0.26.0 // indirect golang.org/x/text v0.19.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 // indirect google.golang.org/protobuf v1.35.1 // indirect ) diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/example/go.sum b/instrumentation/google.golang.org/grpc/otelgrpc/example/go.sum index 20b31366701..8f5ef2c29e9 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/example/go.sum +++ b/instrumentation/google.golang.org/grpc/otelgrpc/example/go.sum @@ -31,8 +31,8 @@ golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f h1:cUMEy+8oS78BWIH9OWazBkzbr090Od9tWBNtZHkOhf0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 h1:QCqS/PdaHTSWGvupk2F/ehwHtGc0/GYkT+3GAcR1CCc= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/go.mod b/instrumentation/google.golang.org/grpc/otelgrpc/go.mod index c8e67090eb7..1de770ac195 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/go.mod +++ b/instrumentation/google.golang.org/grpc/otelgrpc/go.mod @@ -19,6 +19,6 @@ require ( golang.org/x/net v0.30.0 // indirect golang.org/x/sys v0.26.0 // indirect golang.org/x/text v0.19.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/go.sum b/instrumentation/google.golang.org/grpc/otelgrpc/go.sum index 4fe14248834..fc1545afa9e 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/go.sum +++ b/instrumentation/google.golang.org/grpc/otelgrpc/go.sum @@ -23,8 +23,8 @@ golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f h1:cUMEy+8oS78BWIH9OWazBkzbr090Od9tWBNtZHkOhf0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 h1:QCqS/PdaHTSWGvupk2F/ehwHtGc0/GYkT+3GAcR1CCc= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/test/go.mod b/instrumentation/google.golang.org/grpc/otelgrpc/test/go.mod index d1b8f1ca57a..4a3412aa23a 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/test/go.mod +++ b/instrumentation/google.golang.org/grpc/otelgrpc/test/go.mod @@ -24,7 +24,7 @@ require ( golang.org/x/net v0.30.0 // indirect golang.org/x/sys v0.26.0 // indirect golang.org/x/text v0.19.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 // indirect google.golang.org/protobuf v1.35.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/test/go.sum b/instrumentation/google.golang.org/grpc/otelgrpc/test/go.sum index 98f0df9151e..69866e99272 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/test/go.sum +++ b/instrumentation/google.golang.org/grpc/otelgrpc/test/go.sum @@ -36,8 +36,8 @@ golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f h1:cUMEy+8oS78BWIH9OWazBkzbr090Od9tWBNtZHkOhf0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 h1:QCqS/PdaHTSWGvupk2F/ehwHtGc0/GYkT+3GAcR1CCc= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= diff --git a/instrumentation/gopkg.in/macaron.v1/otelmacaron/config.go b/instrumentation/gopkg.in/macaron.v1/otelmacaron/config.go deleted file mode 100644 index 8b14022267f..00000000000 --- a/instrumentation/gopkg.in/macaron.v1/otelmacaron/config.go +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package otelmacaron // import "go.opentelemetry.io/contrib/instrumentation/gopkg.in/macaron.v1/otelmacaron" - -import ( - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/propagation" - "go.opentelemetry.io/otel/trace" -) - -// config is a group of options for this instrumentation. -type config struct { - TracerProvider trace.TracerProvider - Propagators propagation.TextMapPropagator -} - -// Option applies an option value for a config. -type Option interface { - apply(*config) -} - -// newConfig returns a config configured with all the passed Options. -func newConfig(opts []Option) *config { - c := &config{ - Propagators: otel.GetTextMapPropagator(), - TracerProvider: otel.GetTracerProvider(), - } - for _, o := range opts { - o.apply(c) - } - return c -} - -type propagatorsOption struct{ p propagation.TextMapPropagator } - -func (o propagatorsOption) apply(c *config) { - if o.p != nil { - c.Propagators = o.p - } -} - -// WithPropagators returns an Option to use the Propagators when extracting -// and injecting trace context from HTTP requests. -func WithPropagators(p propagation.TextMapPropagator) Option { - return propagatorsOption{p: p} -} - -type tracerProviderOption struct{ tp trace.TracerProvider } - -func (o tracerProviderOption) apply(c *config) { - if o.tp != nil { - c.TracerProvider = o.tp - } -} - -// WithTracerProvider returns an Option to use the TracerProvider when -// creating a Tracer. -func WithTracerProvider(tp trace.TracerProvider) Option { - return tracerProviderOption{tp: tp} -} diff --git a/instrumentation/gopkg.in/macaron.v1/otelmacaron/doc.go b/instrumentation/gopkg.in/macaron.v1/otelmacaron/doc.go deleted file mode 100644 index d700bec1131..00000000000 --- a/instrumentation/gopkg.in/macaron.v1/otelmacaron/doc.go +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -// Package otelmacaron instruments gopkg.in/macaron.v1. -// -// Currently only the routing of a received message can be instrumented. To do -// it, use the Middleware function. -// -// Deprecated: otelmacaron has no Code Owner. -// After August 21, 2024, it may no longer be supported and may stop -// receiving new releases unless a new Code Owner is found. See -// [this issue] if you would like to become the Code Owner of this module. -// -// [this issue]: https://github.com/open-telemetry/opentelemetry-go-contrib/issues/5552 -package otelmacaron // import "go.opentelemetry.io/contrib/instrumentation/gopkg.in/macaron.v1/otelmacaron" diff --git a/instrumentation/gopkg.in/macaron.v1/otelmacaron/example/Dockerfile b/instrumentation/gopkg.in/macaron.v1/otelmacaron/example/Dockerfile deleted file mode 100644 index 33545cf96a4..00000000000 --- a/instrumentation/gopkg.in/macaron.v1/otelmacaron/example/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright The OpenTelemetry Authors -# SPDX-License-Identifier: Apache-2.0 -FROM golang:alpine AS base -COPY . /src/ -WORKDIR /src/instrumentation/gopkg.in/macaron.v1/otelmacaron/example - -FROM base AS macaron-server -RUN go install ./server.go -CMD ["/go/bin/server"] diff --git a/instrumentation/gopkg.in/macaron.v1/otelmacaron/example/README.md b/instrumentation/gopkg.in/macaron.v1/otelmacaron/example/README.md deleted file mode 100644 index a0f5349aa9a..00000000000 --- a/instrumentation/gopkg.in/macaron.v1/otelmacaron/example/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# gopkg.in/macaron.v1/otelmacaron instrumentation example - -:warning: Deprecated: otelmacaron has no Code Owner. diff --git a/instrumentation/gopkg.in/macaron.v1/otelmacaron/example/docker-compose.yml b/instrumentation/gopkg.in/macaron.v1/otelmacaron/example/docker-compose.yml deleted file mode 100644 index c0ff7f51534..00000000000 --- a/instrumentation/gopkg.in/macaron.v1/otelmacaron/example/docker-compose.yml +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright The OpenTelemetry Authors -# SPDX-License-Identifier: Apache-2.0 -version: "3.7" -services: - macaron-client: - image: golang:alpine - networks: - - example - command: - - "/bin/sh" - - "-c" - - "wget http://macaron-server:8080/users/123 && cat 123" - depends_on: - - macaron-server - macaron-server: - build: - dockerfile: $PWD/Dockerfile - context: ../../../../.. - ports: - - "8080:80" - command: - - "/bin/sh" - - "-c" - - "/go/bin/server" - networks: - - example - environment: - - PORT=80 -networks: - example: diff --git a/instrumentation/gopkg.in/macaron.v1/otelmacaron/example/go.mod b/instrumentation/gopkg.in/macaron.v1/otelmacaron/example/go.mod deleted file mode 100644 index 295c058c67d..00000000000 --- a/instrumentation/gopkg.in/macaron.v1/otelmacaron/example/go.mod +++ /dev/null @@ -1,30 +0,0 @@ -// Deprecated: otelmacaron has no Code Owner. -module go.opentelemetry.io/contrib/instrumentation/gopkg.in/macaron.v1/otelmacaron/example - -go 1.22 - -replace ( - go.opentelemetry.io/contrib/instrumentation/gopkg.in/macaron.v1/otelmacaron => ../ - go.opentelemetry.io/contrib/propagators/b3 => ../../../../../propagators/b3 -) - -require ( - go.opentelemetry.io/contrib/instrumentation/gopkg.in/macaron.v1/otelmacaron v0.55.0 - go.opentelemetry.io/otel v1.30.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.30.0 - go.opentelemetry.io/otel/sdk v1.30.0 - go.opentelemetry.io/otel/trace v1.30.0 - gopkg.in/macaron.v1 v1.5.0 -) - -require ( - github.com/go-logr/logr v1.4.2 // indirect - github.com/go-logr/stdr v1.2.2 // indirect - github.com/go-macaron/inject v0.0.0-20200308113650-138e5925c53b // indirect - github.com/google/uuid v1.6.0 // indirect - github.com/unknwon/com v1.0.1 // indirect - go.opentelemetry.io/otel/metric v1.30.0 // indirect - golang.org/x/crypto v0.28.0 // indirect - golang.org/x/sys v0.26.0 // indirect - gopkg.in/ini.v1 v1.67.0 // indirect -) diff --git a/instrumentation/gopkg.in/macaron.v1/otelmacaron/example/go.sum b/instrumentation/gopkg.in/macaron.v1/otelmacaron/example/go.sum deleted file mode 100644 index 5b915042963..00000000000 --- a/instrumentation/gopkg.in/macaron.v1/otelmacaron/example/go.sum +++ /dev/null @@ -1,51 +0,0 @@ -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= -github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-macaron/inject v0.0.0-20200308113650-138e5925c53b h1:/aWj44HoEycE4MDi2HZf4t+XI7hKwZRltZf4ih5tB2c= -github.com/go-macaron/inject v0.0.0-20200308113650-138e5925c53b/go.mod h1:VFI2o2q9kYsC4o7VP1HrEVosiZZTd+MVT3YZx4gqvJw= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gopherjs/gopherjs v0.0.0-20190430165422-3e4dfb77656c h1:7lF+Vz0LqiRidnzC1Oq86fpX1q/iEv2KJdrCtttYjT4= -github.com/gopherjs/gopherjs v0.0.0-20190430165422-3e4dfb77656c/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= -github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= -github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/smartystreets/assertions v0.0.0-20190116191733-b6c0e53d7304/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/assertions v1.0.1 h1:voD4ITNjPL5jjBfgR/r8fPIIBrliWrWHeiJApdr3r4w= -github.com/smartystreets/assertions v1.0.1/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM= -github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s= -github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337 h1:WN9BUFbdyOsSH/XohnWpXOlq9NBD5sGAB2FciQMUEe8= -github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/unknwon/com v1.0.1 h1:3d1LTxD+Lnf3soQiD4Cp/0BRB+Rsa/+RTvz8GMMzIXs= -github.com/unknwon/com v1.0.1/go.mod h1:tOOxU81rwgoCLoOVVPHb6T/wt8HZygqH5id+GNnlCXM= -go.opentelemetry.io/otel v1.30.0 h1:F2t8sK4qf1fAmY9ua4ohFS/K+FUuOPemHUIXHtktrts= -go.opentelemetry.io/otel v1.30.0/go.mod h1:tFw4Br9b7fOS+uEao81PJjVMjW/5fvNCbpsDIXqP0pc= -go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.30.0 h1:kn1BudCgwtE7PxLqcZkErpD8GKqLZ6BSzeW9QihQJeM= -go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.30.0/go.mod h1:ljkUDtAMdleoi9tIG1R6dJUpVwDcYjw3J2Q6Q/SuiC0= -go.opentelemetry.io/otel/metric v1.30.0 h1:4xNulvn9gjzo4hjg+wzIKG7iNFEaBMX00Qd4QIZs7+w= -go.opentelemetry.io/otel/metric v1.30.0/go.mod h1:aXTfST94tswhWEb+5QjlSqG+cZlmyXy/u8jFpor3WqQ= -go.opentelemetry.io/otel/sdk v1.30.0 h1:cHdik6irO49R5IysVhdn8oaiR9m8XluDaJAs4DfOrYE= -go.opentelemetry.io/otel/sdk v1.30.0/go.mod h1:p14X4Ok8S+sygzblytT1nqG98QG2KYKv++HE0LY/mhg= -go.opentelemetry.io/otel/trace v1.30.0 h1:7UBkkYzeg3C7kQX8VAidWh2biiQbtAKjyIML8dQ9wmc= -go.opentelemetry.io/otel/trace v1.30.0/go.mod h1:5EyKqTzzmyqB9bwtCCq6pDLktPK6fmGf/Dph+8VI02o= -golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= -golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= -golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= -golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= -gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/macaron.v1 v1.5.0 h1:/dXJaeQagWLjVjCrKH8dgSSU7yG4qTv6rBKpqhYaCyc= -gopkg.in/macaron.v1 v1.5.0/go.mod h1:sAYUd2r8Q+jLnCN4/ZmdAYHzQn67agV5sAqKFQgrRrw= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/instrumentation/gopkg.in/macaron.v1/otelmacaron/example/server.go b/instrumentation/gopkg.in/macaron.v1/otelmacaron/example/server.go deleted file mode 100644 index 85d4d010b5d..00000000000 --- a/instrumentation/gopkg.in/macaron.v1/otelmacaron/example/server.go +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package main - -import ( - "context" - "log" - - "gopkg.in/macaron.v1" - - "go.opentelemetry.io/contrib/instrumentation/gopkg.in/macaron.v1/otelmacaron" // nolint:staticcheck // deprecated. - - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/attribute" - stdout "go.opentelemetry.io/otel/exporters/stdout/stdouttrace" - "go.opentelemetry.io/otel/propagation" - sdktrace "go.opentelemetry.io/otel/sdk/trace" - oteltrace "go.opentelemetry.io/otel/trace" -) - -var tracer = otel.Tracer("macaron-server") - -func main() { - tp, err := initTracer() - if err != nil { - log.Fatal(err) - } - defer func() { - if err := tp.Shutdown(context.Background()); err != nil { - log.Printf("Error shutting down tracer provider: %v", err) - } - }() - m := macaron.Classic() - m.Use(otelmacaron.Middleware("my-server")) - m.Get("/users/:id", func(ctx *macaron.Context) string { - id := ctx.Params("id") - name := getUser(ctx.Req.Context(), id) - return name - }) - m.Run() -} - -func initTracer() (*sdktrace.TracerProvider, error) { - exporter, err := stdout.New(stdout.WithPrettyPrint()) - if err != nil { - return nil, err - } - tp := sdktrace.NewTracerProvider( - sdktrace.WithSampler(sdktrace.AlwaysSample()), - sdktrace.WithBatcher(exporter), - ) - otel.SetTracerProvider(tp) - otel.SetTextMapPropagator(propagation.NewCompositeTextMapPropagator(propagation.TraceContext{}, propagation.Baggage{})) - return tp, nil -} - -func getUser(ctx context.Context, id string) string { - _, span := tracer.Start(ctx, "getUser", oteltrace.WithAttributes(attribute.String("id", id))) - defer span.End() - if id == "123" { - return "otelmacaron tester" - } - return "unknown" -} diff --git a/instrumentation/gopkg.in/macaron.v1/otelmacaron/go.mod b/instrumentation/gopkg.in/macaron.v1/otelmacaron/go.mod deleted file mode 100644 index 472259ff427..00000000000 --- a/instrumentation/gopkg.in/macaron.v1/otelmacaron/go.mod +++ /dev/null @@ -1,27 +0,0 @@ -// Deprecated: otelmacaron has no Code Owner. -module go.opentelemetry.io/contrib/instrumentation/gopkg.in/macaron.v1/otelmacaron - -go 1.22 - -replace go.opentelemetry.io/contrib/propagators/b3 => ../../../../propagators/b3 - -require ( - github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/contrib/propagators/b3 v1.30.0 - go.opentelemetry.io/otel v1.30.0 - go.opentelemetry.io/otel/trace v1.30.0 - gopkg.in/macaron.v1 v1.5.0 -) - -require ( - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.4.2 // indirect - github.com/go-logr/stdr v1.2.2 // indirect - github.com/go-macaron/inject v0.0.0-20200308113650-138e5925c53b // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/unknwon/com v1.0.1 // indirect - go.opentelemetry.io/otel/metric v1.30.0 // indirect - golang.org/x/crypto v0.28.0 // indirect - gopkg.in/ini.v1 v1.67.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect -) diff --git a/instrumentation/gopkg.in/macaron.v1/otelmacaron/go.sum b/instrumentation/gopkg.in/macaron.v1/otelmacaron/go.sum deleted file mode 100644 index c556202bc18..00000000000 --- a/instrumentation/gopkg.in/macaron.v1/otelmacaron/go.sum +++ /dev/null @@ -1,45 +0,0 @@ -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= -github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-macaron/inject v0.0.0-20200308113650-138e5925c53b h1:/aWj44HoEycE4MDi2HZf4t+XI7hKwZRltZf4ih5tB2c= -github.com/go-macaron/inject v0.0.0-20200308113650-138e5925c53b/go.mod h1:VFI2o2q9kYsC4o7VP1HrEVosiZZTd+MVT3YZx4gqvJw= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gopherjs/gopherjs v0.0.0-20190430165422-3e4dfb77656c h1:7lF+Vz0LqiRidnzC1Oq86fpX1q/iEv2KJdrCtttYjT4= -github.com/gopherjs/gopherjs v0.0.0-20190430165422-3e4dfb77656c/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= -github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= -github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/smartystreets/assertions v0.0.0-20190116191733-b6c0e53d7304/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/assertions v1.0.1 h1:voD4ITNjPL5jjBfgR/r8fPIIBrliWrWHeiJApdr3r4w= -github.com/smartystreets/assertions v1.0.1/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM= -github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s= -github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337 h1:WN9BUFbdyOsSH/XohnWpXOlq9NBD5sGAB2FciQMUEe8= -github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/unknwon/com v1.0.1 h1:3d1LTxD+Lnf3soQiD4Cp/0BRB+Rsa/+RTvz8GMMzIXs= -github.com/unknwon/com v1.0.1/go.mod h1:tOOxU81rwgoCLoOVVPHb6T/wt8HZygqH5id+GNnlCXM= -go.opentelemetry.io/otel v1.30.0 h1:F2t8sK4qf1fAmY9ua4ohFS/K+FUuOPemHUIXHtktrts= -go.opentelemetry.io/otel v1.30.0/go.mod h1:tFw4Br9b7fOS+uEao81PJjVMjW/5fvNCbpsDIXqP0pc= -go.opentelemetry.io/otel/metric v1.30.0 h1:4xNulvn9gjzo4hjg+wzIKG7iNFEaBMX00Qd4QIZs7+w= -go.opentelemetry.io/otel/metric v1.30.0/go.mod h1:aXTfST94tswhWEb+5QjlSqG+cZlmyXy/u8jFpor3WqQ= -go.opentelemetry.io/otel/trace v1.30.0 h1:7UBkkYzeg3C7kQX8VAidWh2biiQbtAKjyIML8dQ9wmc= -go.opentelemetry.io/otel/trace v1.30.0/go.mod h1:5EyKqTzzmyqB9bwtCCq6pDLktPK6fmGf/Dph+8VI02o= -golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= -golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= -gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/macaron.v1 v1.5.0 h1:/dXJaeQagWLjVjCrKH8dgSSU7yG4qTv6rBKpqhYaCyc= -gopkg.in/macaron.v1 v1.5.0/go.mod h1:sAYUd2r8Q+jLnCN4/ZmdAYHzQn67agV5sAqKFQgrRrw= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/instrumentation/gopkg.in/macaron.v1/otelmacaron/internal/semconvutil/gen.go b/instrumentation/gopkg.in/macaron.v1/otelmacaron/internal/semconvutil/gen.go deleted file mode 100644 index 3e07663e279..00000000000 --- a/instrumentation/gopkg.in/macaron.v1/otelmacaron/internal/semconvutil/gen.go +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package semconvutil // import "go.opentelemetry.io/contrib/instrumentation/gopkg.in/macaron.v1/otelmacaron/internal/semconvutil" - -// Generate semconvutil package: -//go:generate gotmpl --body=../../../../../../internal/shared/semconvutil/httpconv_test.go.tmpl "--data={}" --out=httpconv_test.go -//go:generate gotmpl --body=../../../../../../internal/shared/semconvutil/httpconv.go.tmpl "--data={}" --out=httpconv.go -//go:generate gotmpl --body=../../../../../../internal/shared/semconvutil/netconv_test.go.tmpl "--data={}" --out=netconv_test.go -//go:generate gotmpl --body=../../../../../../internal/shared/semconvutil/netconv.go.tmpl "--data={}" --out=netconv.go diff --git a/instrumentation/gopkg.in/macaron.v1/otelmacaron/internal/semconvutil/httpconv.go b/instrumentation/gopkg.in/macaron.v1/otelmacaron/internal/semconvutil/httpconv.go deleted file mode 100644 index ae5563010b6..00000000000 --- a/instrumentation/gopkg.in/macaron.v1/otelmacaron/internal/semconvutil/httpconv.go +++ /dev/null @@ -1,575 +0,0 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/semconvutil/httpconv.go.tmpl - -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package semconvutil // import "go.opentelemetry.io/contrib/instrumentation/gopkg.in/macaron.v1/otelmacaron/internal/semconvutil" - -import ( - "fmt" - "net/http" - "strings" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/codes" - semconv "go.opentelemetry.io/otel/semconv/v1.20.0" -) - -// HTTPClientResponse returns trace attributes for an HTTP response received by a -// client from a server. It will return the following attributes if the related -// values are defined in resp: "http.status.code", -// "http.response_content_length". -// -// This does not add all OpenTelemetry required attributes for an HTTP event, -// it assumes ClientRequest was used to create the span with a complete set of -// attributes. If a complete set of attributes can be generated using the -// request contained in resp. For example: -// -// append(HTTPClientResponse(resp), ClientRequest(resp.Request)...) -func HTTPClientResponse(resp *http.Response) []attribute.KeyValue { - return hc.ClientResponse(resp) -} - -// HTTPClientRequest returns trace attributes for an HTTP request made by a client. -// The following attributes are always returned: "http.url", "http.method", -// "net.peer.name". The following attributes are returned if the related values -// are defined in req: "net.peer.port", "user_agent.original", -// "http.request_content_length". -func HTTPClientRequest(req *http.Request) []attribute.KeyValue { - return hc.ClientRequest(req) -} - -// HTTPClientRequestMetrics returns metric attributes for an HTTP request made by a client. -// The following attributes are always returned: "http.method", "net.peer.name". -// The following attributes are returned if the -// related values are defined in req: "net.peer.port". -func HTTPClientRequestMetrics(req *http.Request) []attribute.KeyValue { - return hc.ClientRequestMetrics(req) -} - -// HTTPClientStatus returns a span status code and message for an HTTP status code -// value received by a client. -func HTTPClientStatus(code int) (codes.Code, string) { - return hc.ClientStatus(code) -} - -// HTTPServerRequest returns trace attributes for an HTTP request received by a -// server. -// -// The server must be the primary server name if it is known. For example this -// would be the ServerName directive -// (https://httpd.apache.org/docs/2.4/mod/core.html#servername) for an Apache -// server, and the server_name directive -// (http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name) for an -// nginx server. More generically, the primary server name would be the host -// header value that matches the default virtual host of an HTTP server. It -// should include the host identifier and if a port is used to route to the -// server that port identifier should be included as an appropriate port -// suffix. -// -// If the primary server name is not known, server should be an empty string. -// The req Host will be used to determine the server instead. -// -// The following attributes are always returned: "http.method", "http.scheme", -// "http.target", "net.host.name". The following attributes are returned if -// they related values are defined in req: "net.host.port", "net.sock.peer.addr", -// "net.sock.peer.port", "user_agent.original", "http.client_ip". -func HTTPServerRequest(server string, req *http.Request) []attribute.KeyValue { - return hc.ServerRequest(server, req) -} - -// HTTPServerRequestMetrics returns metric attributes for an HTTP request received by a -// server. -// -// The server must be the primary server name if it is known. For example this -// would be the ServerName directive -// (https://httpd.apache.org/docs/2.4/mod/core.html#servername) for an Apache -// server, and the server_name directive -// (http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name) for an -// nginx server. More generically, the primary server name would be the host -// header value that matches the default virtual host of an HTTP server. It -// should include the host identifier and if a port is used to route to the -// server that port identifier should be included as an appropriate port -// suffix. -// -// If the primary server name is not known, server should be an empty string. -// The req Host will be used to determine the server instead. -// -// The following attributes are always returned: "http.method", "http.scheme", -// "net.host.name". The following attributes are returned if they related -// values are defined in req: "net.host.port". -func HTTPServerRequestMetrics(server string, req *http.Request) []attribute.KeyValue { - return hc.ServerRequestMetrics(server, req) -} - -// HTTPServerStatus returns a span status code and message for an HTTP status code -// value returned by a server. Status codes in the 400-499 range are not -// returned as errors. -func HTTPServerStatus(code int) (codes.Code, string) { - return hc.ServerStatus(code) -} - -// httpConv are the HTTP semantic convention attributes defined for a version -// of the OpenTelemetry specification. -type httpConv struct { - NetConv *netConv - - HTTPClientIPKey attribute.Key - HTTPMethodKey attribute.Key - HTTPRequestContentLengthKey attribute.Key - HTTPResponseContentLengthKey attribute.Key - HTTPRouteKey attribute.Key - HTTPSchemeHTTP attribute.KeyValue - HTTPSchemeHTTPS attribute.KeyValue - HTTPStatusCodeKey attribute.Key - HTTPTargetKey attribute.Key - HTTPURLKey attribute.Key - UserAgentOriginalKey attribute.Key -} - -var hc = &httpConv{ - NetConv: nc, - - HTTPClientIPKey: semconv.HTTPClientIPKey, - HTTPMethodKey: semconv.HTTPMethodKey, - HTTPRequestContentLengthKey: semconv.HTTPRequestContentLengthKey, - HTTPResponseContentLengthKey: semconv.HTTPResponseContentLengthKey, - HTTPRouteKey: semconv.HTTPRouteKey, - HTTPSchemeHTTP: semconv.HTTPSchemeHTTP, - HTTPSchemeHTTPS: semconv.HTTPSchemeHTTPS, - HTTPStatusCodeKey: semconv.HTTPStatusCodeKey, - HTTPTargetKey: semconv.HTTPTargetKey, - HTTPURLKey: semconv.HTTPURLKey, - UserAgentOriginalKey: semconv.UserAgentOriginalKey, -} - -// ClientResponse returns attributes for an HTTP response received by a client -// from a server. The following attributes are returned if the related values -// are defined in resp: "http.status.code", "http.response_content_length". -// -// This does not add all OpenTelemetry required attributes for an HTTP event, -// it assumes ClientRequest was used to create the span with a complete set of -// attributes. If a complete set of attributes can be generated using the -// request contained in resp. For example: -// -// append(ClientResponse(resp), ClientRequest(resp.Request)...) -func (c *httpConv) ClientResponse(resp *http.Response) []attribute.KeyValue { - /* The following semantic conventions are returned if present: - http.status_code int - http.response_content_length int - */ - var n int - if resp.StatusCode > 0 { - n++ - } - if resp.ContentLength > 0 { - n++ - } - - attrs := make([]attribute.KeyValue, 0, n) - if resp.StatusCode > 0 { - attrs = append(attrs, c.HTTPStatusCodeKey.Int(resp.StatusCode)) - } - if resp.ContentLength > 0 { - attrs = append(attrs, c.HTTPResponseContentLengthKey.Int(int(resp.ContentLength))) - } - return attrs -} - -// ClientRequest returns attributes for an HTTP request made by a client. The -// following attributes are always returned: "http.url", "http.method", -// "net.peer.name". The following attributes are returned if the related values -// are defined in req: "net.peer.port", "user_agent.original", -// "http.request_content_length", "user_agent.original". -func (c *httpConv) ClientRequest(req *http.Request) []attribute.KeyValue { - /* The following semantic conventions are returned if present: - http.method string - user_agent.original string - http.url string - net.peer.name string - net.peer.port int - http.request_content_length int - */ - - /* The following semantic conventions are not returned: - http.status_code This requires the response. See ClientResponse. - http.response_content_length This requires the response. See ClientResponse. - net.sock.family This requires the socket used. - net.sock.peer.addr This requires the socket used. - net.sock.peer.name This requires the socket used. - net.sock.peer.port This requires the socket used. - http.resend_count This is something outside of a single request. - net.protocol.name The value is the Request is ignored, and the go client will always use "http". - net.protocol.version The value in the Request is ignored, and the go client will always use 1.1 or 2.0. - */ - n := 3 // URL, peer name, proto, and method. - var h string - if req.URL != nil { - h = req.URL.Host - } - peer, p := firstHostPort(h, req.Header.Get("Host")) - port := requiredHTTPPort(req.URL != nil && req.URL.Scheme == "https", p) - if port > 0 { - n++ - } - useragent := req.UserAgent() - if useragent != "" { - n++ - } - if req.ContentLength > 0 { - n++ - } - - attrs := make([]attribute.KeyValue, 0, n) - - attrs = append(attrs, c.method(req.Method)) - - var u string - if req.URL != nil { - // Remove any username/password info that may be in the URL. - userinfo := req.URL.User - req.URL.User = nil - u = req.URL.String() - // Restore any username/password info that was removed. - req.URL.User = userinfo - } - attrs = append(attrs, c.HTTPURLKey.String(u)) - - attrs = append(attrs, c.NetConv.PeerName(peer)) - if port > 0 { - attrs = append(attrs, c.NetConv.PeerPort(port)) - } - - if useragent != "" { - attrs = append(attrs, c.UserAgentOriginalKey.String(useragent)) - } - - if l := req.ContentLength; l > 0 { - attrs = append(attrs, c.HTTPRequestContentLengthKey.Int64(l)) - } - - return attrs -} - -// ClientRequestMetrics returns metric attributes for an HTTP request made by a client. The -// following attributes are always returned: "http.method", "net.peer.name". -// The following attributes are returned if the related values -// are defined in req: "net.peer.port". -func (c *httpConv) ClientRequestMetrics(req *http.Request) []attribute.KeyValue { - /* The following semantic conventions are returned if present: - http.method string - net.peer.name string - net.peer.port int - */ - - n := 2 // method, peer name. - var h string - if req.URL != nil { - h = req.URL.Host - } - peer, p := firstHostPort(h, req.Header.Get("Host")) - port := requiredHTTPPort(req.URL != nil && req.URL.Scheme == "https", p) - if port > 0 { - n++ - } - - attrs := make([]attribute.KeyValue, 0, n) - attrs = append(attrs, c.method(req.Method), c.NetConv.PeerName(peer)) - - if port > 0 { - attrs = append(attrs, c.NetConv.PeerPort(port)) - } - - return attrs -} - -// ServerRequest returns attributes for an HTTP request received by a server. -// -// The server must be the primary server name if it is known. For example this -// would be the ServerName directive -// (https://httpd.apache.org/docs/2.4/mod/core.html#servername) for an Apache -// server, and the server_name directive -// (http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name) for an -// nginx server. More generically, the primary server name would be the host -// header value that matches the default virtual host of an HTTP server. It -// should include the host identifier and if a port is used to route to the -// server that port identifier should be included as an appropriate port -// suffix. -// -// If the primary server name is not known, server should be an empty string. -// The req Host will be used to determine the server instead. -// -// The following attributes are always returned: "http.method", "http.scheme", -// "http.target", "net.host.name". The following attributes are returned if they -// related values are defined in req: "net.host.port", "net.sock.peer.addr", -// "net.sock.peer.port", "user_agent.original", "http.client_ip", -// "net.protocol.name", "net.protocol.version". -func (c *httpConv) ServerRequest(server string, req *http.Request) []attribute.KeyValue { - /* The following semantic conventions are returned if present: - http.method string - http.scheme string - net.host.name string - net.host.port int - net.sock.peer.addr string - net.sock.peer.port int - user_agent.original string - http.client_ip string - net.protocol.name string Note: not set if the value is "http". - net.protocol.version string - http.target string Note: doesn't include the query parameter. - */ - - /* The following semantic conventions are not returned: - http.status_code This requires the response. - http.request_content_length This requires the len() of body, which can mutate it. - http.response_content_length This requires the response. - http.route This is not available. - net.sock.peer.name This would require a DNS lookup. - net.sock.host.addr The request doesn't have access to the underlying socket. - net.sock.host.port The request doesn't have access to the underlying socket. - - */ - n := 4 // Method, scheme, proto, and host name. - var host string - var p int - if server == "" { - host, p = splitHostPort(req.Host) - } else { - // Prioritize the primary server name. - host, p = splitHostPort(server) - if p < 0 { - _, p = splitHostPort(req.Host) - } - } - hostPort := requiredHTTPPort(req.TLS != nil, p) - if hostPort > 0 { - n++ - } - peer, peerPort := splitHostPort(req.RemoteAddr) - if peer != "" { - n++ - if peerPort > 0 { - n++ - } - } - useragent := req.UserAgent() - if useragent != "" { - n++ - } - - clientIP := serverClientIP(req.Header.Get("X-Forwarded-For")) - if clientIP != "" { - n++ - } - - var target string - if req.URL != nil { - target = req.URL.Path - if target != "" { - n++ - } - } - protoName, protoVersion := netProtocol(req.Proto) - if protoName != "" && protoName != "http" { - n++ - } - if protoVersion != "" { - n++ - } - - attrs := make([]attribute.KeyValue, 0, n) - - attrs = append(attrs, c.method(req.Method)) - attrs = append(attrs, c.scheme(req.TLS != nil)) - attrs = append(attrs, c.NetConv.HostName(host)) - - if hostPort > 0 { - attrs = append(attrs, c.NetConv.HostPort(hostPort)) - } - - if peer != "" { - // The Go HTTP server sets RemoteAddr to "IP:port", this will not be a - // file-path that would be interpreted with a sock family. - attrs = append(attrs, c.NetConv.SockPeerAddr(peer)) - if peerPort > 0 { - attrs = append(attrs, c.NetConv.SockPeerPort(peerPort)) - } - } - - if useragent != "" { - attrs = append(attrs, c.UserAgentOriginalKey.String(useragent)) - } - - if clientIP != "" { - attrs = append(attrs, c.HTTPClientIPKey.String(clientIP)) - } - - if target != "" { - attrs = append(attrs, c.HTTPTargetKey.String(target)) - } - - if protoName != "" && protoName != "http" { - attrs = append(attrs, c.NetConv.NetProtocolName.String(protoName)) - } - if protoVersion != "" { - attrs = append(attrs, c.NetConv.NetProtocolVersion.String(protoVersion)) - } - - return attrs -} - -// ServerRequestMetrics returns metric attributes for an HTTP request received -// by a server. -// -// The server must be the primary server name if it is known. For example this -// would be the ServerName directive -// (https://httpd.apache.org/docs/2.4/mod/core.html#servername) for an Apache -// server, and the server_name directive -// (http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name) for an -// nginx server. More generically, the primary server name would be the host -// header value that matches the default virtual host of an HTTP server. It -// should include the host identifier and if a port is used to route to the -// server that port identifier should be included as an appropriate port -// suffix. -// -// If the primary server name is not known, server should be an empty string. -// The req Host will be used to determine the server instead. -// -// The following attributes are always returned: "http.method", "http.scheme", -// "net.host.name". The following attributes are returned if they related -// values are defined in req: "net.host.port". -func (c *httpConv) ServerRequestMetrics(server string, req *http.Request) []attribute.KeyValue { - /* The following semantic conventions are returned if present: - http.scheme string - http.route string - http.method string - http.status_code int - net.host.name string - net.host.port int - net.protocol.name string Note: not set if the value is "http". - net.protocol.version string - */ - - n := 3 // Method, scheme, and host name. - var host string - var p int - if server == "" { - host, p = splitHostPort(req.Host) - } else { - // Prioritize the primary server name. - host, p = splitHostPort(server) - if p < 0 { - _, p = splitHostPort(req.Host) - } - } - hostPort := requiredHTTPPort(req.TLS != nil, p) - if hostPort > 0 { - n++ - } - protoName, protoVersion := netProtocol(req.Proto) - if protoName != "" { - n++ - } - if protoVersion != "" { - n++ - } - - attrs := make([]attribute.KeyValue, 0, n) - - attrs = append(attrs, c.methodMetric(req.Method)) - attrs = append(attrs, c.scheme(req.TLS != nil)) - attrs = append(attrs, c.NetConv.HostName(host)) - - if hostPort > 0 { - attrs = append(attrs, c.NetConv.HostPort(hostPort)) - } - if protoName != "" { - attrs = append(attrs, c.NetConv.NetProtocolName.String(protoName)) - } - if protoVersion != "" { - attrs = append(attrs, c.NetConv.NetProtocolVersion.String(protoVersion)) - } - - return attrs -} - -func (c *httpConv) method(method string) attribute.KeyValue { - if method == "" { - return c.HTTPMethodKey.String(http.MethodGet) - } - return c.HTTPMethodKey.String(method) -} - -func (c *httpConv) methodMetric(method string) attribute.KeyValue { - method = strings.ToUpper(method) - switch method { - case http.MethodConnect, http.MethodDelete, http.MethodGet, http.MethodHead, http.MethodOptions, http.MethodPatch, http.MethodPost, http.MethodPut, http.MethodTrace: - default: - method = "_OTHER" - } - return c.HTTPMethodKey.String(method) -} - -func (c *httpConv) scheme(https bool) attribute.KeyValue { // nolint:revive - if https { - return c.HTTPSchemeHTTPS - } - return c.HTTPSchemeHTTP -} - -func serverClientIP(xForwardedFor string) string { - if idx := strings.Index(xForwardedFor, ","); idx >= 0 { - xForwardedFor = xForwardedFor[:idx] - } - return xForwardedFor -} - -func requiredHTTPPort(https bool, port int) int { // nolint:revive - if https { - if port > 0 && port != 443 { - return port - } - } else { - if port > 0 && port != 80 { - return port - } - } - return -1 -} - -// Return the request host and port from the first non-empty source. -func firstHostPort(source ...string) (host string, port int) { - for _, hostport := range source { - host, port = splitHostPort(hostport) - if host != "" || port > 0 { - break - } - } - return -} - -// ClientStatus returns a span status code and message for an HTTP status code -// value received by a client. -func (c *httpConv) ClientStatus(code int) (codes.Code, string) { - if code < 100 || code >= 600 { - return codes.Error, fmt.Sprintf("Invalid HTTP status code %d", code) - } - if code >= 400 { - return codes.Error, "" - } - return codes.Unset, "" -} - -// ServerStatus returns a span status code and message for an HTTP status code -// value returned by a server. Status codes in the 400-499 range are not -// returned as errors. -func (c *httpConv) ServerStatus(code int) (codes.Code, string) { - if code < 100 || code >= 600 { - return codes.Error, fmt.Sprintf("Invalid HTTP status code %d", code) - } - if code >= 500 { - return codes.Error, "" - } - return codes.Unset, "" -} diff --git a/instrumentation/gopkg.in/macaron.v1/otelmacaron/internal/semconvutil/httpconv_test.go b/instrumentation/gopkg.in/macaron.v1/otelmacaron/internal/semconvutil/httpconv_test.go deleted file mode 100644 index 868b09da277..00000000000 --- a/instrumentation/gopkg.in/macaron.v1/otelmacaron/internal/semconvutil/httpconv_test.go +++ /dev/null @@ -1,510 +0,0 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/semconvutil/httpconv_test.go.tmpl - -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package semconvutil - -import ( - "net/http" - "net/http/httptest" - "net/url" - "strconv" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/codes" -) - -func TestHTTPClientResponse(t *testing.T) { - const stat, n = 201, 397 - resp := &http.Response{ - StatusCode: stat, - ContentLength: n, - } - got := HTTPClientResponse(resp) - assert.Equal(t, 2, cap(got), "slice capacity") - assert.ElementsMatch(t, []attribute.KeyValue{ - attribute.Key("http.status_code").Int(stat), - attribute.Key("http.response_content_length").Int(n), - }, got) -} - -func TestHTTPSClientRequest(t *testing.T) { - req := &http.Request{ - Method: http.MethodGet, - URL: &url.URL{ - Scheme: "https", - Host: "127.0.0.1:443", - Path: "/resource", - }, - Proto: "HTTP/1.0", - ProtoMajor: 1, - ProtoMinor: 0, - } - - assert.ElementsMatch( - t, - []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.url", "https://127.0.0.1:443/resource"), - attribute.String("net.peer.name", "127.0.0.1"), - }, - HTTPClientRequest(req), - ) -} - -func TestHTTPSClientRequestMetrics(t *testing.T) { - req := &http.Request{ - Method: http.MethodGet, - URL: &url.URL{ - Scheme: "https", - Host: "127.0.0.1:443", - Path: "/resource", - }, - Proto: "HTTP/1.0", - ProtoMajor: 1, - ProtoMinor: 0, - } - - assert.ElementsMatch( - t, - []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("net.peer.name", "127.0.0.1"), - }, - HTTPClientRequestMetrics(req), - ) -} - -func TestHTTPClientRequest(t *testing.T) { - const ( - user = "alice" - n = 128 - agent = "Go-http-client/1.1" - ) - req := &http.Request{ - Method: http.MethodGet, - URL: &url.URL{ - Scheme: "http", - Host: "127.0.0.1:8080", - Path: "/resource", - }, - Proto: "HTTP/1.0", - ProtoMajor: 1, - ProtoMinor: 0, - Header: http.Header{ - "User-Agent": []string{agent}, - }, - ContentLength: n, - } - req.SetBasicAuth(user, "pswrd") - - assert.ElementsMatch( - t, - []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.url", "http://127.0.0.1:8080/resource"), - attribute.String("net.peer.name", "127.0.0.1"), - attribute.Int("net.peer.port", 8080), - attribute.String("user_agent.original", agent), - attribute.Int("http.request_content_length", n), - }, - HTTPClientRequest(req), - ) -} - -func TestHTTPClientRequestMetrics(t *testing.T) { - const ( - user = "alice" - n = 128 - agent = "Go-http-client/1.1" - ) - req := &http.Request{ - Method: http.MethodGet, - URL: &url.URL{ - Scheme: "http", - Host: "127.0.0.1:8080", - Path: "/resource", - }, - Proto: "HTTP/1.0", - ProtoMajor: 1, - ProtoMinor: 0, - Header: http.Header{ - "User-Agent": []string{agent}, - }, - ContentLength: n, - } - req.SetBasicAuth(user, "pswrd") - - assert.ElementsMatch( - t, - []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("net.peer.name", "127.0.0.1"), - attribute.Int("net.peer.port", 8080), - }, - HTTPClientRequestMetrics(req), - ) -} - -func TestHTTPClientRequestRequired(t *testing.T) { - req := new(http.Request) - var got []attribute.KeyValue - assert.NotPanics(t, func() { got = HTTPClientRequest(req) }) - want := []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.url", ""), - attribute.String("net.peer.name", ""), - } - assert.Equal(t, want, got) -} - -func TestHTTPServerRequest(t *testing.T) { - got := make(chan *http.Request, 1) - handler := func(w http.ResponseWriter, r *http.Request) { - got <- r - w.WriteHeader(http.StatusOK) - } - - srv := httptest.NewServer(http.HandlerFunc(handler)) - defer srv.Close() - - srvURL, err := url.Parse(srv.URL) - require.NoError(t, err) - srvPort, err := strconv.ParseInt(srvURL.Port(), 10, 32) - require.NoError(t, err) - - resp, err := srv.Client().Get(srv.URL) - require.NoError(t, err) - require.NoError(t, resp.Body.Close()) - - req := <-got - peer, peerPort := splitHostPort(req.RemoteAddr) - - const user = "alice" - req.SetBasicAuth(user, "pswrd") - - const clientIP = "127.0.0.5" - req.Header.Add("X-Forwarded-For", clientIP) - - assert.ElementsMatch(t, - []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.scheme", "http"), - attribute.String("net.host.name", srvURL.Hostname()), - attribute.Int("net.host.port", int(srvPort)), - attribute.String("net.sock.peer.addr", peer), - attribute.Int("net.sock.peer.port", peerPort), - attribute.String("user_agent.original", "Go-http-client/1.1"), - attribute.String("http.client_ip", clientIP), - attribute.String("net.protocol.version", "1.1"), - attribute.String("http.target", "/"), - }, - HTTPServerRequest("", req)) -} - -func TestHTTPServerRequestMetrics(t *testing.T) { - got := make(chan *http.Request, 1) - handler := func(w http.ResponseWriter, r *http.Request) { - got <- r - w.WriteHeader(http.StatusOK) - } - - srv := httptest.NewServer(http.HandlerFunc(handler)) - defer srv.Close() - - srvURL, err := url.Parse(srv.URL) - require.NoError(t, err) - srvPort, err := strconv.ParseInt(srvURL.Port(), 10, 32) - require.NoError(t, err) - - resp, err := srv.Client().Get(srv.URL) - require.NoError(t, err) - require.NoError(t, resp.Body.Close()) - - req := <-got - - assert.ElementsMatch(t, - []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.scheme", "http"), - attribute.String("net.host.name", srvURL.Hostname()), - attribute.Int("net.host.port", int(srvPort)), - attribute.String("net.protocol.name", "http"), - attribute.String("net.protocol.version", "1.1"), - }, - HTTPServerRequestMetrics("", req)) -} - -func TestHTTPServerName(t *testing.T) { - req := new(http.Request) - var got []attribute.KeyValue - const ( - host = "test.semconv.server" - port = 8080 - ) - portStr := strconv.Itoa(port) - server := host + ":" + portStr - assert.NotPanics(t, func() { got = HTTPServerRequest(server, req) }) - assert.Contains(t, got, attribute.String("net.host.name", host)) - assert.Contains(t, got, attribute.Int("net.host.port", port)) - - req = &http.Request{Host: "alt.host.name:" + portStr} - // The server parameter does not include a port, ServerRequest should use - // the port in the request Host field. - assert.NotPanics(t, func() { got = HTTPServerRequest(host, req) }) - assert.Contains(t, got, attribute.String("net.host.name", host)) - assert.Contains(t, got, attribute.Int("net.host.port", port)) -} - -func TestHTTPServerRequestFailsGracefully(t *testing.T) { - req := new(http.Request) - var got []attribute.KeyValue - assert.NotPanics(t, func() { got = HTTPServerRequest("", req) }) - want := []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.scheme", "http"), - attribute.String("net.host.name", ""), - } - assert.ElementsMatch(t, want, got) -} - -func TestHTTPMethod(t *testing.T) { - assert.Equal(t, attribute.String("http.method", "POST"), hc.method("POST")) - assert.Equal(t, attribute.String("http.method", "GET"), hc.method("")) - assert.Equal(t, attribute.String("http.method", "garbage"), hc.method("garbage")) -} - -func TestHTTPScheme(t *testing.T) { - assert.Equal(t, attribute.String("http.scheme", "http"), hc.scheme(false)) - assert.Equal(t, attribute.String("http.scheme", "https"), hc.scheme(true)) -} - -func TestHTTPServerClientIP(t *testing.T) { - tests := []struct { - xForwardedFor string - want string - }{ - {"", ""}, - {"127.0.0.1", "127.0.0.1"}, - {"127.0.0.1,127.0.0.5", "127.0.0.1"}, - } - for _, test := range tests { - got := serverClientIP(test.xForwardedFor) - assert.Equal(t, test.want, got, test.xForwardedFor) - } -} - -func TestRequiredHTTPPort(t *testing.T) { - tests := []struct { - https bool - port int - want int - }{ - {true, 443, -1}, - {true, 80, 80}, - {true, 8081, 8081}, - {false, 443, 443}, - {false, 80, -1}, - {false, 8080, 8080}, - } - for _, test := range tests { - got := requiredHTTPPort(test.https, test.port) - assert.Equal(t, test.want, got, test.https, test.port) - } -} - -func TestFirstHostPort(t *testing.T) { - host, port := "127.0.0.1", 8080 - hostport := "127.0.0.1:8080" - sources := [][]string{ - {hostport}, - {"", hostport}, - {"", "", hostport}, - {"", "", hostport, ""}, - {"", "", hostport, "127.0.0.3:80"}, - } - - for _, src := range sources { - h, p := firstHostPort(src...) - assert.Equal(t, host, h, src) - assert.Equal(t, port, p, src) - } -} - -func TestHTTPClientStatus(t *testing.T) { - tests := []struct { - code int - stat codes.Code - msg bool - }{ - {0, codes.Error, true}, - {http.StatusContinue, codes.Unset, false}, - {http.StatusSwitchingProtocols, codes.Unset, false}, - {http.StatusProcessing, codes.Unset, false}, - {http.StatusEarlyHints, codes.Unset, false}, - {http.StatusOK, codes.Unset, false}, - {http.StatusCreated, codes.Unset, false}, - {http.StatusAccepted, codes.Unset, false}, - {http.StatusNonAuthoritativeInfo, codes.Unset, false}, - {http.StatusNoContent, codes.Unset, false}, - {http.StatusResetContent, codes.Unset, false}, - {http.StatusPartialContent, codes.Unset, false}, - {http.StatusMultiStatus, codes.Unset, false}, - {http.StatusAlreadyReported, codes.Unset, false}, - {http.StatusIMUsed, codes.Unset, false}, - {http.StatusMultipleChoices, codes.Unset, false}, - {http.StatusMovedPermanently, codes.Unset, false}, - {http.StatusFound, codes.Unset, false}, - {http.StatusSeeOther, codes.Unset, false}, - {http.StatusNotModified, codes.Unset, false}, - {http.StatusUseProxy, codes.Unset, false}, - {306, codes.Unset, false}, - {http.StatusTemporaryRedirect, codes.Unset, false}, - {http.StatusPermanentRedirect, codes.Unset, false}, - {http.StatusBadRequest, codes.Error, false}, - {http.StatusUnauthorized, codes.Error, false}, - {http.StatusPaymentRequired, codes.Error, false}, - {http.StatusForbidden, codes.Error, false}, - {http.StatusNotFound, codes.Error, false}, - {http.StatusMethodNotAllowed, codes.Error, false}, - {http.StatusNotAcceptable, codes.Error, false}, - {http.StatusProxyAuthRequired, codes.Error, false}, - {http.StatusRequestTimeout, codes.Error, false}, - {http.StatusConflict, codes.Error, false}, - {http.StatusGone, codes.Error, false}, - {http.StatusLengthRequired, codes.Error, false}, - {http.StatusPreconditionFailed, codes.Error, false}, - {http.StatusRequestEntityTooLarge, codes.Error, false}, - {http.StatusRequestURITooLong, codes.Error, false}, - {http.StatusUnsupportedMediaType, codes.Error, false}, - {http.StatusRequestedRangeNotSatisfiable, codes.Error, false}, - {http.StatusExpectationFailed, codes.Error, false}, - {http.StatusTeapot, codes.Error, false}, - {http.StatusMisdirectedRequest, codes.Error, false}, - {http.StatusUnprocessableEntity, codes.Error, false}, - {http.StatusLocked, codes.Error, false}, - {http.StatusFailedDependency, codes.Error, false}, - {http.StatusTooEarly, codes.Error, false}, - {http.StatusUpgradeRequired, codes.Error, false}, - {http.StatusPreconditionRequired, codes.Error, false}, - {http.StatusTooManyRequests, codes.Error, false}, - {http.StatusRequestHeaderFieldsTooLarge, codes.Error, false}, - {http.StatusUnavailableForLegalReasons, codes.Error, false}, - {499, codes.Error, false}, - {http.StatusInternalServerError, codes.Error, false}, - {http.StatusNotImplemented, codes.Error, false}, - {http.StatusBadGateway, codes.Error, false}, - {http.StatusServiceUnavailable, codes.Error, false}, - {http.StatusGatewayTimeout, codes.Error, false}, - {http.StatusHTTPVersionNotSupported, codes.Error, false}, - {http.StatusVariantAlsoNegotiates, codes.Error, false}, - {http.StatusInsufficientStorage, codes.Error, false}, - {http.StatusLoopDetected, codes.Error, false}, - {http.StatusNotExtended, codes.Error, false}, - {http.StatusNetworkAuthenticationRequired, codes.Error, false}, - {600, codes.Error, true}, - } - - for _, test := range tests { - t.Run(strconv.Itoa(test.code), func(t *testing.T) { - c, msg := HTTPClientStatus(test.code) - assert.Equal(t, test.stat, c) - if test.msg && msg == "" { - t.Errorf("expected non-empty message for %d", test.code) - } else if !test.msg && msg != "" { - t.Errorf("expected empty message for %d, got: %s", test.code, msg) - } - }) - } -} - -func TestHTTPServerStatus(t *testing.T) { - tests := []struct { - code int - stat codes.Code - msg bool - }{ - {0, codes.Error, true}, - {http.StatusContinue, codes.Unset, false}, - {http.StatusSwitchingProtocols, codes.Unset, false}, - {http.StatusProcessing, codes.Unset, false}, - {http.StatusEarlyHints, codes.Unset, false}, - {http.StatusOK, codes.Unset, false}, - {http.StatusCreated, codes.Unset, false}, - {http.StatusAccepted, codes.Unset, false}, - {http.StatusNonAuthoritativeInfo, codes.Unset, false}, - {http.StatusNoContent, codes.Unset, false}, - {http.StatusResetContent, codes.Unset, false}, - {http.StatusPartialContent, codes.Unset, false}, - {http.StatusMultiStatus, codes.Unset, false}, - {http.StatusAlreadyReported, codes.Unset, false}, - {http.StatusIMUsed, codes.Unset, false}, - {http.StatusMultipleChoices, codes.Unset, false}, - {http.StatusMovedPermanently, codes.Unset, false}, - {http.StatusFound, codes.Unset, false}, - {http.StatusSeeOther, codes.Unset, false}, - {http.StatusNotModified, codes.Unset, false}, - {http.StatusUseProxy, codes.Unset, false}, - {306, codes.Unset, false}, - {http.StatusTemporaryRedirect, codes.Unset, false}, - {http.StatusPermanentRedirect, codes.Unset, false}, - {http.StatusBadRequest, codes.Unset, false}, - {http.StatusUnauthorized, codes.Unset, false}, - {http.StatusPaymentRequired, codes.Unset, false}, - {http.StatusForbidden, codes.Unset, false}, - {http.StatusNotFound, codes.Unset, false}, - {http.StatusMethodNotAllowed, codes.Unset, false}, - {http.StatusNotAcceptable, codes.Unset, false}, - {http.StatusProxyAuthRequired, codes.Unset, false}, - {http.StatusRequestTimeout, codes.Unset, false}, - {http.StatusConflict, codes.Unset, false}, - {http.StatusGone, codes.Unset, false}, - {http.StatusLengthRequired, codes.Unset, false}, - {http.StatusPreconditionFailed, codes.Unset, false}, - {http.StatusRequestEntityTooLarge, codes.Unset, false}, - {http.StatusRequestURITooLong, codes.Unset, false}, - {http.StatusUnsupportedMediaType, codes.Unset, false}, - {http.StatusRequestedRangeNotSatisfiable, codes.Unset, false}, - {http.StatusExpectationFailed, codes.Unset, false}, - {http.StatusTeapot, codes.Unset, false}, - {http.StatusMisdirectedRequest, codes.Unset, false}, - {http.StatusUnprocessableEntity, codes.Unset, false}, - {http.StatusLocked, codes.Unset, false}, - {http.StatusFailedDependency, codes.Unset, false}, - {http.StatusTooEarly, codes.Unset, false}, - {http.StatusUpgradeRequired, codes.Unset, false}, - {http.StatusPreconditionRequired, codes.Unset, false}, - {http.StatusTooManyRequests, codes.Unset, false}, - {http.StatusRequestHeaderFieldsTooLarge, codes.Unset, false}, - {http.StatusUnavailableForLegalReasons, codes.Unset, false}, - {499, codes.Unset, false}, - {http.StatusInternalServerError, codes.Error, false}, - {http.StatusNotImplemented, codes.Error, false}, - {http.StatusBadGateway, codes.Error, false}, - {http.StatusServiceUnavailable, codes.Error, false}, - {http.StatusGatewayTimeout, codes.Error, false}, - {http.StatusHTTPVersionNotSupported, codes.Error, false}, - {http.StatusVariantAlsoNegotiates, codes.Error, false}, - {http.StatusInsufficientStorage, codes.Error, false}, - {http.StatusLoopDetected, codes.Error, false}, - {http.StatusNotExtended, codes.Error, false}, - {http.StatusNetworkAuthenticationRequired, codes.Error, false}, - {600, codes.Error, true}, - } - - for _, test := range tests { - c, msg := HTTPServerStatus(test.code) - assert.Equal(t, test.stat, c) - if test.msg && msg == "" { - t.Errorf("expected non-empty message for %d", test.code) - } else if !test.msg && msg != "" { - t.Errorf("expected empty message for %d, got: %s", test.code, msg) - } - } -} diff --git a/instrumentation/gopkg.in/macaron.v1/otelmacaron/internal/semconvutil/netconv.go b/instrumentation/gopkg.in/macaron.v1/otelmacaron/internal/semconvutil/netconv.go deleted file mode 100644 index eda4a8696dd..00000000000 --- a/instrumentation/gopkg.in/macaron.v1/otelmacaron/internal/semconvutil/netconv.go +++ /dev/null @@ -1,205 +0,0 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/semconvutil/netconv.go.tmpl - -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package semconvutil // import "go.opentelemetry.io/contrib/instrumentation/gopkg.in/macaron.v1/otelmacaron/internal/semconvutil" - -import ( - "net" - "strconv" - "strings" - - "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.20.0" -) - -// NetTransport returns a trace attribute describing the transport protocol of the -// passed network. See the net.Dial for information about acceptable network -// values. -func NetTransport(network string) attribute.KeyValue { - return nc.Transport(network) -} - -// netConv are the network semantic convention attributes defined for a version -// of the OpenTelemetry specification. -type netConv struct { - NetHostNameKey attribute.Key - NetHostPortKey attribute.Key - NetPeerNameKey attribute.Key - NetPeerPortKey attribute.Key - NetProtocolName attribute.Key - NetProtocolVersion attribute.Key - NetSockFamilyKey attribute.Key - NetSockPeerAddrKey attribute.Key - NetSockPeerPortKey attribute.Key - NetSockHostAddrKey attribute.Key - NetSockHostPortKey attribute.Key - NetTransportOther attribute.KeyValue - NetTransportTCP attribute.KeyValue - NetTransportUDP attribute.KeyValue - NetTransportInProc attribute.KeyValue -} - -var nc = &netConv{ - NetHostNameKey: semconv.NetHostNameKey, - NetHostPortKey: semconv.NetHostPortKey, - NetPeerNameKey: semconv.NetPeerNameKey, - NetPeerPortKey: semconv.NetPeerPortKey, - NetProtocolName: semconv.NetProtocolNameKey, - NetProtocolVersion: semconv.NetProtocolVersionKey, - NetSockFamilyKey: semconv.NetSockFamilyKey, - NetSockPeerAddrKey: semconv.NetSockPeerAddrKey, - NetSockPeerPortKey: semconv.NetSockPeerPortKey, - NetSockHostAddrKey: semconv.NetSockHostAddrKey, - NetSockHostPortKey: semconv.NetSockHostPortKey, - NetTransportOther: semconv.NetTransportOther, - NetTransportTCP: semconv.NetTransportTCP, - NetTransportUDP: semconv.NetTransportUDP, - NetTransportInProc: semconv.NetTransportInProc, -} - -func (c *netConv) Transport(network string) attribute.KeyValue { - switch network { - case "tcp", "tcp4", "tcp6": - return c.NetTransportTCP - case "udp", "udp4", "udp6": - return c.NetTransportUDP - case "unix", "unixgram", "unixpacket": - return c.NetTransportInProc - default: - // "ip:*", "ip4:*", and "ip6:*" all are considered other. - return c.NetTransportOther - } -} - -// Host returns attributes for a network host address. -func (c *netConv) Host(address string) []attribute.KeyValue { - h, p := splitHostPort(address) - var n int - if h != "" { - n++ - if p > 0 { - n++ - } - } - - if n == 0 { - return nil - } - - attrs := make([]attribute.KeyValue, 0, n) - attrs = append(attrs, c.HostName(h)) - if p > 0 { - attrs = append(attrs, c.HostPort(p)) - } - return attrs -} - -func (c *netConv) HostName(name string) attribute.KeyValue { - return c.NetHostNameKey.String(name) -} - -func (c *netConv) HostPort(port int) attribute.KeyValue { - return c.NetHostPortKey.Int(port) -} - -func family(network, address string) string { - switch network { - case "unix", "unixgram", "unixpacket": - return "unix" - default: - if ip := net.ParseIP(address); ip != nil { - if ip.To4() == nil { - return "inet6" - } - return "inet" - } - } - return "" -} - -// Peer returns attributes for a network peer address. -func (c *netConv) Peer(address string) []attribute.KeyValue { - h, p := splitHostPort(address) - var n int - if h != "" { - n++ - if p > 0 { - n++ - } - } - - if n == 0 { - return nil - } - - attrs := make([]attribute.KeyValue, 0, n) - attrs = append(attrs, c.PeerName(h)) - if p > 0 { - attrs = append(attrs, c.PeerPort(p)) - } - return attrs -} - -func (c *netConv) PeerName(name string) attribute.KeyValue { - return c.NetPeerNameKey.String(name) -} - -func (c *netConv) PeerPort(port int) attribute.KeyValue { - return c.NetPeerPortKey.Int(port) -} - -func (c *netConv) SockPeerAddr(addr string) attribute.KeyValue { - return c.NetSockPeerAddrKey.String(addr) -} - -func (c *netConv) SockPeerPort(port int) attribute.KeyValue { - return c.NetSockPeerPortKey.Int(port) -} - -// splitHostPort splits a network address hostport of the form "host", -// "host%zone", "[host]", "[host%zone], "host:port", "host%zone:port", -// "[host]:port", "[host%zone]:port", or ":port" into host or host%zone and -// port. -// -// An empty host is returned if it is not provided or unparsable. A negative -// port is returned if it is not provided or unparsable. -func splitHostPort(hostport string) (host string, port int) { - port = -1 - - if strings.HasPrefix(hostport, "[") { - addrEnd := strings.LastIndex(hostport, "]") - if addrEnd < 0 { - // Invalid hostport. - return - } - if i := strings.LastIndex(hostport[addrEnd:], ":"); i < 0 { - host = hostport[1:addrEnd] - return - } - } else { - if i := strings.LastIndex(hostport, ":"); i < 0 { - host = hostport - return - } - } - - host, pStr, err := net.SplitHostPort(hostport) - if err != nil { - return - } - - p, err := strconv.ParseUint(pStr, 10, 16) - if err != nil { - return - } - return host, int(p) // nolint: gosec // Bitsize checked to be 16 above. -} - -func netProtocol(proto string) (name string, version string) { - name, version, _ = strings.Cut(proto, "/") - name = strings.ToLower(name) - return name, version -} diff --git a/instrumentation/gopkg.in/macaron.v1/otelmacaron/internal/semconvutil/netconv_test.go b/instrumentation/gopkg.in/macaron.v1/otelmacaron/internal/semconvutil/netconv_test.go deleted file mode 100644 index 18be4b93d1f..00000000000 --- a/instrumentation/gopkg.in/macaron.v1/otelmacaron/internal/semconvutil/netconv_test.go +++ /dev/null @@ -1,200 +0,0 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/semconvutil/netconv_test.go.tmpl - -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package semconvutil - -import ( - "testing" - - "github.com/stretchr/testify/assert" - - "go.opentelemetry.io/otel/attribute" -) - -const ( - addr = "127.0.0.1" - port = 1834 -) - -func TestNetTransport(t *testing.T) { - transports := map[string]attribute.KeyValue{ - "tcp": attribute.String("net.transport", "ip_tcp"), - "tcp4": attribute.String("net.transport", "ip_tcp"), - "tcp6": attribute.String("net.transport", "ip_tcp"), - "udp": attribute.String("net.transport", "ip_udp"), - "udp4": attribute.String("net.transport", "ip_udp"), - "udp6": attribute.String("net.transport", "ip_udp"), - "unix": attribute.String("net.transport", "inproc"), - "unixgram": attribute.String("net.transport", "inproc"), - "unixpacket": attribute.String("net.transport", "inproc"), - "ip:1": attribute.String("net.transport", "other"), - "ip:icmp": attribute.String("net.transport", "other"), - "ip4:proto": attribute.String("net.transport", "other"), - "ip6:proto": attribute.String("net.transport", "other"), - } - - for network, want := range transports { - assert.Equal(t, want, NetTransport(network)) - } -} - -func TestNetHost(t *testing.T) { - testAddrs(t, []addrTest{ - {address: "", expected: nil}, - {address: "192.0.0.1", expected: []attribute.KeyValue{ - nc.HostName("192.0.0.1"), - }}, - {address: "192.0.0.1:9090", expected: []attribute.KeyValue{ - nc.HostName("192.0.0.1"), - nc.HostPort(9090), - }}, - }, nc.Host) -} - -func TestNetHostName(t *testing.T) { - expected := attribute.Key("net.host.name").String(addr) - assert.Equal(t, expected, nc.HostName(addr)) -} - -func TestNetHostPort(t *testing.T) { - expected := attribute.Key("net.host.port").Int(port) - assert.Equal(t, expected, nc.HostPort(port)) -} - -func TestNetPeer(t *testing.T) { - testAddrs(t, []addrTest{ - {address: "", expected: nil}, - {address: "example.com", expected: []attribute.KeyValue{ - nc.PeerName("example.com"), - }}, - {address: "/tmp/file", expected: []attribute.KeyValue{ - nc.PeerName("/tmp/file"), - }}, - {address: "192.0.0.1", expected: []attribute.KeyValue{ - nc.PeerName("192.0.0.1"), - }}, - {address: ":9090", expected: nil}, - {address: "192.0.0.1:9090", expected: []attribute.KeyValue{ - nc.PeerName("192.0.0.1"), - nc.PeerPort(9090), - }}, - }, nc.Peer) -} - -func TestNetPeerName(t *testing.T) { - expected := attribute.Key("net.peer.name").String(addr) - assert.Equal(t, expected, nc.PeerName(addr)) -} - -func TestNetPeerPort(t *testing.T) { - expected := attribute.Key("net.peer.port").Int(port) - assert.Equal(t, expected, nc.PeerPort(port)) -} - -func TestNetSockPeerName(t *testing.T) { - expected := attribute.Key("net.sock.peer.addr").String(addr) - assert.Equal(t, expected, nc.SockPeerAddr(addr)) -} - -func TestNetSockPeerPort(t *testing.T) { - expected := attribute.Key("net.sock.peer.port").Int(port) - assert.Equal(t, expected, nc.SockPeerPort(port)) -} - -func TestNetFamily(t *testing.T) { - tests := []struct { - network string - address string - expect string - }{ - {"", "", ""}, - {"unix", "", "unix"}, - {"unix", "gibberish", "unix"}, - {"unixgram", "", "unix"}, - {"unixgram", "gibberish", "unix"}, - {"unixpacket", "gibberish", "unix"}, - {"tcp", "123.0.2.8", "inet"}, - {"tcp", "gibberish", ""}, - {"", "123.0.2.8", "inet"}, - {"", "gibberish", ""}, - {"tcp", "fe80::1", "inet6"}, - {"", "fe80::1", "inet6"}, - } - - for _, test := range tests { - got := family(test.network, test.address) - assert.Equal(t, test.expect, got, test.network+"/"+test.address) - } -} - -func TestSplitHostPort(t *testing.T) { - tests := []struct { - hostport string - host string - port int - }{ - {"", "", -1}, - {":8080", "", 8080}, - {"127.0.0.1", "127.0.0.1", -1}, - {"www.example.com", "www.example.com", -1}, - {"127.0.0.1%25en0", "127.0.0.1%25en0", -1}, - {"[]", "", -1}, // Ensure this doesn't panic. - {"[fe80::1", "", -1}, - {"[fe80::1]", "fe80::1", -1}, - {"[fe80::1%25en0]", "fe80::1%25en0", -1}, - {"[fe80::1]:8080", "fe80::1", 8080}, - {"[fe80::1]::", "", -1}, // Too many colons. - {"127.0.0.1:", "127.0.0.1", -1}, - {"127.0.0.1:port", "127.0.0.1", -1}, - {"127.0.0.1:8080", "127.0.0.1", 8080}, - {"www.example.com:8080", "www.example.com", 8080}, - {"127.0.0.1%25en0:8080", "127.0.0.1%25en0", 8080}, - } - - for _, test := range tests { - h, p := splitHostPort(test.hostport) - assert.Equal(t, test.host, h, test.hostport) - assert.Equal(t, test.port, p, test.hostport) - } -} - -type addrTest struct { - address string - expected []attribute.KeyValue -} - -func testAddrs(t *testing.T, tests []addrTest, f func(string) []attribute.KeyValue) { - t.Helper() - - for _, test := range tests { - got := f(test.address) - assert.Equal(t, cap(test.expected), cap(got), "slice capacity") - assert.ElementsMatch(t, test.expected, got, test.address) - } -} - -func TestNetProtocol(t *testing.T) { - type testCase struct { - name, version string - } - tests := map[string]testCase{ - "HTTP/1.0": {name: "http", version: "1.0"}, - "HTTP/1.1": {name: "http", version: "1.1"}, - "HTTP/2": {name: "http", version: "2"}, - "HTTP/3": {name: "http", version: "3"}, - "SPDY": {name: "spdy"}, - "SPDY/2": {name: "spdy", version: "2"}, - "QUIC": {name: "quic"}, - "unknown/proto/2": {name: "unknown", version: "proto/2"}, - "other": {name: "other"}, - } - - for proto, want := range tests { - name, version := netProtocol(proto) - assert.Equal(t, want.name, name) - assert.Equal(t, want.version, version) - } -} diff --git a/instrumentation/gopkg.in/macaron.v1/otelmacaron/macaron.go b/instrumentation/gopkg.in/macaron.v1/otelmacaron/macaron.go deleted file mode 100644 index bda8143fe93..00000000000 --- a/instrumentation/gopkg.in/macaron.v1/otelmacaron/macaron.go +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package otelmacaron // import "go.opentelemetry.io/contrib/instrumentation/gopkg.in/macaron.v1/otelmacaron" - -import ( - "fmt" - "net/http" - - "gopkg.in/macaron.v1" - - "go.opentelemetry.io/contrib/instrumentation/gopkg.in/macaron.v1/otelmacaron/internal/semconvutil" - "go.opentelemetry.io/otel/propagation" - semconv "go.opentelemetry.io/otel/semconv/v1.20.0" - oteltrace "go.opentelemetry.io/otel/trace" -) - -// ScopeName is the instrumentation scope name. -const ScopeName = "go.opentelemetry.io/contrib/instrumentation/gopkg.in/macaron.v1/otelmacaron" - -// Middleware returns a macaron Handler to trace requests to the server. -func Middleware(service string, opts ...Option) macaron.Handler { - cfg := newConfig(opts) - tracer := cfg.TracerProvider.Tracer( - ScopeName, - oteltrace.WithInstrumentationVersion(Version()), - ) - return func(res http.ResponseWriter, req *http.Request, c *macaron.Context) { - savedCtx := c.Req.Request.Context() - defer func() { - c.Req.Request = c.Req.Request.WithContext(savedCtx) - }() - - ctx := cfg.Propagators.Extract(savedCtx, propagation.HeaderCarrier(c.Req.Header)) - opts := []oteltrace.SpanStartOption{ - oteltrace.WithAttributes(semconvutil.HTTPServerRequest(service, c.Req.Request)...), - oteltrace.WithSpanKind(oteltrace.SpanKindServer), - } - // TODO: span name should be router template not the actual request path, eg /user/:id vs /user/123 - spanName := c.Req.RequestURI - if spanName == "" { - spanName = fmt.Sprintf("HTTP %s route not found", c.Req.Method) - } - ctx, span := tracer.Start(ctx, spanName, opts...) - defer span.End() - - // pass the span through the request context - c.Req.Request = c.Req.Request.WithContext(ctx) - - // serve the request to the next middleware - c.Next() - - status := c.Resp.Status() - span.SetStatus(semconvutil.HTTPServerStatus(status)) - if status > 0 { - span.SetAttributes(semconv.HTTPStatusCode(status)) - } - } -} diff --git a/instrumentation/gopkg.in/macaron.v1/otelmacaron/macaron_test.go b/instrumentation/gopkg.in/macaron.v1/otelmacaron/macaron_test.go deleted file mode 100644 index 19ca93a6d5f..00000000000 --- a/instrumentation/gopkg.in/macaron.v1/otelmacaron/macaron_test.go +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package otelmacaron - -import ( - "context" - "net/http" - "net/http/httptest" - "testing" - - "github.com/stretchr/testify/assert" - "gopkg.in/macaron.v1" - - b3prop "go.opentelemetry.io/contrib/propagators/b3" - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/propagation" - oteltrace "go.opentelemetry.io/otel/trace" - "go.opentelemetry.io/otel/trace/noop" -) - -func TestGetSpanNotInstrumented(t *testing.T) { - m := macaron.Classic() - m.Get("/user/:id", func(ctx *macaron.Context) { - span := oteltrace.SpanFromContext(ctx.Req.Request.Context()) - ok := !span.SpanContext().IsValid() - assert.True(t, ok) - ctx.Resp.WriteHeader(http.StatusOK) - }) - - r := httptest.NewRequest("GET", "/user/123", nil) - w := httptest.NewRecorder() - - m.ServeHTTP(w, r) -} - -func TestPropagationWithGlobalPropagators(t *testing.T) { - tracer := noop.NewTracerProvider().Tracer("test-tracer") - otel.SetTextMapPropagator(propagation.TraceContext{}) - otel.SetTracerProvider(noop.NewTracerProvider()) - - r := httptest.NewRequest("GET", "/user/123", nil) - w := httptest.NewRecorder() - - ctx := context.Background() - sc := oteltrace.NewSpanContext(oteltrace.SpanContextConfig{ - TraceID: oteltrace.TraceID{0x01}, - SpanID: oteltrace.SpanID{0x01}, - }) - ctx = oteltrace.ContextWithRemoteSpanContext(ctx, sc) - ctx, _ = tracer.Start(ctx, "test") - otel.GetTextMapPropagator().Inject(ctx, propagation.HeaderCarrier(r.Header)) - - m := macaron.Classic() - m.Use(Middleware("foobar")) - m.Get("/user/:id", func(ctx *macaron.Context) { - span := oteltrace.SpanFromContext(ctx.Req.Request.Context()) - assert.Equal(t, sc.TraceID(), span.SpanContext().TraceID()) - assert.Equal(t, sc.SpanID(), span.SpanContext().SpanID()) - ctx.Resp.WriteHeader(http.StatusOK) - }) - - m.ServeHTTP(w, r) -} - -func TestPropagationWithCustomPropagators(t *testing.T) { - tp := noop.NewTracerProvider() - otel.SetTracerProvider(tp) - tracer := tp.Tracer("test-tracer") - b3 := b3prop.New() - - r := httptest.NewRequest("GET", "/user/123", nil) - w := httptest.NewRecorder() - - ctx := context.Background() - sc := oteltrace.NewSpanContext(oteltrace.SpanContextConfig{ - TraceID: oteltrace.TraceID{0x01}, - SpanID: oteltrace.SpanID{0x01}, - }) - ctx = oteltrace.ContextWithRemoteSpanContext(ctx, sc) - ctx, _ = tracer.Start(ctx, "test") - b3.Inject(ctx, propagation.HeaderCarrier(r.Header)) - - m := macaron.Classic() - m.Use(Middleware("foobar", WithTracerProvider(tp), WithPropagators(b3))) - m.Get("/user/:id", func(ctx *macaron.Context) { - span := oteltrace.SpanFromContext(ctx.Req.Request.Context()) - assert.Equal(t, sc.TraceID(), span.SpanContext().TraceID()) - assert.Equal(t, sc.SpanID(), span.SpanContext().SpanID()) - ctx.Resp.WriteHeader(http.StatusOK) - }) - - m.ServeHTTP(w, r) -} diff --git a/instrumentation/gopkg.in/macaron.v1/otelmacaron/test/doc.go b/instrumentation/gopkg.in/macaron.v1/otelmacaron/test/doc.go deleted file mode 100644 index 164dc13b34f..00000000000 --- a/instrumentation/gopkg.in/macaron.v1/otelmacaron/test/doc.go +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -/* -Package test validates the otelmacaron instrumentation with the default SDK. - -This package is in a separate module from the instrumentation it tests to -isolate the dependency of the default SDK and not impose this as a transitive -dependency for users. - -Deprecated: otelmacaron has no Code Owner. -After August 21, 2024, it may no longer be supported and may stop -receiving new releases unless a new Code Owner is found. See -[this issue] if you would like to become the Code Owner of this module. - -[this issue]: https://github.com/open-telemetry/opentelemetry-go-contrib/issues/5552 -*/ -package test // import "go.opentelemetry.io/contrib/instrumentation/gopkg.in/macaron.v1/otelmacaron/test" diff --git a/instrumentation/gopkg.in/macaron.v1/otelmacaron/test/go.mod b/instrumentation/gopkg.in/macaron.v1/otelmacaron/test/go.mod deleted file mode 100644 index 66d9a4406b8..00000000000 --- a/instrumentation/gopkg.in/macaron.v1/otelmacaron/test/go.mod +++ /dev/null @@ -1,33 +0,0 @@ -// Deprecated: otelmacaron has no Code Owner. -module go.opentelemetry.io/contrib/instrumentation/gopkg.in/macaron.v1/otelmacaron/test - -go 1.22 - -require ( - github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/contrib/instrumentation/gopkg.in/macaron.v1/otelmacaron v0.55.0 - go.opentelemetry.io/otel v1.30.0 - go.opentelemetry.io/otel/sdk v1.30.0 - go.opentelemetry.io/otel/trace v1.30.0 - gopkg.in/macaron.v1 v1.5.0 -) - -require ( - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.4.2 // indirect - github.com/go-logr/stdr v1.2.2 // indirect - github.com/go-macaron/inject v0.0.0-20200308113650-138e5925c53b // indirect - github.com/google/uuid v1.6.0 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/unknwon/com v1.0.1 // indirect - go.opentelemetry.io/otel/metric v1.30.0 // indirect - golang.org/x/crypto v0.28.0 // indirect - golang.org/x/sys v0.26.0 // indirect - gopkg.in/ini.v1 v1.67.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect -) - -replace ( - go.opentelemetry.io/contrib/instrumentation/gopkg.in/macaron.v1/otelmacaron => ../ - go.opentelemetry.io/contrib/propagators/b3 => ../../../../../propagators/b3 -) diff --git a/instrumentation/gopkg.in/macaron.v1/otelmacaron/test/go.sum b/instrumentation/gopkg.in/macaron.v1/otelmacaron/test/go.sum deleted file mode 100644 index ed49b21ad2d..00000000000 --- a/instrumentation/gopkg.in/macaron.v1/otelmacaron/test/go.sum +++ /dev/null @@ -1,51 +0,0 @@ -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= -github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-macaron/inject v0.0.0-20200308113650-138e5925c53b h1:/aWj44HoEycE4MDi2HZf4t+XI7hKwZRltZf4ih5tB2c= -github.com/go-macaron/inject v0.0.0-20200308113650-138e5925c53b/go.mod h1:VFI2o2q9kYsC4o7VP1HrEVosiZZTd+MVT3YZx4gqvJw= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gopherjs/gopherjs v0.0.0-20190430165422-3e4dfb77656c h1:7lF+Vz0LqiRidnzC1Oq86fpX1q/iEv2KJdrCtttYjT4= -github.com/gopherjs/gopherjs v0.0.0-20190430165422-3e4dfb77656c/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= -github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= -github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/smartystreets/assertions v0.0.0-20190116191733-b6c0e53d7304/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/assertions v1.0.1 h1:voD4ITNjPL5jjBfgR/r8fPIIBrliWrWHeiJApdr3r4w= -github.com/smartystreets/assertions v1.0.1/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM= -github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s= -github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337 h1:WN9BUFbdyOsSH/XohnWpXOlq9NBD5sGAB2FciQMUEe8= -github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/unknwon/com v1.0.1 h1:3d1LTxD+Lnf3soQiD4Cp/0BRB+Rsa/+RTvz8GMMzIXs= -github.com/unknwon/com v1.0.1/go.mod h1:tOOxU81rwgoCLoOVVPHb6T/wt8HZygqH5id+GNnlCXM= -go.opentelemetry.io/otel v1.30.0 h1:F2t8sK4qf1fAmY9ua4ohFS/K+FUuOPemHUIXHtktrts= -go.opentelemetry.io/otel v1.30.0/go.mod h1:tFw4Br9b7fOS+uEao81PJjVMjW/5fvNCbpsDIXqP0pc= -go.opentelemetry.io/otel/metric v1.30.0 h1:4xNulvn9gjzo4hjg+wzIKG7iNFEaBMX00Qd4QIZs7+w= -go.opentelemetry.io/otel/metric v1.30.0/go.mod h1:aXTfST94tswhWEb+5QjlSqG+cZlmyXy/u8jFpor3WqQ= -go.opentelemetry.io/otel/sdk v1.30.0 h1:cHdik6irO49R5IysVhdn8oaiR9m8XluDaJAs4DfOrYE= -go.opentelemetry.io/otel/sdk v1.30.0/go.mod h1:p14X4Ok8S+sygzblytT1nqG98QG2KYKv++HE0LY/mhg= -go.opentelemetry.io/otel/trace v1.30.0 h1:7UBkkYzeg3C7kQX8VAidWh2biiQbtAKjyIML8dQ9wmc= -go.opentelemetry.io/otel/trace v1.30.0/go.mod h1:5EyKqTzzmyqB9bwtCCq6pDLktPK6fmGf/Dph+8VI02o= -golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= -golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= -golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= -golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= -gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/macaron.v1 v1.5.0 h1:/dXJaeQagWLjVjCrKH8dgSSU7yG4qTv6rBKpqhYaCyc= -gopkg.in/macaron.v1 v1.5.0/go.mod h1:sAYUd2r8Q+jLnCN4/ZmdAYHzQn67agV5sAqKFQgrRrw= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/instrumentation/gopkg.in/macaron.v1/otelmacaron/test/macaron_test.go b/instrumentation/gopkg.in/macaron.v1/otelmacaron/test/macaron_test.go deleted file mode 100644 index 825a9f1dc5d..00000000000 --- a/instrumentation/gopkg.in/macaron.v1/otelmacaron/test/macaron_test.go +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package test - -import ( - "net/http" - "net/http/httptest" - "strconv" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "gopkg.in/macaron.v1" - - "go.opentelemetry.io/contrib/instrumentation/gopkg.in/macaron.v1/otelmacaron" // nolint:staticcheck // deprecated. - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/sdk/trace" - "go.opentelemetry.io/otel/sdk/trace/tracetest" - oteltrace "go.opentelemetry.io/otel/trace" -) - -func TestChildSpanFromGlobalTracer(t *testing.T) { - sr := tracetest.NewSpanRecorder() - tp := trace.NewTracerProvider(trace.WithSpanProcessor(sr)) - otel.SetTracerProvider(tp) - - m := macaron.Classic() - m.Use(otelmacaron.Middleware("foobar")) - m.Get("/user/:id", func(ctx *macaron.Context) { - ctx.Resp.WriteHeader(http.StatusOK) - }) - - r := httptest.NewRequest("GET", "/user/123", nil) - w := httptest.NewRecorder() - - m.ServeHTTP(w, r) - - assert.Len(t, sr.Ended(), 1) -} - -func TestChildSpanNames(t *testing.T) { - sr := tracetest.NewSpanRecorder() - tp := trace.NewTracerProvider(trace.WithSpanProcessor(sr)) - - m := macaron.Classic() - m.Use(otelmacaron.Middleware("foobar", otelmacaron.WithTracerProvider(tp))) - m.Get("/user/:id", func(ctx *macaron.Context) { - ctx.Resp.WriteHeader(http.StatusOK) - }) - m.Get("/book/:title", func(ctx *macaron.Context) { - _, err := ctx.Resp.Write(([]byte)("ok")) - if err != nil { - t.Error(err) - } - }) - - r := httptest.NewRequest("GET", "/user/123", nil) - w := httptest.NewRecorder() - m.ServeHTTP(w, r) - - r = httptest.NewRequest("GET", "/book/foo", nil) - w = httptest.NewRecorder() - m.ServeHTTP(w, r) - - spans := sr.Ended() - require.Len(t, spans, 2) - span := spans[0] - assert.Equal(t, "/user/123", span.Name()) // TODO: span name should show router template, eg /user/:id - assert.Equal(t, oteltrace.SpanKindServer, span.SpanKind()) - attrs := span.Attributes() - assert.Contains(t, attrs, attribute.String("net.host.name", "foobar")) - assert.Contains(t, attrs, attribute.Int("http.status_code", http.StatusOK)) - assert.Contains(t, attrs, attribute.String("http.method", "GET")) - - span = spans[1] - assert.Equal(t, "/book/foo", span.Name()) // TODO: span name should show router template, eg /book/:title - assert.Equal(t, oteltrace.SpanKindServer, span.SpanKind()) - attrs = span.Attributes() - assert.Contains(t, attrs, attribute.String("net.host.name", "foobar")) - assert.Contains(t, attrs, attribute.Int("http.status_code", http.StatusOK)) - assert.Contains(t, attrs, attribute.String("http.method", "GET")) -} - -func TestSpanStatus(t *testing.T) { - testCases := []struct { - httpStatusCode int - wantSpanStatus codes.Code - }{ - {http.StatusOK, codes.Unset}, - {http.StatusBadRequest, codes.Unset}, - {http.StatusInternalServerError, codes.Error}, - } - for _, tc := range testCases { - t.Run(strconv.Itoa(tc.httpStatusCode), func(t *testing.T) { - sr := tracetest.NewSpanRecorder() - provider := trace.NewTracerProvider() - provider.RegisterSpanProcessor(sr) - m := macaron.Classic() - m.Use(otelmacaron.Middleware("foobar", otelmacaron.WithTracerProvider(provider))) - m.Get("/", func(ctx *macaron.Context) { - ctx.Resp.WriteHeader(tc.httpStatusCode) - }) - - m.ServeHTTP(httptest.NewRecorder(), httptest.NewRequest("GET", "/", nil)) - - require.Len(t, sr.Ended(), 1, "should emit a span") - assert.Equal(t, tc.wantSpanStatus, sr.Ended()[0].Status().Code, "should only set Error status for HTTP statuses >= 500") - }) - } -} diff --git a/instrumentation/gopkg.in/macaron.v1/otelmacaron/test/version.go b/instrumentation/gopkg.in/macaron.v1/otelmacaron/test/version.go deleted file mode 100644 index 55a551c7c4c..00000000000 --- a/instrumentation/gopkg.in/macaron.v1/otelmacaron/test/version.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package test // import "go.opentelemetry.io/contrib/instrumentation/gopkg.in/macaron.v1/otelmacaron/test" - -// Version is the current release version of the macron instrumentation test module. -func Version() string { - return "0.55.0" - // This string is updated by the pre_release.sh script during release -} - -// SemVersion is the semantic version to be supplied to tracer/meter creation. -// -// Deprecated: Use [Version] instead. -func SemVersion() string { - return Version() -} diff --git a/instrumentation/gopkg.in/macaron.v1/otelmacaron/version.go b/instrumentation/gopkg.in/macaron.v1/otelmacaron/version.go deleted file mode 100644 index 156800b6313..00000000000 --- a/instrumentation/gopkg.in/macaron.v1/otelmacaron/version.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package otelmacaron // import "go.opentelemetry.io/contrib/instrumentation/gopkg.in/macaron.v1/otelmacaron" - -// Version is the current release version of the macron instrumentation. -func Version() string { - return "0.55.0" - // This string is updated by the pre_release.sh script during release -} - -// SemVersion is the semantic version to be supplied to tracer/meter creation. -// -// Deprecated: Use [Version] instead. -func SemVersion() string { - return Version() -} diff --git a/instrumentation/net/http/otelhttp/common.go b/instrumentation/net/http/otelhttp/common.go index 5d6e6156b7b..a83a026274a 100644 --- a/instrumentation/net/http/otelhttp/common.go +++ b/instrumentation/net/http/otelhttp/common.go @@ -18,13 +18,6 @@ const ( WriteErrorKey = attribute.Key("http.write_error") // if an error occurred while writing a reply, the string of the error (io.EOF is not recorded) ) -// Client HTTP metrics. -const ( - clientRequestSize = "http.client.request.size" // Outgoing request bytes total - clientResponseSize = "http.client.response.size" // Outgoing response bytes total - clientDuration = "http.client.duration" // Outgoing end to end duration, milliseconds -) - // Filter is a predicate used to determine whether a given http.request should // be traced. A Filter must return true if the request should be traced. type Filter func(*http.Request) bool diff --git a/instrumentation/net/http/otelhttp/handler.go b/instrumentation/net/http/otelhttp/handler.go index 33580a35b77..e4236ab398c 100644 --- a/instrumentation/net/http/otelhttp/handler.go +++ b/instrumentation/net/http/otelhttp/handler.go @@ -81,12 +81,6 @@ func (h *middleware) configure(c *config) { h.semconv = semconv.NewHTTPServer(c.Meter) } -func handleErr(err error) { - if err != nil { - otel.Handle(err) - } -} - // serveHTTP sets up tracing and calls the given next http.Handler with the span // context injected into the request context. func (h *middleware) serveHTTP(w http.ResponseWriter, r *http.Request, next http.Handler) { @@ -190,14 +184,18 @@ func (h *middleware) serveHTTP(w http.ResponseWriter, r *http.Request, next http // Use floating point division here for higher precision (instead of Millisecond method). elapsedTime := float64(time.Since(requestStartTime)) / float64(time.Millisecond) - h.semconv.RecordMetrics(ctx, semconv.MetricData{ - ServerName: h.server, - Req: r, - StatusCode: statusCode, - AdditionalAttributes: labeler.Get(), - RequestSize: bw.BytesRead(), - ResponseSize: bytesWritten, - ElapsedTime: elapsedTime, + h.semconv.RecordMetrics(ctx, semconv.ServerMetricData{ + ServerName: h.server, + ResponseSize: bytesWritten, + MetricAttributes: semconv.MetricAttributes{ + Req: r, + StatusCode: statusCode, + AdditionalAttributes: labeler.Get(), + }, + MetricData: semconv.MetricData{ + RequestSize: bw.BytesRead(), + ElapsedTime: elapsedTime, + }, }) } diff --git a/instrumentation/net/http/otelhttp/internal/semconv/env.go b/instrumentation/net/http/otelhttp/internal/semconv/env.go index 9cae4cab86a..fb893b25042 100644 --- a/instrumentation/net/http/otelhttp/internal/semconv/env.go +++ b/instrumentation/net/http/otelhttp/internal/semconv/env.go @@ -83,18 +83,26 @@ func (s HTTPServer) Status(code int) (codes.Code, string) { return codes.Unset, "" } -type MetricData struct { - ServerName string +type ServerMetricData struct { + ServerName string + ResponseSize int64 + + MetricData + MetricAttributes +} + +type MetricAttributes struct { Req *http.Request StatusCode int AdditionalAttributes []attribute.KeyValue +} - RequestSize int64 - ResponseSize int64 - ElapsedTime float64 +type MetricData struct { + RequestSize int64 + ElapsedTime float64 } -func (s HTTPServer) RecordMetrics(ctx context.Context, md MetricData) { +func (s HTTPServer) RecordMetrics(ctx context.Context, md ServerMetricData) { if s.requestBytesCounter == nil || s.responseBytesCounter == nil || s.serverLatencyMeasure == nil { // This will happen if an HTTPServer{} is used insted of NewHTTPServer. return @@ -102,7 +110,7 @@ func (s HTTPServer) RecordMetrics(ctx context.Context, md MetricData) { attributes := oldHTTPServer{}.MetricAttributes(md.ServerName, md.Req, md.StatusCode, md.AdditionalAttributes) o := metric.WithAttributeSet(attribute.NewSet(attributes...)) - addOpts := []metric.AddOption{o} // Allocate vararg slice once. + addOpts := []metric.AddOption{o} s.requestBytesCounter.Add(ctx, md.RequestSize, addOpts...) s.responseBytesCounter.Add(ctx, md.ResponseSize, addOpts...) s.serverLatencyMeasure.Record(ctx, md.ElapsedTime, o) @@ -122,11 +130,20 @@ func NewHTTPServer(meter metric.Meter) HTTPServer { type HTTPClient struct { duplicate bool + + // old metrics + requestBytesCounter metric.Int64Counter + responseBytesCounter metric.Int64Counter + latencyMeasure metric.Float64Histogram } -func NewHTTPClient() HTTPClient { +func NewHTTPClient(meter metric.Meter) HTTPClient { env := strings.ToLower(os.Getenv("OTEL_SEMCONV_STABILITY_OPT_IN")) - return HTTPClient{duplicate: env == "http/dup"} + client := HTTPClient{ + duplicate: env == "http/dup", + } + client.requestBytesCounter, client.responseBytesCounter, client.latencyMeasure = oldHTTPClient{}.createMeasures(meter) + return client } // RequestTraceAttrs returns attributes for an HTTP request made by a client. @@ -163,3 +180,48 @@ func (c HTTPClient) ErrorType(err error) attribute.KeyValue { return attribute.KeyValue{} } + +type MetricOpts struct { + measurement metric.MeasurementOption + addOptions metric.AddOption +} + +func (o MetricOpts) MeasurementOption() metric.MeasurementOption { + return o.measurement +} + +func (o MetricOpts) AddOptions() metric.AddOption { + return o.addOptions +} + +func (c HTTPClient) MetricOptions(ma MetricAttributes) MetricOpts { + attributes := oldHTTPClient{}.MetricAttributes(ma.Req, ma.StatusCode, ma.AdditionalAttributes) + // TODO: Duplicate Metrics + set := metric.WithAttributeSet(attribute.NewSet(attributes...)) + return MetricOpts{ + measurement: set, + addOptions: set, + } +} + +func (s HTTPClient) RecordMetrics(ctx context.Context, md MetricData, opts MetricOpts) { + if s.requestBytesCounter == nil || s.latencyMeasure == nil { + // This will happen if an HTTPClient{} is used insted of NewHTTPClient(). + return + } + + s.requestBytesCounter.Add(ctx, md.RequestSize, opts.AddOptions()) + s.latencyMeasure.Record(ctx, md.ElapsedTime, opts.MeasurementOption()) + + // TODO: Duplicate Metrics +} + +func (s HTTPClient) RecordResponseSize(ctx context.Context, responseData int64, opts metric.AddOption) { + if s.responseBytesCounter == nil { + // This will happen if an HTTPClient{} is used insted of NewHTTPClient(). + return + } + + s.responseBytesCounter.Add(ctx, responseData, opts) + // TODO: Duplicate Metrics +} diff --git a/instrumentation/net/http/otelhttp/internal/semconv/env_test.go b/instrumentation/net/http/otelhttp/internal/semconv/env_test.go index 5f4a3e391d6..3a02a777373 100644 --- a/instrumentation/net/http/otelhttp/internal/semconv/env_test.go +++ b/instrumentation/net/http/otelhttp/internal/semconv/env_test.go @@ -42,10 +42,53 @@ func TestHTTPServerDoesNotPanic(t *testing.T) { _ = tt.server.RequestTraceAttrs("stuff", req) _ = tt.server.ResponseTraceAttrs(ResponseTelemetry{StatusCode: 200}) - tt.server.RecordMetrics(context.Background(), MetricData{ + tt.server.RecordMetrics(context.Background(), ServerMetricData{ ServerName: "stuff", + MetricAttributes: MetricAttributes{ + Req: req, + }, + }) + }) + }) + } +} + +func TestHTTPClientDoesNotPanic(t *testing.T) { + testCases := []struct { + name string + client HTTPClient + }{ + { + name: "empty", + client: HTTPClient{}, + }, + { + name: "nil meter", + client: NewHTTPClient(nil), + }, + { + name: "with Meter", + client: NewHTTPClient(noop.Meter{}), + }, + } + for _, tt := range testCases { + t.Run(tt.name, func(t *testing.T) { + require.NotPanics(t, func() { + req, err := http.NewRequest("GET", "http://example.com", nil) + require.NoError(t, err) + + _ = tt.client.RequestTraceAttrs(req) + _ = tt.client.ResponseTraceAttrs(&http.Response{StatusCode: 200}) + + opts := tt.client.MetricOptions(MetricAttributes{ Req: req, + StatusCode: 200, }) + tt.client.RecordResponseSize(context.Background(), 40, opts.AddOptions()) + tt.client.RecordMetrics(context.Background(), MetricData{ + RequestSize: 20, + ElapsedTime: 1, + }, opts) }) }) } @@ -81,3 +124,11 @@ func NewTestHTTPServer() HTTPServer { serverLatencyMeasure: &testInst{}, } } + +func NewTestHTTPClient() HTTPClient { + return HTTPClient{ + requestBytesCounter: &testInst{}, + responseBytesCounter: &testInst{}, + latencyMeasure: &testInst{}, + } +} diff --git a/instrumentation/net/http/otelhttp/internal/semconv/httpconv_test.go b/instrumentation/net/http/otelhttp/internal/semconv/httpconv_test.go index 91a499b07bc..6a3f6c09a4f 100644 --- a/instrumentation/net/http/otelhttp/internal/semconv/httpconv_test.go +++ b/instrumentation/net/http/otelhttp/internal/semconv/httpconv_test.go @@ -151,7 +151,7 @@ func TestNewTraceRequest_Client(t *testing.T) { attribute.String("user_agent.original", "go-test-agent"), attribute.Int("http.request_content_length", 13), } - client := NewHTTPClient() + client := NewHTTPClient(nil) assert.ElementsMatch(t, want, client.RequestTraceAttrs(req)) } @@ -166,7 +166,7 @@ func TestNewTraceResponse_Client(t *testing.T) { } for _, tt := range testcases { - client := NewHTTPClient() + client := NewHTTPClient(nil) assert.ElementsMatch(t, tt.want, client.ResponseTraceAttrs(&tt.resp)) } } diff --git a/instrumentation/net/http/otelhttp/internal/semconv/v1.20.0.go b/instrumentation/net/http/otelhttp/internal/semconv/v1.20.0.go index c999b05e675..5367732ec5d 100644 --- a/instrumentation/net/http/otelhttp/internal/semconv/v1.20.0.go +++ b/instrumentation/net/http/otelhttp/internal/semconv/v1.20.0.go @@ -144,7 +144,7 @@ func (o oldHTTPServer) MetricAttributes(server string, req *http.Request, status attributes := slices.Grow(additionalAttributes, n) attributes = append(attributes, - o.methodMetric(req.Method), + standardizeHTTPMethodMetric(req.Method), o.scheme(req.TLS != nil), semconv.NetHostName(host)) @@ -164,16 +164,6 @@ func (o oldHTTPServer) MetricAttributes(server string, req *http.Request, status return attributes } -func (o oldHTTPServer) methodMetric(method string) attribute.KeyValue { - method = strings.ToUpper(method) - switch method { - case http.MethodConnect, http.MethodDelete, http.MethodGet, http.MethodHead, http.MethodOptions, http.MethodPatch, http.MethodPost, http.MethodPut, http.MethodTrace: - default: - method = "_OTHER" - } - return semconv.HTTPMethod(method) -} - func (o oldHTTPServer) scheme(https bool) attribute.KeyValue { // nolint:revive if https { return semconv.HTTPSchemeHTTPS @@ -190,3 +180,95 @@ func (o oldHTTPClient) RequestTraceAttrs(req *http.Request) []attribute.KeyValue func (o oldHTTPClient) ResponseTraceAttrs(resp *http.Response) []attribute.KeyValue { return semconvutil.HTTPClientResponse(resp) } + +func (o oldHTTPClient) MetricAttributes(req *http.Request, statusCode int, additionalAttributes []attribute.KeyValue) []attribute.KeyValue { + /* The following semantic conventions are returned if present: + http.method string + http.status_code int + net.peer.name string + net.peer.port int + */ + + n := 2 // method, peer name. + var h string + if req.URL != nil { + h = req.URL.Host + } + var requestHost string + var requestPort int + for _, hostport := range []string{h, req.Header.Get("Host")} { + requestHost, requestPort = splitHostPort(hostport) + if requestHost != "" || requestPort > 0 { + break + } + } + + port := requiredHTTPPort(req.URL != nil && req.URL.Scheme == "https", requestPort) + if port > 0 { + n++ + } + + if statusCode > 0 { + n++ + } + + attributes := slices.Grow(additionalAttributes, n) + attributes = append(attributes, + standardizeHTTPMethodMetric(req.Method), + semconv.NetPeerName(requestHost), + ) + + if port > 0 { + attributes = append(attributes, semconv.NetPeerPort(port)) + } + + if statusCode > 0 { + attributes = append(attributes, semconv.HTTPStatusCode(statusCode)) + } + return attributes +} + +// Client HTTP metrics. +const ( + clientRequestSize = "http.client.request.size" // Incoming request bytes total + clientResponseSize = "http.client.response.size" // Incoming response bytes total + clientDuration = "http.client.duration" // Incoming end to end duration, milliseconds +) + +func (o oldHTTPClient) createMeasures(meter metric.Meter) (metric.Int64Counter, metric.Int64Counter, metric.Float64Histogram) { + if meter == nil { + return noop.Int64Counter{}, noop.Int64Counter{}, noop.Float64Histogram{} + } + requestBytesCounter, err := meter.Int64Counter( + clientRequestSize, + metric.WithUnit("By"), + metric.WithDescription("Measures the size of HTTP request messages."), + ) + handleErr(err) + + responseBytesCounter, err := meter.Int64Counter( + clientResponseSize, + metric.WithUnit("By"), + metric.WithDescription("Measures the size of HTTP response messages."), + ) + handleErr(err) + + latencyMeasure, err := meter.Float64Histogram( + clientDuration, + metric.WithUnit("ms"), + metric.WithDescription("Measures the duration of outbound HTTP requests."), + ) + handleErr(err) + + return requestBytesCounter, responseBytesCounter, latencyMeasure +} + +func standardizeHTTPMethodMetric(method string) attribute.KeyValue { + method = strings.ToUpper(method) + switch method { + case http.MethodConnect, http.MethodDelete, http.MethodGet, http.MethodHead, http.MethodOptions, http.MethodPatch, http.MethodPost, http.MethodPut, http.MethodTrace: + default: + method = "_OTHER" + } + return semconv.HTTPMethod(method) +} diff --git a/instrumentation/net/http/otelhttp/internal/semconv/v1.20.0_test.go b/instrumentation/net/http/otelhttp/internal/semconv/v1.20.0_test.go index a35033f49c1..eef382a5047 100644 --- a/instrumentation/net/http/otelhttp/internal/semconv/v1.20.0_test.go +++ b/instrumentation/net/http/otelhttp/internal/semconv/v1.20.0_test.go @@ -92,17 +92,20 @@ func TestV120RecordMetrics(t *testing.T) { req, err := http.NewRequest("POST", "http://example.com", nil) assert.NoError(t, err) - server.RecordMetrics(context.Background(), MetricData{ - ServerName: "stuff", - Req: req, - StatusCode: 301, - AdditionalAttributes: []attribute.KeyValue{ - attribute.String("key", "value"), - }, - - RequestSize: 100, + server.RecordMetrics(context.Background(), ServerMetricData{ + ServerName: "stuff", ResponseSize: 200, - ElapsedTime: 300, + MetricAttributes: MetricAttributes{ + Req: req, + StatusCode: 301, + AdditionalAttributes: []attribute.KeyValue{ + attribute.String("key", "value"), + }, + }, + MetricData: MetricData{ + RequestSize: 100, + ElapsedTime: 300, + }, }) assert.Equal(t, int64(100), server.requestBytesCounter.(*testInst).intValue) @@ -157,3 +160,95 @@ func TestV120ClientResponse(t *testing.T) { got := oldHTTPClient{}.ResponseTraceAttrs(&resp) assert.ElementsMatch(t, want, got) } + +func TestV120ClientMetrics(t *testing.T) { + client := NewTestHTTPClient() + req, err := http.NewRequest("POST", "http://example.com", nil) + assert.NoError(t, err) + + opts := client.MetricOptions(MetricAttributes{ + Req: req, + StatusCode: 301, + AdditionalAttributes: []attribute.KeyValue{ + attribute.String("key", "value"), + }, + }) + + ctx := context.Background() + + client.RecordResponseSize(ctx, 200, opts.AddOptions()) + + client.RecordMetrics(ctx, MetricData{ + RequestSize: 100, + ElapsedTime: 300, + }, opts) + + assert.Equal(t, int64(100), client.requestBytesCounter.(*testInst).intValue) + assert.Equal(t, int64(200), client.responseBytesCounter.(*testInst).intValue) + assert.Equal(t, float64(300), client.latencyMeasure.(*testInst).floatValue) + + want := []attribute.KeyValue{ + attribute.String("http.method", "POST"), + attribute.Int64("http.status_code", 301), + attribute.String("key", "value"), + attribute.String("net.peer.name", "example.com"), + } + + assert.ElementsMatch(t, want, client.requestBytesCounter.(*testInst).attributes) + assert.ElementsMatch(t, want, client.responseBytesCounter.(*testInst).attributes) + assert.ElementsMatch(t, want, client.latencyMeasure.(*testInst).attributes) +} + +func TestStandardizeHTTPMethodMetric(t *testing.T) { + testCases := []struct { + method string + want attribute.KeyValue + }{ + { + method: "GET", + want: attribute.String("http.method", "GET"), + }, + { + method: "POST", + want: attribute.String("http.method", "POST"), + }, + { + method: "PUT", + want: attribute.String("http.method", "PUT"), + }, + { + method: "DELETE", + want: attribute.String("http.method", "DELETE"), + }, + { + method: "HEAD", + want: attribute.String("http.method", "HEAD"), + }, + { + method: "OPTIONS", + want: attribute.String("http.method", "OPTIONS"), + }, + { + method: "CONNECT", + want: attribute.String("http.method", "CONNECT"), + }, + { + method: "TRACE", + want: attribute.String("http.method", "TRACE"), + }, + { + method: "PATCH", + want: attribute.String("http.method", "PATCH"), + }, + { + method: "test", + want: attribute.String("http.method", "_OTHER"), + }, + } + for _, tt := range testCases { + t.Run(tt.method, func(t *testing.T) { + got := standardizeHTTPMethodMetric(tt.method) + assert.Equal(t, tt.want, got) + }) + } +} diff --git a/instrumentation/net/http/otelhttp/transport.go b/instrumentation/net/http/otelhttp/transport.go index cc918367511..39681ad4b09 100644 --- a/instrumentation/net/http/otelhttp/transport.go +++ b/instrumentation/net/http/otelhttp/transport.go @@ -13,11 +13,9 @@ import ( "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/request" "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv" - "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" @@ -29,7 +27,6 @@ type Transport struct { rt http.RoundTripper tracer trace.Tracer - meter metric.Meter propagators propagation.TextMapPropagator spanStartOptions []trace.SpanStartOption filters []Filter @@ -37,10 +34,7 @@ type Transport struct { clientTrace func(context.Context) *httptrace.ClientTrace metricAttributesFn func(*http.Request) []attribute.KeyValue - semconv semconv.HTTPClient - requestBytesCounter metric.Int64Counter - responseBytesCounter metric.Int64Counter - latencyMeasure metric.Float64Histogram + semconv semconv.HTTPClient } var _ http.RoundTripper = &Transport{} @@ -57,8 +51,7 @@ func NewTransport(base http.RoundTripper, opts ...Option) *Transport { } t := Transport{ - rt: base, - semconv: semconv.NewHTTPClient(), + rt: base, } defaultOpts := []Option{ @@ -68,46 +61,21 @@ func NewTransport(base http.RoundTripper, opts ...Option) *Transport { c := newConfig(append(defaultOpts, opts...)...) t.applyConfig(c) - t.createMeasures() return &t } func (t *Transport) applyConfig(c *config) { t.tracer = c.Tracer - t.meter = c.Meter t.propagators = c.Propagators t.spanStartOptions = c.SpanStartOptions t.filters = c.Filters t.spanNameFormatter = c.SpanNameFormatter t.clientTrace = c.ClientTrace + t.semconv = semconv.NewHTTPClient(c.Meter) t.metricAttributesFn = c.MetricAttributesFn } -func (t *Transport) createMeasures() { - var err error - t.requestBytesCounter, err = t.meter.Int64Counter( - clientRequestSize, - metric.WithUnit("By"), - metric.WithDescription("Measures the size of HTTP request messages."), - ) - handleErr(err) - - t.responseBytesCounter, err = t.meter.Int64Counter( - clientResponseSize, - metric.WithUnit("By"), - metric.WithDescription("Measures the size of HTTP response messages."), - ) - handleErr(err) - - t.latencyMeasure, err = t.meter.Float64Histogram( - clientDuration, - metric.WithUnit("ms"), - metric.WithDescription("Measures the duration of outbound HTTP requests."), - ) - handleErr(err) -} - func defaultTransportFormatter(_ string, r *http.Request) string { return "HTTP " + r.Method } @@ -177,16 +145,15 @@ func (t *Transport) RoundTrip(r *http.Request) (*http.Response, error) { } // metrics - metricAttrs := append(append(labeler.Get(), semconvutil.HTTPClientRequestMetrics(r)...), t.metricAttributesFromRequest(r)...) - if res.StatusCode > 0 { - metricAttrs = append(metricAttrs, semconv.HTTPStatusCode(res.StatusCode)) - } - o := metric.WithAttributeSet(attribute.NewSet(metricAttrs...)) + metricOpts := t.semconv.MetricOptions(semconv.MetricAttributes{ + Req: r, + StatusCode: res.StatusCode, + AdditionalAttributes: append(labeler.Get(), t.metricAttributesFromRequest(r)...), + }) - t.requestBytesCounter.Add(ctx, bw.BytesRead(), o) // For handling response bytes we leverage a callback when the client reads the http response readRecordFunc := func(n int64) { - t.responseBytesCounter.Add(ctx, n, o) + t.semconv.RecordResponseSize(ctx, n, metricOpts.AddOptions()) } // traces @@ -198,7 +165,10 @@ func (t *Transport) RoundTrip(r *http.Request) (*http.Response, error) { // Use floating point division here for higher precision (instead of Millisecond method). elapsedTime := float64(time.Since(requestStartTime)) / float64(time.Millisecond) - t.latencyMeasure.Record(ctx, elapsedTime, o) + t.semconv.RecordMetrics(ctx, semconv.MetricData{ + RequestSize: bw.BytesRead(), + ElapsedTime: elapsedTime, + }, metricOpts) return res, nil } diff --git a/propagators/opencensus/examples/go.mod b/propagators/opencensus/examples/go.mod index 1c6c71fc0c5..34fcd405818 100644 --- a/propagators/opencensus/examples/go.mod +++ b/propagators/opencensus/examples/go.mod @@ -25,7 +25,7 @@ require ( golang.org/x/net v0.30.0 // indirect golang.org/x/sys v0.26.0 // indirect golang.org/x/text v0.19.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 // indirect google.golang.org/protobuf v1.35.1 // indirect ) diff --git a/propagators/opencensus/examples/go.sum b/propagators/opencensus/examples/go.sum index ea75bb80fa5..572ebd29c22 100644 --- a/propagators/opencensus/examples/go.sum +++ b/propagators/opencensus/examples/go.sum @@ -108,8 +108,8 @@ google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f h1:cUMEy+8oS78BWIH9OWazBkzbr090Od9tWBNtZHkOhf0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 h1:QCqS/PdaHTSWGvupk2F/ehwHtGc0/GYkT+3GAcR1CCc= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= diff --git a/renovate.json b/renovate.json index c517eb1a027..0b140f62425 100644 --- a/renovate.json +++ b/renovate.json @@ -26,6 +26,10 @@ "matchPackageNames": ["google.golang.org/genproto/googleapis/**"], "groupName": "googleapis" }, + { + "matchPackageNames": ["golang.org/x/**"], + "groupName": "golang.org/x" + }, { "matchPackageNames": ["go.opentelemetry.io/otel/**"], "allowedVersions": "/^v[0-9]+\\.[0-9]+\\.[0-9]+/" diff --git a/samplers/jaegerremote/example/go.mod b/samplers/jaegerremote/example/go.mod index 5f5b85e9145..20ea52446f7 100644 --- a/samplers/jaegerremote/example/go.mod +++ b/samplers/jaegerremote/example/go.mod @@ -18,7 +18,7 @@ require ( go.opentelemetry.io/otel/metric v1.30.0 // indirect go.opentelemetry.io/otel/trace v1.30.0 // indirect golang.org/x/sys v0.26.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240930140551-af27646dc61f // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20241007155032-5fefd90f89a9 // indirect google.golang.org/protobuf v1.35.1 // indirect ) diff --git a/samplers/jaegerremote/example/go.sum b/samplers/jaegerremote/example/go.sum index ba244669832..37834f0bafd 100644 --- a/samplers/jaegerremote/example/go.sum +++ b/samplers/jaegerremote/example/go.sum @@ -56,8 +56,8 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/api v0.0.0-20240930140551-af27646dc61f h1:jTm13A2itBi3La6yTGqn8bVSrc3ZZ1r8ENHlIXBfnRA= -google.golang.org/genproto/googleapis/api v0.0.0-20240930140551-af27646dc61f/go.mod h1:CLGoBuH1VHxAUXVPP8FfPwPEVJB6lz3URE5mY2SuayE= +google.golang.org/genproto/googleapis/api v0.0.0-20241007155032-5fefd90f89a9 h1:T6rh4haD3GVYsgEfWExoCZA2o2FmbNyKpTuAxbEFPTg= +google.golang.org/genproto/googleapis/api v0.0.0-20241007155032-5fefd90f89a9/go.mod h1:wp2WsuBYj6j8wUdo3ToZsdxxixbvQNAHqVJrTgi5E5M= google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/samplers/jaegerremote/go.mod b/samplers/jaegerremote/go.mod index 6586171131d..eac860ad7d5 100644 --- a/samplers/jaegerremote/go.mod +++ b/samplers/jaegerremote/go.mod @@ -8,7 +8,7 @@ require ( github.com/stretchr/testify v1.9.0 go.opentelemetry.io/otel/sdk v1.30.0 go.opentelemetry.io/otel/trace v1.30.0 - google.golang.org/genproto/googleapis/api v0.0.0-20240930140551-af27646dc61f + google.golang.org/genproto/googleapis/api v0.0.0-20241007155032-5fefd90f89a9 ) require ( diff --git a/samplers/jaegerremote/go.sum b/samplers/jaegerremote/go.sum index 0dcbc451d20..5e64a5673e9 100644 --- a/samplers/jaegerremote/go.sum +++ b/samplers/jaegerremote/go.sum @@ -54,8 +54,8 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/api v0.0.0-20240930140551-af27646dc61f h1:jTm13A2itBi3La6yTGqn8bVSrc3ZZ1r8ENHlIXBfnRA= -google.golang.org/genproto/googleapis/api v0.0.0-20240930140551-af27646dc61f/go.mod h1:CLGoBuH1VHxAUXVPP8FfPwPEVJB6lz3URE5mY2SuayE= +google.golang.org/genproto/googleapis/api v0.0.0-20241007155032-5fefd90f89a9 h1:T6rh4haD3GVYsgEfWExoCZA2o2FmbNyKpTuAxbEFPTg= +google.golang.org/genproto/googleapis/api v0.0.0-20241007155032-5fefd90f89a9/go.mod h1:wp2WsuBYj6j8wUdo3ToZsdxxixbvQNAHqVJrTgi5E5M= google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= diff --git a/versions.yaml b/versions.yaml index f0f3ae0dff0..a2721b14fe4 100644 --- a/versions.yaml +++ b/versions.yaml @@ -24,9 +24,6 @@ module-sets: - go.opentelemetry.io/contrib/propagators/autoprop - go.opentelemetry.io/contrib/propagators/opencensus - go.opentelemetry.io/contrib/propagators/opencensus/examples - - go.opentelemetry.io/contrib/instrumentation/gopkg.in/macaron.v1/otelmacaron - - go.opentelemetry.io/contrib/instrumentation/gopkg.in/macaron.v1/otelmacaron/example - - go.opentelemetry.io/contrib/instrumentation/gopkg.in/macaron.v1/otelmacaron/test - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/example - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/test