diff --git a/.chloggen/f-profiles-k8sattributesprocessor.yaml b/.chloggen/f-profiles-k8sattributesprocessor.yaml new file mode 100644 index 000000000000..33cc716a263c --- /dev/null +++ b/.chloggen/f-profiles-k8sattributesprocessor.yaml @@ -0,0 +1,27 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: enhancement + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: k8sattributesprocessor + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Add support for profiles signal + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [35983] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: + +# If your change doesn't affect end users or the exported elements of any package, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [] diff --git a/.chloggen/pkg-dd-tr-api.yaml b/.chloggen/pkg-dd-tr-api.yaml new file mode 100644 index 000000000000..2d9a71843f8d --- /dev/null +++ b/.chloggen/pkg-dd-tr-api.yaml @@ -0,0 +1,27 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: enhancement + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: pkg/datadog + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: "Expose an API `TranslatorFromConfig` that creates a new metrics translator" + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [36300] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: "This is only code refactor and has no user-facing impact" + +# If your change doesn't affect end users or the exported elements of any package, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [api] diff --git a/exporter/datadogexporter/factory.go b/exporter/datadogexporter/factory.go index 3339a03cf293..9ec9eba241f0 100644 --- a/exporter/datadogexporter/factory.go +++ b/exporter/datadogexporter/factory.go @@ -53,13 +53,6 @@ var metricExportNativeClientFeatureGate = featuregate.GlobalRegistry().MustRegis featuregate.WithRegisterDescription("When enabled, metric export in datadogexporter uses native Datadog client APIs instead of Zorkian APIs."), ) -var metricRemappingDisableddFeatureGate = featuregate.GlobalRegistry().MustRegister( - "exporter.datadogexporter.metricremappingdisabled", - featuregate.StageAlpha, - featuregate.WithRegisterDescription("When enabled the Datadog Exporter remaps OpenTelemetry semantic conventions to Datadog semantic conventions. This feature gate is only for internal use."), - featuregate.WithRegisterReferenceURL("https://docs.datadoghq.com/opentelemetry/schema_semantics/metrics_mapping/"), -) - // noAPMStatsFeatureGate causes the trace consumer to skip APM stats computation. var noAPMStatsFeatureGate = featuregate.GlobalRegistry().MustRegister( "exporter.datadogexporter.DisableAPMStats", @@ -72,11 +65,6 @@ func isMetricExportV2Enabled() bool { return metricExportNativeClientFeatureGate.IsEnabled() } -// isMetricRemappingDisabled returns true if the datadogexporter should generate Datadog-compliant metrics from OpenTelemetry metrics -func isMetricRemappingDisabled() bool { - return metricRemappingDisableddFeatureGate.IsEnabled() -} - func isLogsAgentExporterEnabled() bool { return logsAgentExporterFeatureGate.IsEnabled() } diff --git a/exporter/datadogexporter/metrics_exporter.go b/exporter/datadogexporter/metrics_exporter.go index c6846807bd77..18f5b76fe122 100644 --- a/exporter/datadogexporter/metrics_exporter.go +++ b/exporter/datadogexporter/metrics_exporter.go @@ -18,7 +18,6 @@ import ( "github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes" "github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes/source" otlpmetrics "github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/metrics" - "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/exporter" "go.opentelemetry.io/collector/pdata/pcommon" "go.opentelemetry.io/collector/pdata/pmetric" @@ -30,6 +29,7 @@ import ( "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter/internal/metrics" "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter/internal/metrics/sketches" "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter/internal/scrub" + datadogconfig "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/datadog/config" ) type metricsExporter struct { @@ -50,48 +50,6 @@ type metricsExporter struct { getPushTime func() uint64 } -// translatorFromConfig creates a new metrics translator from the exporter -func translatorFromConfig(set component.TelemetrySettings, cfg *Config, attrsTranslator *attributes.Translator, sourceProvider source.Provider, statsOut chan []byte) (*otlpmetrics.Translator, error) { - options := []otlpmetrics.TranslatorOption{ - otlpmetrics.WithDeltaTTL(cfg.Metrics.DeltaTTL), - otlpmetrics.WithFallbackSourceProvider(sourceProvider), - } - - if isMetricRemappingDisabled() { - set.Logger.Warn("Metric remapping is disabled in the Datadog exporter. OpenTelemetry metrics must be mapped to Datadog semantics before metrics are exported to Datadog (ex: via a processor).") - } else { - options = append(options, otlpmetrics.WithRemapping()) - } - - if cfg.Metrics.HistConfig.SendAggregations { - options = append(options, otlpmetrics.WithHistogramAggregations()) - } - - if cfg.Metrics.SummaryConfig.Mode == SummaryModeGauges { - options = append(options, otlpmetrics.WithQuantiles()) - } - - if cfg.Metrics.ExporterConfig.InstrumentationScopeMetadataAsTags { - options = append(options, otlpmetrics.WithInstrumentationScopeMetadataAsTags()) - } - - options = append(options, otlpmetrics.WithHistogramMode(otlpmetrics.HistogramMode(cfg.Metrics.HistConfig.Mode))) - - var numberMode otlpmetrics.NumberMode - switch cfg.Metrics.SumConfig.CumulativeMonotonicMode { - case CumulativeMonotonicSumModeRawValue: - numberMode = otlpmetrics.NumberModeRawValue - case CumulativeMonotonicSumModeToDelta: - numberMode = otlpmetrics.NumberModeCumulativeToDelta - } - options = append(options, otlpmetrics.WithNumberMode(numberMode)) - options = append(options, otlpmetrics.WithInitialCumulMonoValueMode( - otlpmetrics.InitialCumulMonoValueMode(cfg.Metrics.SumConfig.InitialCumulativeMonotonicMode))) - - options = append(options, otlpmetrics.WithStatsOut(statsOut)) - return otlpmetrics.NewTranslator(set, attrsTranslator, options...) -} - func newMetricsExporter( ctx context.Context, params exporter.Settings, @@ -103,7 +61,7 @@ func newMetricsExporter( metadataReporter *inframetadata.Reporter, statsOut chan []byte, ) (*metricsExporter, error) { - tr, err := translatorFromConfig(params.TelemetrySettings, cfg, attrsTranslator, sourceProvider, statsOut) + tr, err := datadogconfig.TranslatorFromConfig(params.TelemetrySettings, cfg.Metrics, attrsTranslator, sourceProvider, statsOut) if err != nil { return nil, err } diff --git a/pkg/datadog/config/metrics.go b/pkg/datadog/config/metrics.go index 07b95beb4be6..fc2c307a1be3 100644 --- a/pkg/datadog/config/metrics.go +++ b/pkg/datadog/config/metrics.go @@ -7,7 +7,12 @@ import ( "encoding" "fmt" + "github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes" + "github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes/source" + otlpmetrics "github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/metrics" + "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/config/confignet" + "go.opentelemetry.io/collector/featuregate" ) // MetricsConfig defines the metrics exporter specific configuration options @@ -206,3 +211,57 @@ type MetricsExporterConfig struct { // instrumentation scope that created a metric to the metric tags InstrumentationScopeMetadataAsTags bool `mapstructure:"instrumentation_scope_metadata_as_tags"` } + +var metricRemappingDisableddFeatureGate = featuregate.GlobalRegistry().MustRegister( + "exporter.datadogexporter.metricremappingdisabled", + featuregate.StageAlpha, + featuregate.WithRegisterDescription("When enabled the Datadog Exporter remaps OpenTelemetry semantic conventions to Datadog semantic conventions. This feature gate is only for internal use."), + featuregate.WithRegisterReferenceURL("https://docs.datadoghq.com/opentelemetry/schema_semantics/metrics_mapping/"), +) + +// isMetricRemappingDisabled returns true if the datadogexporter should generate Datadog-compliant metrics from OpenTelemetry metrics +func isMetricRemappingDisabled() bool { + return metricRemappingDisableddFeatureGate.IsEnabled() +} + +// TranslatorFromConfig creates a new metrics translator from the exporter +func TranslatorFromConfig(set component.TelemetrySettings, mcfg MetricsConfig, attrsTranslator *attributes.Translator, sourceProvider source.Provider, statsOut chan []byte) (*otlpmetrics.Translator, error) { + options := []otlpmetrics.TranslatorOption{ + otlpmetrics.WithDeltaTTL(mcfg.DeltaTTL), + otlpmetrics.WithFallbackSourceProvider(sourceProvider), + } + + if isMetricRemappingDisabled() { + set.Logger.Warn("Metric remapping is disabled in the Datadog exporter. OpenTelemetry metrics must be mapped to Datadog semantics before metrics are exported to Datadog (ex: via a processor).") + } else { + options = append(options, otlpmetrics.WithRemapping()) + } + + if mcfg.HistConfig.SendAggregations { + options = append(options, otlpmetrics.WithHistogramAggregations()) + } + + if mcfg.SummaryConfig.Mode == SummaryModeGauges { + options = append(options, otlpmetrics.WithQuantiles()) + } + + if mcfg.ExporterConfig.InstrumentationScopeMetadataAsTags { + options = append(options, otlpmetrics.WithInstrumentationScopeMetadataAsTags()) + } + + options = append(options, otlpmetrics.WithHistogramMode(otlpmetrics.HistogramMode(mcfg.HistConfig.Mode))) + + var numberMode otlpmetrics.NumberMode + switch mcfg.SumConfig.CumulativeMonotonicMode { + case CumulativeMonotonicSumModeRawValue: + numberMode = otlpmetrics.NumberModeRawValue + case CumulativeMonotonicSumModeToDelta: + numberMode = otlpmetrics.NumberModeCumulativeToDelta + } + options = append(options, otlpmetrics.WithNumberMode(numberMode)) + options = append(options, otlpmetrics.WithInitialCumulMonoValueMode( + otlpmetrics.InitialCumulMonoValueMode(mcfg.SumConfig.InitialCumulativeMonotonicMode))) + + options = append(options, otlpmetrics.WithStatsOut(statsOut)) + return otlpmetrics.NewTranslator(set, attrsTranslator, options...) +} diff --git a/pkg/datadog/go.mod b/pkg/datadog/go.mod index 3cf42153d8c1..22f0df2e27ff 100644 --- a/pkg/datadog/go.mod +++ b/pkg/datadog/go.mod @@ -4,6 +4,8 @@ go 1.22.0 require ( github.com/DataDog/datadog-agent/pkg/util/hostname/validate v0.59.0 + github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes v0.21.0 + github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/metrics v0.21.0 github.com/stretchr/testify v1.9.0 go.opentelemetry.io/collector/component v0.113.0 go.opentelemetry.io/collector/config/configauth v0.113.0 @@ -14,23 +16,30 @@ require ( go.opentelemetry.io/collector/config/configtls v1.19.0 go.opentelemetry.io/collector/confmap v1.19.0 go.opentelemetry.io/collector/exporter v0.113.0 + go.opentelemetry.io/collector/featuregate v1.19.0 go.uber.org/zap v1.27.0 ) require ( + github.com/DataDog/datadog-agent/pkg/proto v0.52.0-devel // indirect github.com/DataDog/datadog-agent/pkg/util/log v0.59.0 // indirect github.com/DataDog/datadog-agent/pkg/util/scrubber v0.59.0 // indirect + github.com/DataDog/opentelemetry-mapping-go/pkg/quantile v0.21.0 // indirect + github.com/DataDog/sketches-go v1.4.4 // indirect github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/cihub/seelog v0.0.0-20170130134532-f561c5e57575 // indirect github.com/davecgh/go-spew v1.1.1 // indirect + github.com/dustin/go-humanize v1.0.1 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.8.0 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-viper/mapstructure/v2 v2.2.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang/protobuf v1.5.3 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/uuid v1.6.0 // indirect + github.com/hashicorp/go-version v1.7.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/compress v1.17.11 // indirect github.com/knadh/koanf/maps v0.1.1 // indirect @@ -40,9 +49,12 @@ require ( github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/patrickmn/go-cache v2.1.0+incompatible // indirect + github.com/philhofer/fwd v1.1.2 // indirect github.com/pierrec/lz4/v4 v4.1.21 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rs/cors v1.11.1 // indirect + github.com/tinylib/msgp v1.1.8 // indirect go.opentelemetry.io/collector/client v1.19.0 // indirect go.opentelemetry.io/collector/config/configcompression v1.19.0 // indirect go.opentelemetry.io/collector/config/configtelemetry v0.113.0 // indirect @@ -55,6 +67,7 @@ require ( go.opentelemetry.io/collector/pdata v1.19.0 // indirect go.opentelemetry.io/collector/pdata/pprofile v0.113.0 // indirect go.opentelemetry.io/collector/pipeline v0.113.0 // indirect + go.opentelemetry.io/collector/semconv v0.113.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 // indirect go.opentelemetry.io/otel v1.31.0 // indirect go.opentelemetry.io/otel/metric v1.31.0 // indirect @@ -63,6 +76,7 @@ require ( go.opentelemetry.io/otel/trace v1.31.0 // indirect go.uber.org/atomic v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect + golang.org/x/exp v0.0.0-20230321023759-10a507213a29 // indirect golang.org/x/net v0.30.0 // indirect golang.org/x/sys v0.26.0 // indirect golang.org/x/text v0.19.0 // indirect diff --git a/pkg/datadog/go.sum b/pkg/datadog/go.sum index 896b87158415..93f77bbfad8c 100644 --- a/pkg/datadog/go.sum +++ b/pkg/datadog/go.sum @@ -1,16 +1,32 @@ +github.com/DataDog/datadog-agent/pkg/proto v0.52.0-devel h1:nBejGNIU6Jk7bPBxz2bAO+f+kahAXWBXPecebY3R+Zo= +github.com/DataDog/datadog-agent/pkg/proto v0.52.0-devel/go.mod h1:wjr5YlVvGip6VmAGzHrdBaGUu1LaA9B6gHvInm5kHiY= github.com/DataDog/datadog-agent/pkg/util/hostname/validate v0.59.0 h1:8qlROMBQixtDVQwjvttGSM8hTmN3tnFQugOyh614ACc= github.com/DataDog/datadog-agent/pkg/util/hostname/validate v0.59.0/go.mod h1:4EPWYAplHgdaLZsP/NuLEfh21NuvF+JdVtwttTqQlUY= github.com/DataDog/datadog-agent/pkg/util/log v0.59.0 h1:0JwuSc9Pr/kHAYIEzbdeYKLxgDViNlA6e/bB+7IvFtE= github.com/DataDog/datadog-agent/pkg/util/log v0.59.0/go.mod h1:pH5Vs7I0fwUU4dUtiQ/oEC//+xzPAgUlhH5+MG5eseg= github.com/DataDog/datadog-agent/pkg/util/scrubber v0.59.0 h1:p4uZow1IE/ve590aKqTsS+/5P7fPi+abHN9TWFi+bhE= github.com/DataDog/datadog-agent/pkg/util/scrubber v0.59.0/go.mod h1:krOxbYZc4KKE7bdEDu10lLSQBjdeSFS/XDSclsaSf1Y= +github.com/DataDog/opentelemetry-mapping-go/pkg/internal/sketchtest v0.21.0 h1:VS4NTqwczwezMVvI6A7xYR3ugPmMUJ4FcdFrsdnZI2I= +github.com/DataDog/opentelemetry-mapping-go/pkg/internal/sketchtest v0.21.0/go.mod h1:66XlN7QpQKqIvw8e2UbCXV5X8wGnEw851nT9BjJ75dY= +github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes v0.21.0 h1:hgbTFS6SkqbzOiWSfP58dZ/Jpjlmv6dpD4+V4LDHm2Q= +github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes v0.21.0/go.mod h1:dvIWN9pA2zWNTw5rhDWZgzZnhcfpH++d+8d1SWW6xkY= +github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/metrics v0.21.0 h1:8nW8jfcCIWzxWrpI31C0QYoOjTaUGp6USCwiRbP5Fp4= +github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/metrics v0.21.0/go.mod h1:wuatEozcLYinJ0WYf0MlVTFtTzEmf+qyJet0H9foVAs= +github.com/DataDog/opentelemetry-mapping-go/pkg/quantile v0.21.0 h1:/Dp1WBvekdusS9Tw9pLE7RG04eluNktQ29arLS4SpGM= +github.com/DataDog/opentelemetry-mapping-go/pkg/quantile v0.21.0/go.mod h1:asNuwNy1O2HbadkcZVuqmFGonfEzXS/SBvOo8V1MJvQ= +github.com/DataDog/sketches-go v1.4.4 h1:dF52vzXRFSPOj2IjXSWLvXq3jubL4CI69kwYjJ1w5Z8= +github.com/DataDog/sketches-go v1.4.4/go.mod h1:XR0ns2RtEEF09mDKXiKZiQg+nfZStrq1ZuL1eezeZe0= github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cihub/seelog v0.0.0-20170130134532-f561c5e57575 h1:kHaBemcxl8o/pQ5VM1c8PVE1PubbNx3mjUr09OqWGCs= github.com/cihub/seelog v0.0.0-20170130134532-f561c5e57575/go.mod h1:9d6lWj8KzO/fd/NrVaLscBKmPigpZpn5YawRPw+e3Yo= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= +github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M= @@ -24,13 +40,21 @@ github.com/go-viper/mapstructure/v2 v2.2.1 h1:ZAaOCxANMuZx5RCeg0mBdEZk7DZasvvZIx github.com/go-viper/mapstructure/v2 v2.2.1/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 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/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= +github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= 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/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY= +github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= @@ -47,6 +71,8 @@ github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/lightstep/go-expohisto v1.0.0 h1:UPtTS1rGdtehbbAF7o/dhkWLTDI73UifG8LbfQI7cA4= +github.com/lightstep/go-expohisto v1.0.0/go.mod h1:xDXD0++Mu2FOaItXtdDfksfgxfV0z1TMPa+e/EUd0cs= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= @@ -56,6 +82,14 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest v0.94.0 h1:nTayRLarCGkB9ld7p8jWJe/9wvf8gNDaS5fRjybkEpg= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest v0.94.0/go.mod h1:xoBvqu56hbky3KZafo68nxtV2+J81+pvo1ttNirakcU= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.94.0 h1:DSGhzGAaC767esMB0Ulr+9xWe6SW0LFUYMxLrLOAkjM= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.94.0/go.mod h1:Nv4nK3E7sUpDbNv0zI0zY15g2xR4jMg+n8taV8dsMeE= +github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc= +github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= +github.com/philhofer/fwd v1.1.2 h1:bnDivRJ1EWPjUIRXV5KfORO897HTbpFAQddBdE8t7Gw= +github.com/philhofer/fwd v1.1.2/go.mod h1:qkPdfjR2SIEbspLqpe1tO4n5yICnr2DY7mqEx2tUTP0= github.com/pierrec/lz4/v4 v4.1.21 h1:yOVMLb6qSIDP67pl/5F7RepeKYu/VmTyEXvuMI5d9mQ= github.com/pierrec/lz4/v4 v4.1.21/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -66,10 +100,18 @@ github.com/rs/cors v1.11.1 h1:eU3gRzXLRK57F5rKMGMZURNdIG4EoAmX8k94r9wXWHA= github.com/rs/cors v1.11.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 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/tinylib/msgp v1.1.8 h1:FCXC1xanKO4I8plpHGH2P7koL/RzZs12l/+r7vakfm0= +github.com/tinylib/msgp v1.1.8/go.mod h1:qkpG+2ldGg4xRFmx+jfTvZPxfGFhi64BcnL9vkCm/Tw= +github.com/vmihailenco/msgpack/v4 v4.3.12 h1:07s4sz9IReOgdikxLTKNbBdqDMLsjPKXwvCazn8G65U= +github.com/vmihailenco/msgpack/v4 v4.3.12/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4= +github.com/vmihailenco/tagparser v0.1.1 h1:quXMXlA39OCbd2wAdTsGDlK9RkOk6Wuw+x37wVyIuWY= +github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.opentelemetry.io/collector/client v1.19.0 h1:TUal8WV1agTrZStgE7BJ8ZC0IHLGtrfgO9ogU9t1mv8= go.opentelemetry.io/collector/client v1.19.0/go.mod h1:jgiXMEM6l8L2QEyf2I/M47Zd8+G7e4z+6H8q5SkHOlQ= go.opentelemetry.io/collector/component v0.113.0 h1:/nx+RvZgxUEXP+YcTj69rEtuSEGkfaCyp/ad5zQGLjU= @@ -114,6 +156,8 @@ go.opentelemetry.io/collector/extension/auth v0.113.0 h1:4ggRy1vepOabUiCWfU+6M9P go.opentelemetry.io/collector/extension/auth v0.113.0/go.mod h1:VbvAm2YZAqePkWgwn0m0vBaq3aC49CxPVwHmrJ24aeQ= go.opentelemetry.io/collector/extension/experimental/storage v0.113.0 h1:Qq4IaB6bMUrf/bWoPZ5ESWywCt+vDi8I/ChYejIEPcc= go.opentelemetry.io/collector/extension/experimental/storage v0.113.0/go.mod h1:BRmo+A7f06u/rhyLauU/Vogk+QRN0y1j2VVVgMGWrfQ= +go.opentelemetry.io/collector/featuregate v1.19.0 h1:ASea2sU+tdpKI3RxIJC/pufDAfwAmrvcQ4EmTHVu0B0= +go.opentelemetry.io/collector/featuregate v1.19.0/go.mod h1:47xrISO71vJ83LSMm8+yIDsUbKktUp48Ovt7RR6VbRs= go.opentelemetry.io/collector/pdata v1.19.0 h1:jmnU5R8TOCbwRr4B8sjdRxM7L5WnEKlQWX1dtLYxIbE= go.opentelemetry.io/collector/pdata v1.19.0/go.mod h1:Ox1YVLe87cZDB/TL30i4SUz1cA5s6AM6SpFMfY61ICs= go.opentelemetry.io/collector/pdata/pprofile v0.113.0 h1:VRf4p0VhfuaR+Epy/nMIlu/9t39WU9CUgHVUvpuGxfU= @@ -128,6 +172,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.113.0 h1:uVxuzjGe2t1s go.opentelemetry.io/collector/receiver/receiverprofiles v0.113.0/go.mod h1:khKDkzYJR2x2OPUqGSmoSncdINT9lUE5IThiHPDbqZk= go.opentelemetry.io/collector/receiver/receivertest v0.113.0 h1:0vOvz3S4Q/KwcNCS9C7zPo0uxD6RSWktG88yGdxfV6g= go.opentelemetry.io/collector/receiver/receivertest v0.113.0/go.mod h1:sRq5ctm5UE/0Ar562wnCVQ1zbAie/D127D1WbtbEuEc= +go.opentelemetry.io/collector/semconv v0.113.0 h1:twenSI7M7MJMJKW8D6a/GXxPZTPbama/weywBtV2iFw= +go.opentelemetry.io/collector/semconv v0.113.0/go.mod h1:zCJ5njhWpejR+A40kiEoeFm1xq1uzyZwMnRNX6/D82A= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 h1:UP6IpuHFkUgOQL9FFQFrZ+5LiwhhYRbi7VZSIx6Nj5s= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0/go.mod h1:qxuZLtbq5QDtdeSHsS7bcf6EH6uO6jUAgk764zd3rhM= go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY= @@ -151,38 +197,65 @@ go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/exp v0.0.0-20230321023759-10a507213a29 h1:ooxPy7fPvB4kwsA2h+iBNHkAbp/4JxTSwCmvdjEYmug= +golang.org/x/exp v0.0.0-20230321023759-10a507213a29/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 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/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 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/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= +google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd h1:6TEm2ZxXoQmFWFlt1vNxvVOa1Q0dXFQD1m/rYjXmS0E= google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= 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.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= 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/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -190,5 +263,6 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntN gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 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/processor/k8sattributesprocessor/README.md b/processor/k8sattributesprocessor/README.md index f1d52da19365..cdb82bc759aa 100644 --- a/processor/k8sattributesprocessor/README.md +++ b/processor/k8sattributesprocessor/README.md @@ -2,12 +2,14 @@ | Status | | | ------------- |-----------| -| Stability | [beta]: logs, metrics, traces | +| Stability | [development]: profiles | +| | [beta]: logs, metrics, traces | | Distributions | [contrib], [k8s] | | Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Aprocessor%2Fk8sattributes%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Aprocessor%2Fk8sattributes) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Aprocessor%2Fk8sattributes%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Aprocessor%2Fk8sattributes) | | [Code Owners](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#becoming-a-code-owner) | [@dmitryax](https://www.github.com/dmitryax), [@fatsheep9146](https://www.github.com/fatsheep9146), [@TylerHelmuth](https://www.github.com/TylerHelmuth) | | Emeritus | [@rmfitzpatrick](https://www.github.com/rmfitzpatrick) | +[development]: https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/component-stability.md#development [beta]: https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/component-stability.md#beta [contrib]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-contrib [k8s]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-k8s diff --git a/processor/k8sattributesprocessor/e2e_test.go b/processor/k8sattributesprocessor/e2e_test.go index 8ca836a0ee8d..553737a894fa 100644 --- a/processor/k8sattributesprocessor/e2e_test.go +++ b/processor/k8sattributesprocessor/e2e_test.go @@ -21,7 +21,9 @@ import ( "go.opentelemetry.io/collector/consumer/consumertest" "go.opentelemetry.io/collector/pdata/pcommon" "go.opentelemetry.io/collector/pipeline" + "go.opentelemetry.io/collector/pipeline/pipelineprofiles" "go.opentelemetry.io/collector/receiver/otlpreceiver" + "go.opentelemetry.io/collector/receiver/receiverprofiles" "go.opentelemetry.io/collector/receiver/receivertest" "go.uber.org/multierr" @@ -80,7 +82,8 @@ func TestE2E_ClusterRBAC(t *testing.T) { metricsConsumer := new(consumertest.MetricsSink) tracesConsumer := new(consumertest.TracesSink) logsConsumer := new(consumertest.LogsSink) - shutdownSinks := startUpSinks(t, metricsConsumer, tracesConsumer, logsConsumer) + profilesConsumer := new(consumertest.ProfilesSink) + shutdownSinks := startUpSinks(t, metricsConsumer, tracesConsumer, logsConsumer, profilesConsumer) defer shutdownSinks() testID := uuid.NewString()[:8] @@ -89,7 +92,10 @@ func TestE2E_ClusterRBAC(t *testing.T) { ManifestsDir: filepath.Join(testDir, "telemetrygen"), TestID: testID, OtlpEndpoint: fmt.Sprintf("otelcol-%s.%s:4317", testID, testNs), - DataTypes: []string{"metrics", "logs", "traces"}, + // `telemetrygen` doesn't support profiles + // https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/36127 + // TODO: add "profiles" to DataTypes once #36127 is resolved + DataTypes: []string{"metrics", "logs", "traces"}, } telemetryGenObjs, telemetryGenObjInfos := k8stest.CreateTelemetryGenObjects(t, k8sClient, createTeleOpts) defer func() { @@ -102,8 +108,8 @@ func TestE2E_ClusterRBAC(t *testing.T) { k8stest.WaitForTelemetryGenToStart(t, k8sClient, info.Namespace, info.PodLabelSelectors, info.Workload, info.DataType) } - wantEntries := 128 // Minimal number of metrics/traces/logs to wait for. - waitForData(t, wantEntries, metricsConsumer, tracesConsumer, logsConsumer) + wantEntries := 128 // Minimal number of metrics/traces/logs/profiles to wait for. + waitForData(t, wantEntries, metricsConsumer, tracesConsumer, logsConsumer, profilesConsumer) tcs := []struct { name string @@ -414,6 +420,107 @@ func TestE2E_ClusterRBAC(t *testing.T) { "k8s.namespace.labels.foons": newExpectedValue(equal, "barns"), }, }, + { + name: "profiles-job", + dataType: pipelineprofiles.SignalProfiles, + service: "test-profiles-job", + attrs: map[string]*expectedValue{ + "k8s.pod.name": newExpectedValue(regex, "telemetrygen-"+testID+"-profiles-job-[a-z0-9]*"), + "k8s.pod.ip": newExpectedValue(exist, ""), + "k8s.pod.uid": newExpectedValue(regex, uidRe), + "k8s.pod.start_time": newExpectedValue(exist, ""), + "k8s.node.name": newExpectedValue(exist, ""), + "k8s.namespace.name": newExpectedValue(equal, testNs), + "k8s.job.name": newExpectedValue(equal, "telemetrygen-"+testID+"-profiles-job"), + "k8s.job.uid": newExpectedValue(exist, ""), + "k8s.annotations.workload": newExpectedValue(equal, "job"), + "k8s.labels.app": newExpectedValue(equal, "telemetrygen-"+testID+"-profiles-job"), + "k8s.container.name": newExpectedValue(equal, "telemetrygen"), + "k8s.cluster.uid": newExpectedValue(regex, uidRe), + "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), + "container.image.repo_digests": newExpectedValue(regex, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen@sha256:[0-9a-fA-f]{64}"), + "container.image.tag": newExpectedValue(equal, "latest"), + "container.id": newExpectedValue(exist, ""), + "k8s.node.labels.foo": newExpectedValue(equal, "too"), + "k8s.namespace.labels.foons": newExpectedValue(equal, "barns"), + }, + }, + { + name: "profiles-statefulset", + dataType: pipelineprofiles.SignalProfiles, + service: "test-profiles-statefulset", + attrs: map[string]*expectedValue{ + "k8s.pod.name": newExpectedValue(equal, "telemetrygen-"+testID+"-profiles-statefulset-0"), + "k8s.pod.ip": newExpectedValue(exist, ""), + "k8s.pod.uid": newExpectedValue(regex, uidRe), + "k8s.pod.start_time": newExpectedValue(exist, ""), + "k8s.node.name": newExpectedValue(exist, ""), + "k8s.namespace.name": newExpectedValue(equal, testNs), + "k8s.statefulset.name": newExpectedValue(equal, "telemetrygen-"+testID+"-profiles-statefulset"), + "k8s.statefulset.uid": newExpectedValue(exist, ""), + "k8s.annotations.workload": newExpectedValue(equal, "statefulset"), + "k8s.labels.app": newExpectedValue(equal, "telemetrygen-"+testID+"-profiles-statefulset"), + "k8s.container.name": newExpectedValue(equal, "telemetrygen"), + "k8s.cluster.uid": newExpectedValue(regex, uidRe), + "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), + "container.image.repo_digests": newExpectedValue(regex, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen@sha256:[0-9a-fA-f]{64}"), + "container.image.tag": newExpectedValue(equal, "latest"), + "container.id": newExpectedValue(exist, ""), + "k8s.namespace.labels.foons": newExpectedValue(equal, "barns"), + }, + }, + { + name: "profiles-deployment", + dataType: pipelineprofiles.SignalProfiles, + service: "test-profiles-deployment", + attrs: map[string]*expectedValue{ + "k8s.pod.name": newExpectedValue(regex, "telemetrygen-"+testID+"-profiles-deployment-[a-z0-9]*-[a-z0-9]*"), + "k8s.pod.ip": newExpectedValue(exist, ""), + "k8s.pod.uid": newExpectedValue(regex, uidRe), + "k8s.pod.start_time": newExpectedValue(exist, ""), + "k8s.node.name": newExpectedValue(exist, ""), + "k8s.namespace.name": newExpectedValue(equal, testNs), + "k8s.deployment.name": newExpectedValue(equal, "telemetrygen-"+testID+"-profiles-deployment"), + "k8s.deployment.uid": newExpectedValue(exist, ""), + "k8s.replicaset.name": newExpectedValue(regex, "telemetrygen-"+testID+"-profiles-deployment-[a-z0-9]*"), + "k8s.replicaset.uid": newExpectedValue(exist, ""), + "k8s.annotations.workload": newExpectedValue(equal, "deployment"), + "k8s.labels.app": newExpectedValue(equal, "telemetrygen-"+testID+"-profiles-deployment"), + "k8s.container.name": newExpectedValue(equal, "telemetrygen"), + "k8s.cluster.uid": newExpectedValue(regex, uidRe), + "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), + "container.image.repo_digests": newExpectedValue(regex, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen@sha256:[0-9a-fA-f]{64}"), + "container.image.tag": newExpectedValue(equal, "latest"), + "container.id": newExpectedValue(exist, ""), + "k8s.node.labels.foo": newExpectedValue(equal, "too"), + "k8s.namespace.labels.foons": newExpectedValue(equal, "barns"), + }, + }, + { + name: "profiles-daemonset", + dataType: pipelineprofiles.SignalProfiles, + service: "test-profiles-daemonset", + attrs: map[string]*expectedValue{ + "k8s.pod.name": newExpectedValue(regex, "telemetrygen-"+testID+"-profiles-daemonset-[a-z0-9]*"), + "k8s.pod.ip": newExpectedValue(exist, ""), + "k8s.pod.uid": newExpectedValue(regex, uidRe), + "k8s.pod.start_time": newExpectedValue(exist, ""), + "k8s.node.name": newExpectedValue(exist, ""), + "k8s.namespace.name": newExpectedValue(equal, testNs), + "k8s.daemonset.name": newExpectedValue(equal, "telemetrygen-"+testID+"-profiles-daemonset"), + "k8s.daemonset.uid": newExpectedValue(exist, ""), + "k8s.annotations.workload": newExpectedValue(equal, "daemonset"), + "k8s.labels.app": newExpectedValue(equal, "telemetrygen-"+testID+"-profiles-daemonset"), + "k8s.container.name": newExpectedValue(equal, "telemetrygen"), + "k8s.cluster.uid": newExpectedValue(regex, uidRe), + "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), + "container.image.repo_digests": newExpectedValue(regex, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen@sha256:[0-9a-fA-f]{64}"), + "container.image.tag": newExpectedValue(equal, "latest"), + "container.id": newExpectedValue(exist, ""), + "k8s.node.labels.foo": newExpectedValue(equal, "too"), + "k8s.namespace.labels.foons": newExpectedValue(equal, "barns"), + }, + }, } for _, tc := range tcs { @@ -425,6 +532,8 @@ func TestE2E_ClusterRBAC(t *testing.T) { scanMetricsForAttributes(t, metricsConsumer, tc.service, tc.attrs) case pipeline.SignalLogs: scanLogsForAttributes(t, logsConsumer, tc.service, tc.attrs) + case pipelineprofiles.SignalProfiles: + scanProfilesForAttributes(t, profilesConsumer, tc.service, tc.attrs) default: t.Fatalf("unknown data type %s", tc.dataType) } @@ -453,7 +562,8 @@ func TestE2E_NamespacedRBAC(t *testing.T) { metricsConsumer := new(consumertest.MetricsSink) tracesConsumer := new(consumertest.TracesSink) logsConsumer := new(consumertest.LogsSink) - shutdownSinks := startUpSinks(t, metricsConsumer, tracesConsumer, logsConsumer) + profilesConsumer := new(consumertest.ProfilesSink) + shutdownSinks := startUpSinks(t, metricsConsumer, tracesConsumer, logsConsumer, profilesConsumer) defer shutdownSinks() testID := uuid.NewString()[:8] @@ -462,7 +572,10 @@ func TestE2E_NamespacedRBAC(t *testing.T) { ManifestsDir: filepath.Join(testDir, "telemetrygen"), TestID: testID, OtlpEndpoint: fmt.Sprintf("otelcol-%s.%s:4317", testID, nsName), - DataTypes: []string{"metrics", "logs", "traces"}, + // `telemetrygen` doesn't support profiles + // https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/36127 + // TODO: add "profiles" to DataTypes once #36127 is resolved + DataTypes: []string{"metrics", "logs", "traces"}, } telemetryGenObjs, telemetryGenObjInfos := k8stest.CreateTelemetryGenObjects(t, k8sClient, createTeleOpts) defer func() { @@ -475,8 +588,8 @@ func TestE2E_NamespacedRBAC(t *testing.T) { k8stest.WaitForTelemetryGenToStart(t, k8sClient, info.Namespace, info.PodLabelSelectors, info.Workload, info.DataType) } - wantEntries := 20 // Minimal number of metrics/traces/logs to wait for. - waitForData(t, wantEntries, metricsConsumer, tracesConsumer, logsConsumer) + wantEntries := 20 // Minimal number of metrics/traces/logs/profiles to wait for. + waitForData(t, wantEntries, metricsConsumer, tracesConsumer, logsConsumer, profilesConsumer) tcs := []struct { name string @@ -556,6 +669,30 @@ func TestE2E_NamespacedRBAC(t *testing.T) { "container.id": newExpectedValue(exist, ""), }, }, + { + name: "profiles-deployment", + dataType: pipelineprofiles.SignalProfiles, + service: "test-profiles-deployment", + attrs: map[string]*expectedValue{ + "k8s.pod.name": newExpectedValue(regex, "telemetrygen-"+testID+"-profiles-deployment-[a-z0-9]*-[a-z0-9]*"), + "k8s.pod.ip": newExpectedValue(exist, ""), + "k8s.pod.uid": newExpectedValue(regex, uidRe), + "k8s.pod.start_time": newExpectedValue(exist, startTimeRe), + "k8s.node.name": newExpectedValue(exist, ""), + "k8s.namespace.name": newExpectedValue(equal, nsName), + "k8s.deployment.name": newExpectedValue(equal, "telemetrygen-"+testID+"-profiles-deployment"), + "k8s.deployment.uid": newExpectedValue(regex, uidRe), + "k8s.replicaset.name": newExpectedValue(regex, "telemetrygen-"+testID+"-profiles-deployment-[a-z0-9]*"), + "k8s.replicaset.uid": newExpectedValue(regex, uidRe), + "k8s.annotations.workload": newExpectedValue(equal, "deployment"), + "k8s.labels.app": newExpectedValue(equal, "telemetrygen-"+testID+"-profiles-deployment"), + "k8s.container.name": newExpectedValue(equal, "telemetrygen"), + "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), + "container.image.repo_digests": newExpectedValue(regex, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen@sha256:[0-9a-fA-f]{64}"), + "container.image.tag": newExpectedValue(equal, "latest"), + "container.id": newExpectedValue(exist, ""), + }, + }, } for _, tc := range tcs { @@ -567,6 +704,8 @@ func TestE2E_NamespacedRBAC(t *testing.T) { scanMetricsForAttributes(t, metricsConsumer, tc.service, tc.attrs) case pipeline.SignalLogs: scanLogsForAttributes(t, logsConsumer, tc.service, tc.attrs) + case pipelineprofiles.SignalProfiles: + scanProfilesForAttributes(t, profilesConsumer, tc.service, tc.attrs) default: t.Fatalf("unknown data type %s", tc.dataType) } @@ -586,7 +725,8 @@ func TestE2E_MixRBAC(t *testing.T) { metricsConsumer := new(consumertest.MetricsSink) tracesConsumer := new(consumertest.TracesSink) logsConsumer := new(consumertest.LogsSink) - shutdownSinks := startUpSinks(t, metricsConsumer, tracesConsumer, logsConsumer) + profilesConsumer := new(consumertest.ProfilesSink) + shutdownSinks := startUpSinks(t, metricsConsumer, tracesConsumer, logsConsumer, profilesConsumer) defer shutdownSinks() var workloadNs, otelNs string @@ -619,7 +759,10 @@ func TestE2E_MixRBAC(t *testing.T) { ManifestsDir: filepath.Join(testDir, "telemetrygen"), TestID: testID, OtlpEndpoint: fmt.Sprintf("otelcol-%s.%s:4317", testID, otelNs), - DataTypes: []string{"metrics", "logs", "traces"}, + // `telemetrygen` doesn't support profiles + // https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/36127 + // TODO: add "profiles" to DataTypes once #36127 is resolved + DataTypes: []string{"metrics", "logs", "traces"}, } telemetryGenObjs, telemetryGenObjInfos := k8stest.CreateTelemetryGenObjects(t, k8sClient, createTeleOpts) @@ -633,8 +776,8 @@ func TestE2E_MixRBAC(t *testing.T) { k8stest.WaitForTelemetryGenToStart(t, k8sClient, info.Namespace, info.PodLabelSelectors, info.Workload, info.DataType) } - wantEntries := 20 // Minimal number of metrics/traces/logs to wait for. - waitForData(t, wantEntries, metricsConsumer, tracesConsumer, logsConsumer) + wantEntries := 20 // Minimal number of metrics/traces/logs/profiles to wait for. + waitForData(t, wantEntries, metricsConsumer, tracesConsumer, logsConsumer, profilesConsumer) tcs := []struct { name string @@ -723,6 +866,33 @@ func TestE2E_MixRBAC(t *testing.T) { "k8s.cluster.uid": newExpectedValue(regex, uidRe), }, }, + { + name: "profiles-deployment", + dataType: pipelineprofiles.SignalProfiles, + service: "test-profiles-deployment", + attrs: map[string]*expectedValue{ + "k8s.pod.name": newExpectedValue(regex, "telemetrygen-"+testID+"-profiles-deployment-[a-z0-9]*-[a-z0-9]*"), + "k8s.pod.ip": newExpectedValue(exist, ""), + "k8s.pod.uid": newExpectedValue(regex, uidRe), + "k8s.pod.start_time": newExpectedValue(exist, ""), + "k8s.node.name": newExpectedValue(exist, ""), + "k8s.namespace.name": newExpectedValue(equal, workloadNs), + "k8s.deployment.name": newExpectedValue(equal, "telemetrygen-"+testID+"-profiles-deployment"), + "k8s.deployment.uid": newExpectedValue(regex, uidRe), + "k8s.replicaset.name": newExpectedValue(regex, "telemetrygen-"+testID+"-profiles-deployment-[a-z0-9]*"), + "k8s.replicaset.uid": newExpectedValue(regex, uidRe), + "k8s.annotations.workload": newExpectedValue(equal, "deployment"), + "k8s.labels.app": newExpectedValue(equal, "telemetrygen-"+testID+"-profiles-deployment"), + "k8s.container.name": newExpectedValue(equal, "telemetrygen"), + "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), + "container.image.repo_digests": newExpectedValue(regex, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen@sha256:[0-9a-fA-f]{64}"), + "container.image.tag": newExpectedValue(equal, "latest"), + "container.id": newExpectedValue(exist, ""), + "k8s.namespace.labels.foons": newExpectedValue(equal, "barns"), + "k8s.node.labels.foo": newExpectedValue(equal, "too"), + "k8s.cluster.uid": newExpectedValue(regex, uidRe), + }, + }, } for _, tc := range tcs { @@ -734,6 +904,8 @@ func TestE2E_MixRBAC(t *testing.T) { scanMetricsForAttributes(t, metricsConsumer, tc.service, tc.attrs) case pipeline.SignalLogs: scanLogsForAttributes(t, logsConsumer, tc.service, tc.attrs) + case pipelineprofiles.SignalProfiles: + scanProfilesForAttributes(t, profilesConsumer, tc.service, tc.attrs) default: t.Fatalf("unknown data type %s", tc.dataType) } @@ -765,7 +937,8 @@ func TestE2E_NamespacedRBACNoPodIP(t *testing.T) { metricsConsumer := new(consumertest.MetricsSink) tracesConsumer := new(consumertest.TracesSink) logsConsumer := new(consumertest.LogsSink) - shutdownSinks := startUpSinks(t, metricsConsumer, tracesConsumer, logsConsumer) + profilesConsumer := new(consumertest.ProfilesSink) + shutdownSinks := startUpSinks(t, metricsConsumer, tracesConsumer, logsConsumer, profilesConsumer) defer shutdownSinks() testID := uuid.NewString()[:8] @@ -774,7 +947,10 @@ func TestE2E_NamespacedRBACNoPodIP(t *testing.T) { ManifestsDir: filepath.Join(testDir, "telemetrygen"), TestID: testID, OtlpEndpoint: fmt.Sprintf("otelcol-%s.%s:4317", testID, nsName), - DataTypes: []string{"metrics", "logs", "traces"}, + // `telemetrygen` doesn't support profiles + // https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/36127 + // TODO: add "profiles" to DataTypes once #36127 is resolved + DataTypes: []string{"metrics", "logs", "traces"}, } telemetryGenObjs, telemetryGenObjInfos := k8stest.CreateTelemetryGenObjects(t, k8sClient, createTeleOpts) defer func() { @@ -787,8 +963,8 @@ func TestE2E_NamespacedRBACNoPodIP(t *testing.T) { k8stest.WaitForTelemetryGenToStart(t, k8sClient, info.Namespace, info.PodLabelSelectors, info.Workload, info.DataType) } - wantEntries := 20 // Minimal number of metrics/traces/logs to wait for. - waitForData(t, wantEntries, metricsConsumer, tracesConsumer, logsConsumer) + wantEntries := 20 // Minimal number of metrics/traces/logs/profiles to wait for. + waitForData(t, wantEntries, metricsConsumer, tracesConsumer, logsConsumer, profilesConsumer) tcs := []struct { name string @@ -868,6 +1044,30 @@ func TestE2E_NamespacedRBACNoPodIP(t *testing.T) { "container.id": newExpectedValue(exist, ""), }, }, + { + name: "profiles-deployment", + dataType: pipelineprofiles.SignalProfiles, + service: "test-profiles-deployment", + attrs: map[string]*expectedValue{ + "k8s.pod.name": newExpectedValue(regex, "telemetrygen-"+testID+"-profiles-deployment-[a-z0-9]*-[a-z0-9]*"), + "k8s.pod.ip": newExpectedValue(shouldnotexist, ""), + "k8s.pod.uid": newExpectedValue(regex, uidRe), + "k8s.pod.start_time": newExpectedValue(exist, startTimeRe), + "k8s.node.name": newExpectedValue(exist, ""), + "k8s.namespace.name": newExpectedValue(equal, nsName), + "k8s.deployment.name": newExpectedValue(equal, "telemetrygen-"+testID+"-profiles-deployment"), + "k8s.deployment.uid": newExpectedValue(regex, uidRe), + "k8s.replicaset.name": newExpectedValue(regex, "telemetrygen-"+testID+"-profiles-deployment-[a-z0-9]*"), + "k8s.replicaset.uid": newExpectedValue(regex, uidRe), + "k8s.annotations.workload": newExpectedValue(equal, "deployment"), + "k8s.labels.app": newExpectedValue(equal, "telemetrygen-"+testID+"-profiles-deployment"), + "k8s.container.name": newExpectedValue(equal, "telemetrygen"), + "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), + "container.image.repo_digests": newExpectedValue(shouldnotexist, ""), + "container.image.tag": newExpectedValue(equal, "latest"), + "container.id": newExpectedValue(exist, ""), + }, + }, } for _, tc := range tcs { @@ -879,6 +1079,8 @@ func TestE2E_NamespacedRBACNoPodIP(t *testing.T) { scanMetricsForAttributes(t, metricsConsumer, tc.service, tc.attrs) case pipeline.SignalLogs: scanLogsForAttributes(t, logsConsumer, tc.service, tc.attrs) + case pipelineprofiles.SignalProfiles: + scanProfilesForAttributes(t, profilesConsumer, tc.service, tc.attrs) default: t.Fatalf("unknown data type %s", tc.dataType) } @@ -949,6 +1151,33 @@ func scanLogsForAttributes(t *testing.T, ls *consumertest.LogsSink, expectedServ t.Fatalf("no logs found for service %s", expectedService) } +func scanProfilesForAttributes(t *testing.T, ps *consumertest.ProfilesSink, expectedService string, + kvs map[string]*expectedValue) { + + // `telemetrygen` doesn't support profiles + // https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/36127 + // TODO: Remove `t.Skip()` once #36127 is resolved + t.Skip("Skip profiles test") + + // Iterate over the received set of profiles starting from the most recent entries due to a bug in the processor: + // https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/18892 + // TODO: Remove the reverse loop once it's fixed. All the metrics should be properly annotated. + for i := len(ps.AllProfiles()) - 1; i >= 0; i-- { + profiles := ps.AllProfiles()[i] + for i := 0; i < profiles.ResourceProfiles().Len(); i++ { + resource := profiles.ResourceProfiles().At(i).Resource() + service, exist := resource.Attributes().Get("service.name") + assert.True(t, exist, "profile do not has 'service.name' attribute in resource") + if service.AsString() != expectedService { + continue + } + assert.NoError(t, resourceHasAttributes(resource, kvs)) + return + } + } + t.Fatalf("no profiles found for service %s", expectedService) +} + func resourceHasAttributes(resource pcommon.Resource, kvs map[string]*expectedValue) error { foundAttrs := make(map[string]bool) shouldNotFoundAttrs := make(map[string]bool) @@ -998,7 +1227,7 @@ func resourceHasAttributes(resource pcommon.Resource, kvs map[string]*expectedVa return err } -func startUpSinks(t *testing.T, mc *consumertest.MetricsSink, tc *consumertest.TracesSink, lc *consumertest.LogsSink) func() { +func startUpSinks(t *testing.T, mc *consumertest.MetricsSink, tc *consumertest.TracesSink, lc *consumertest.LogsSink, pc *consumertest.ProfilesSink) func() { f := otlpreceiver.NewFactory() cfg := f.CreateDefaultConfig().(*otlpreceiver.Config) cfg.HTTP = nil @@ -1008,19 +1237,24 @@ func startUpSinks(t *testing.T, mc *consumertest.MetricsSink, tc *consumertest.T require.NoError(t, err, "failed creating metrics receiver") _, err = f.CreateTraces(context.Background(), receivertest.NewNopSettings(), cfg, tc) require.NoError(t, err, "failed creating traces receiver") - rcvr, err := f.CreateLogs(context.Background(), receivertest.NewNopSettings(), cfg, lc) + _, err = f.CreateLogs(context.Background(), receivertest.NewNopSettings(), cfg, lc) require.NoError(t, err, "failed creating logs receiver") + rcvr, err := f.(receiverprofiles.Factory).CreateProfiles(context.Background(), receivertest.NewNopSettings(), cfg, pc) + require.NoError(t, err, "failed creating profiles receiver") require.NoError(t, rcvr.Start(context.Background(), componenttest.NewNopHost())) return func() { assert.NoError(t, rcvr.Shutdown(context.Background())) } } -func waitForData(t *testing.T, entriesNum int, mc *consumertest.MetricsSink, tc *consumertest.TracesSink, lc *consumertest.LogsSink) { +func waitForData(t *testing.T, entriesNum int, mc *consumertest.MetricsSink, tc *consumertest.TracesSink, lc *consumertest.LogsSink, pc *consumertest.ProfilesSink) { timeoutMinutes := 3 require.Eventuallyf(t, func() bool { + // `telemetrygen` doesn't support profiles + // https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/36127 + // TODO: assert `len(pc.AllProfiles()) > entriesNum` once #36127 is resolved return len(mc.AllMetrics()) > entriesNum && len(tc.AllTraces()) > entriesNum && len(lc.AllLogs()) > entriesNum }, time.Duration(timeoutMinutes)*time.Minute, 1*time.Second, - "failed to receive %d entries, received %d metrics, %d traces, %d logs in %d minutes", entriesNum, - len(mc.AllMetrics()), len(tc.AllTraces()), len(lc.AllLogs()), timeoutMinutes) + "failed to receive %d entries, received %d metrics, %d traces, %d logs, %d profiles in %d minutes", entriesNum, + len(mc.AllMetrics()), len(tc.AllTraces()), len(lc.AllLogs()), len(pc.AllProfiles()), timeoutMinutes) } diff --git a/processor/k8sattributesprocessor/factory.go b/processor/k8sattributesprocessor/factory.go index fe1a46c24c83..f2f05e8bf4ea 100644 --- a/processor/k8sattributesprocessor/factory.go +++ b/processor/k8sattributesprocessor/factory.go @@ -8,8 +8,11 @@ import ( "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/consumer" + "go.opentelemetry.io/collector/consumer/consumerprofiles" "go.opentelemetry.io/collector/processor" "go.opentelemetry.io/collector/processor/processorhelper" + "go.opentelemetry.io/collector/processor/processorhelper/processorhelperprofiles" + "go.opentelemetry.io/collector/processor/processorprofiles" "github.com/open-telemetry/opentelemetry-collector-contrib/internal/k8sconfig" "github.com/open-telemetry/opentelemetry-collector-contrib/processor/k8sattributesprocessor/internal/kube" @@ -22,12 +25,13 @@ var defaultExcludes = ExcludeConfig{Pods: []ExcludePodConfig{{Name: "jaeger-agen // NewFactory returns a new factory for the k8s processor. func NewFactory() processor.Factory { - return processor.NewFactory( + return processorprofiles.NewFactory( metadata.Type, createDefaultConfig, - processor.WithTraces(createTracesProcessor, metadata.TracesStability), - processor.WithMetrics(createMetricsProcessor, metadata.MetricsStability), - processor.WithLogs(createLogsProcessor, metadata.LogsStability), + processorprofiles.WithTraces(createTracesProcessor, metadata.TracesStability), + processorprofiles.WithMetrics(createMetricsProcessor, metadata.MetricsStability), + processorprofiles.WithLogs(createLogsProcessor, metadata.LogsStability), + processorprofiles.WithProfiles(createProfilesProcessor, metadata.ProfilesStability), ) } @@ -68,6 +72,15 @@ func createMetricsProcessor( return createMetricsProcessorWithOptions(ctx, params, cfg, nextMetricsConsumer) } +func createProfilesProcessor( + ctx context.Context, + params processor.Settings, + cfg component.Config, + nextProfilesConsumer consumerprofiles.Profiles, +) (processorprofiles.Profiles, error) { + return createProfilesProcessorWithOptions(ctx, params, cfg, nextProfilesConsumer) +} + func createTracesProcessorWithOptions( ctx context.Context, set processor.Settings, @@ -128,6 +141,27 @@ func createLogsProcessorWithOptions( processorhelper.WithShutdown(kp.Shutdown)) } +func createProfilesProcessorWithOptions( + ctx context.Context, + set processor.Settings, + cfg component.Config, + nextProfilesConsumer consumerprofiles.Profiles, + options ...option, +) (processorprofiles.Profiles, error) { + kp := createKubernetesProcessor(set, cfg, options...) + + return processorhelperprofiles.NewProfiles( + ctx, + set, + cfg, + nextProfilesConsumer, + kp.processProfiles, + processorhelperprofiles.WithCapabilities(consumerCapabilities), + processorhelperprofiles.WithStart(kp.Start), + processorhelperprofiles.WithShutdown(kp.Shutdown), + ) +} + func createKubernetesProcessor( params processor.Settings, cfg component.Config, diff --git a/processor/k8sattributesprocessor/factory_test.go b/processor/k8sattributesprocessor/factory_test.go index 171b06161856..751d4d170cdb 100644 --- a/processor/k8sattributesprocessor/factory_test.go +++ b/processor/k8sattributesprocessor/factory_test.go @@ -10,6 +10,7 @@ import ( "github.com/stretchr/testify/assert" "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/consumer/consumertest" + "go.opentelemetry.io/collector/processor/processorprofiles" "go.opentelemetry.io/collector/processor/processortest" ) @@ -41,6 +42,10 @@ func TestCreateProcessor(t *testing.T) { assert.NotNil(t, lp) assert.NoError(t, err) + pp, err := factory.(processorprofiles.Factory).CreateProfiles(context.Background(), params, cfg, consumertest.NewNop()) + assert.NotNil(t, pp) + assert.NoError(t, err) + oCfg := cfg.(*Config) oCfg.Passthrough = true @@ -56,6 +61,10 @@ func TestCreateProcessor(t *testing.T) { assert.NotNil(t, lp) assert.NoError(t, err) + pp, err = factory.(processorprofiles.Factory).CreateProfiles(context.Background(), params, cfg, consumertest.NewNop()) + assert.NotNil(t, pp) + assert.NoError(t, err) + // Switch it back so other tests run afterwards will not fail on unexpected state kubeClientProvider = realClient } diff --git a/processor/k8sattributesprocessor/go.mod b/processor/k8sattributesprocessor/go.mod index 1cdae9632946..6c2fc0e290af 100644 --- a/processor/k8sattributesprocessor/go.mod +++ b/processor/k8sattributesprocessor/go.mod @@ -16,13 +16,19 @@ require ( go.opentelemetry.io/collector/config/configtelemetry v0.113.0 go.opentelemetry.io/collector/confmap v1.19.0 go.opentelemetry.io/collector/consumer v0.113.0 + go.opentelemetry.io/collector/consumer/consumerprofiles v0.113.0 go.opentelemetry.io/collector/consumer/consumertest v0.113.0 go.opentelemetry.io/collector/featuregate v1.19.0 go.opentelemetry.io/collector/pdata v1.19.0 + go.opentelemetry.io/collector/pdata/pprofile v0.113.0 go.opentelemetry.io/collector/pipeline v0.113.0 + go.opentelemetry.io/collector/pipeline/pipelineprofiles v0.113.0 go.opentelemetry.io/collector/processor v0.113.0 + go.opentelemetry.io/collector/processor/processorhelper/processorhelperprofiles v0.113.0 + go.opentelemetry.io/collector/processor/processorprofiles v0.113.0 go.opentelemetry.io/collector/processor/processortest v0.113.0 go.opentelemetry.io/collector/receiver/otlpreceiver v0.113.0 + go.opentelemetry.io/collector/receiver/receiverprofiles v0.113.0 go.opentelemetry.io/collector/receiver/receivertest v0.113.0 go.opentelemetry.io/collector/semconv v0.113.0 go.opentelemetry.io/otel/metric v1.32.0 @@ -94,15 +100,11 @@ require ( go.opentelemetry.io/collector/config/configtls v1.19.0 // indirect go.opentelemetry.io/collector/config/internal v0.113.0 // indirect go.opentelemetry.io/collector/consumer/consumererror v0.113.0 // indirect - go.opentelemetry.io/collector/consumer/consumerprofiles v0.113.0 // indirect go.opentelemetry.io/collector/extension v0.113.0 // indirect go.opentelemetry.io/collector/extension/auth v0.113.0 // indirect go.opentelemetry.io/collector/internal/sharedcomponent v0.113.0 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.113.0 // indirect go.opentelemetry.io/collector/pdata/testdata v0.113.0 // indirect - go.opentelemetry.io/collector/processor/processorprofiles v0.113.0 // indirect go.opentelemetry.io/collector/receiver v0.113.0 // indirect - go.opentelemetry.io/collector/receiver/receiverprofiles v0.113.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.56.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 // indirect go.opentelemetry.io/otel v1.32.0 // indirect diff --git a/processor/k8sattributesprocessor/go.sum b/processor/k8sattributesprocessor/go.sum index 4e29149eee5b..91c3cc8d645c 100644 --- a/processor/k8sattributesprocessor/go.sum +++ b/processor/k8sattributesprocessor/go.sum @@ -1279,8 +1279,12 @@ go.opentelemetry.io/collector/pdata/testdata v0.113.0 h1:vRfn85jicO2F4eOTgsWtzmU go.opentelemetry.io/collector/pdata/testdata v0.113.0/go.mod h1:sR+6eR+YEJhYZu9StbqzeWcCmHpfBAgX/qjP82HY9Gw= go.opentelemetry.io/collector/pipeline v0.113.0 h1:vSRzRe3717jV0btCNPhVkhg2lu0uFxcm2VO+vhad/eE= go.opentelemetry.io/collector/pipeline v0.113.0/go.mod h1:4vOvjVsoYTHVGTbfFwqfnQOSV2K3RKUHofh3jNRc2Mg= +go.opentelemetry.io/collector/pipeline/pipelineprofiles v0.113.0 h1:PwQnErsLvEd1x6VIyjLmKQot9huKWqIfEz1kd+8aj4k= +go.opentelemetry.io/collector/pipeline/pipelineprofiles v0.113.0/go.mod h1:tChJYsCG3wc6JPT9aJO3y+32V14NhmCFZOh3k5ORGdQ= go.opentelemetry.io/collector/processor v0.113.0 h1:BQI6MsKtiCG9HT/nmiRXTKP6SZFrjFKVfM6pTQfbc0k= go.opentelemetry.io/collector/processor v0.113.0/go.mod h1:oX91zMI8ZkoaYSUfUYflHiMiiBJPKtODNBUCrETLLd8= +go.opentelemetry.io/collector/processor/processorhelper/processorhelperprofiles v0.113.0 h1:bZ1i5l6/4nj7PsLqeHw7Opw5vdrpUsDvuH6a6kx+2yg= +go.opentelemetry.io/collector/processor/processorhelper/processorhelperprofiles v0.113.0/go.mod h1:Uxv+5NNIJJCuz52DPFa9INjrpZSfidoTkv849tNp1qI= go.opentelemetry.io/collector/processor/processorprofiles v0.113.0 h1:cczN6whdrCWww3T0FBV3U7lsVKQmkWDX05M+9lANHgk= go.opentelemetry.io/collector/processor/processorprofiles v0.113.0/go.mod h1:4Dmx5qsvujgJ+MC+KqWI7UDVM2liXa3sH/9XnGiL9aE= go.opentelemetry.io/collector/processor/processortest v0.113.0 h1:jGoDJ+tDCzuDcAWZeshQtnK/DQAvMKd4wZAIDgAM5aA= diff --git a/processor/k8sattributesprocessor/internal/metadata/generated_status.go b/processor/k8sattributesprocessor/internal/metadata/generated_status.go index e656980a3605..e93559703fe5 100644 --- a/processor/k8sattributesprocessor/internal/metadata/generated_status.go +++ b/processor/k8sattributesprocessor/internal/metadata/generated_status.go @@ -12,7 +12,8 @@ var ( ) const ( - LogsStability = component.StabilityLevelBeta - MetricsStability = component.StabilityLevelBeta - TracesStability = component.StabilityLevelBeta + ProfilesStability = component.StabilityLevelDevelopment + LogsStability = component.StabilityLevelBeta + MetricsStability = component.StabilityLevelBeta + TracesStability = component.StabilityLevelBeta ) diff --git a/processor/k8sattributesprocessor/metadata.yaml b/processor/k8sattributesprocessor/metadata.yaml index dd129a014a6f..a388cfcb3dfd 100644 --- a/processor/k8sattributesprocessor/metadata.yaml +++ b/processor/k8sattributesprocessor/metadata.yaml @@ -4,6 +4,7 @@ status: class: processor stability: beta: [logs, metrics, traces] + development: [profiles] distributions: [contrib, k8s] codeowners: active: [dmitryax, fatsheep9146, TylerHelmuth] diff --git a/processor/k8sattributesprocessor/processor.go b/processor/k8sattributesprocessor/processor.go index 40347a55f0ef..5d63cbbd100a 100644 --- a/processor/k8sattributesprocessor/processor.go +++ b/processor/k8sattributesprocessor/processor.go @@ -13,6 +13,7 @@ import ( "go.opentelemetry.io/collector/pdata/pcommon" "go.opentelemetry.io/collector/pdata/plog" "go.opentelemetry.io/collector/pdata/pmetric" + "go.opentelemetry.io/collector/pdata/pprofile" "go.opentelemetry.io/collector/pdata/ptrace" conventions "go.opentelemetry.io/collector/semconv/v1.8.0" "go.uber.org/zap" @@ -117,6 +118,16 @@ func (kp *kubernetesprocessor) processLogs(ctx context.Context, ld plog.Logs) (p return ld, nil } +// processProfiles process profiles and add k8s metadata using resource IP, hostname or incoming IP as pod origin. +func (kp *kubernetesprocessor) processProfiles(ctx context.Context, pd pprofile.Profiles) (pprofile.Profiles, error) { + rp := pd.ResourceProfiles() + for i := 0; i < rp.Len(); i++ { + kp.processResource(ctx, rp.At(i).Resource()) + } + + return pd, nil +} + // processResource adds Pod metadata tags to resource based on pod association configuration func (kp *kubernetesprocessor) processResource(ctx context.Context, resource pcommon.Resource) { podIdentifierValue := extractPodID(ctx, resource.Attributes(), kp.podAssociations) diff --git a/processor/k8sattributesprocessor/processor_test.go b/processor/k8sattributesprocessor/processor_test.go index f7493cc38cdc..b8cbf1ec66b0 100644 --- a/processor/k8sattributesprocessor/processor_test.go +++ b/processor/k8sattributesprocessor/processor_test.go @@ -17,12 +17,15 @@ import ( "go.opentelemetry.io/collector/component/componentstatus" "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/consumer" + "go.opentelemetry.io/collector/consumer/consumerprofiles" "go.opentelemetry.io/collector/consumer/consumertest" "go.opentelemetry.io/collector/pdata/pcommon" "go.opentelemetry.io/collector/pdata/plog" "go.opentelemetry.io/collector/pdata/pmetric" + "go.opentelemetry.io/collector/pdata/pprofile" "go.opentelemetry.io/collector/pdata/ptrace" "go.opentelemetry.io/collector/processor" + "go.opentelemetry.io/collector/processor/processorprofiles" "go.opentelemetry.io/collector/processor/processortest" conventions "go.opentelemetry.io/collector/semconv/v1.8.0" @@ -81,6 +84,19 @@ func newLogsProcessor(cfg component.Config, nextLogsConsumer consumer.Logs, opti ) } +func newProfilesProcessor(cfg component.Config, nextProfilesConsumer consumerprofiles.Profiles, options ...option) (processorprofiles.Profiles, error) { + opts := options + opts = append(opts, withKubeClientProvider(newFakeClient)) + set := processortest.NewNopSettings() + return createProfilesProcessorWithOptions( + context.Background(), + set, + cfg, + nextProfilesConsumer, + opts..., + ) +} + // withKubeClientProvider sets the specific implementation for getting K8s Client instances func withKubeClientProvider(kcp kube.ClientProvider) option { return func(p *kubernetesprocessor) error { @@ -102,14 +118,17 @@ type multiTest struct { tp processor.Traces mp processor.Metrics lp processor.Logs + pp processorprofiles.Profiles - nextTrace *consumertest.TracesSink - nextMetrics *consumertest.MetricsSink - nextLogs *consumertest.LogsSink + nextTrace *consumertest.TracesSink + nextMetrics *consumertest.MetricsSink + nextLogs *consumertest.LogsSink + nextProfiles *consumertest.ProfilesSink - kpMetrics *kubernetesprocessor - kpTrace *kubernetesprocessor - kpLogs *kubernetesprocessor + kpMetrics *kubernetesprocessor + kpTrace *kubernetesprocessor + kpLogs *kubernetesprocessor + kpProfiles *kubernetesprocessor } func newMultiTest( @@ -119,10 +138,11 @@ func newMultiTest( options ...option, ) *multiTest { m := &multiTest{ - t: t, - nextTrace: new(consumertest.TracesSink), - nextMetrics: new(consumertest.MetricsSink), - nextLogs: new(consumertest.LogsSink), + t: t, + nextTrace: new(consumertest.TracesSink), + nextMetrics: new(consumertest.MetricsSink), + nextLogs: new(consumertest.LogsSink), + nextProfiles: new(consumertest.ProfilesSink), } tp, err := newTracesProcessor(cfg, m.nextTrace, append(options, withExtractKubernetesProcessorInto(&m.kpTrace))...) @@ -161,9 +181,22 @@ func newMultiTest( require.NoError(t, err) } + pp, err := newProfilesProcessor(cfg, m.nextProfiles, append(options, withExtractKubernetesProcessorInto(&m.kpProfiles))...) + require.NoError(t, err) + err = pp.Start(context.Background(), &nopHost{ + reportFunc: func(event *componentstatus.Event) { + errFunc(event.Err()) + }, + }) + if errFunc == nil { + assert.NotNil(t, pp) + require.NoError(t, err) + } + m.tp = tp m.mp = mp m.lp = lp + m.pp = pp return m } @@ -172,12 +205,14 @@ func (m *multiTest) testConsume( traces ptrace.Traces, metrics pmetric.Metrics, logs plog.Logs, + profiles pprofile.Profiles, errFunc func(err error), ) { errs := []error{ m.tp.ConsumeTraces(ctx, traces), m.mp.ConsumeMetrics(ctx, metrics), m.lp.ConsumeLogs(ctx, logs), + m.pp.ConsumeProfiles(ctx, profiles), } for _, err := range errs { @@ -191,24 +226,28 @@ func (m *multiTest) kubernetesProcessorOperation(kpOp func(kp *kubernetesprocess kpOp(m.kpTrace) kpOp(m.kpMetrics) kpOp(m.kpLogs) + kpOp(m.kpProfiles) } func (m *multiTest) assertBatchesLen(batchesLen int) { require.Len(m.t, m.nextTrace.AllTraces(), batchesLen) require.Len(m.t, m.nextMetrics.AllMetrics(), batchesLen) require.Len(m.t, m.nextLogs.AllLogs(), batchesLen) + require.Len(m.t, m.nextProfiles.AllProfiles(), batchesLen) } func (m *multiTest) assertResourceObjectLen(batchNo int) { assert.Equal(m.t, 1, m.nextTrace.AllTraces()[batchNo].ResourceSpans().Len()) assert.Equal(m.t, 1, m.nextMetrics.AllMetrics()[batchNo].ResourceMetrics().Len()) assert.Equal(m.t, 1, m.nextLogs.AllLogs()[batchNo].ResourceLogs().Len()) + assert.Equal(m.t, 1, m.nextProfiles.AllProfiles()[batchNo].ResourceProfiles().Len()) } func (m *multiTest) assertResourceAttributesLen(batchNo int, attrsLen int) { assert.Equal(m.t, attrsLen, m.nextTrace.AllTraces()[batchNo].ResourceSpans().At(0).Resource().Attributes().Len()) assert.Equal(m.t, attrsLen, m.nextMetrics.AllMetrics()[batchNo].ResourceMetrics().At(0).Resource().Attributes().Len()) assert.Equal(m.t, attrsLen, m.nextLogs.AllLogs()[batchNo].ResourceLogs().At(0).Resource().Attributes().Len()) + assert.Equal(m.t, attrsLen, m.nextProfiles.AllProfiles()[batchNo].ResourceProfiles().At(0).Resource().Attributes().Len()) } func (m *multiTest) assertResource(batchNum int, resourceFunc func(res pcommon.Resource)) { @@ -274,6 +313,17 @@ func generateLogs(resourceFunc ...generateResourceFunc) plog.Logs { return l } +func generateProfiles(resourceFunc ...generateResourceFunc) pprofile.Profiles { + p := pprofile.NewProfiles() + ps := p.ResourceProfiles().AppendEmpty() + for _, resFun := range resourceFunc { + res := ps.Resource() + resFun(res) + } + ps.ScopeProfiles().AppendEmpty().Profiles().AppendEmpty() + return p +} + func withPassthroughIP(passthroughIP string) generateResourceFunc { return func(res pcommon.Resource) { res.Attributes().PutStr(kube.K8sIPLabelName, passthroughIP) @@ -345,6 +395,7 @@ func TestIPDetectionFromContext(t *testing.T) { generateTraces(), generateMetrics(), generateLogs(), + generateProfiles(), func(err error) { assert.NoError(t, err) }) @@ -365,6 +416,7 @@ func TestNilBatch(t *testing.T) { ptrace.NewTraces(), pmetric.NewMetrics(), generateLogs(), + generateProfiles(), func(err error) { assert.NoError(t, err) }) @@ -399,6 +451,7 @@ func TestProcessorNoAttrs(t *testing.T) { generateTraces(), generateMetrics(), generateLogs(), + generateProfiles(), func(err error) { assert.NoError(t, err) }) @@ -428,6 +481,7 @@ func TestProcessorNoAttrs(t *testing.T) { generateTraces(), generateMetrics(), generateLogs(), + generateProfiles(), func(err error) { assert.NoError(t, err) }) @@ -445,6 +499,7 @@ func TestProcessorNoAttrs(t *testing.T) { generateTraces(), generateMetrics(), generateLogs(), + generateProfiles(), func(err error) { assert.NoError(t, err) }) @@ -461,7 +516,7 @@ func TestNoIP(t *testing.T) { nil, ) - m.testConsume(context.Background(), generateTraces(), generateMetrics(), generateLogs(), nil) + m.testConsume(context.Background(), generateTraces(), generateMetrics(), generateLogs(), generateProfiles(), nil) m.assertBatchesLen(1) m.assertResourceObjectLen(0) @@ -517,6 +572,7 @@ func TestIPSourceWithoutPodAssociation(t *testing.T) { traces := generateTraces() metrics := generateMetrics() logs := generateLogs() + profiles := generateProfiles() resources := []pcommon.Resource{ traces.ResourceSpans().At(0).Resource(), @@ -532,7 +588,7 @@ func TestIPSourceWithoutPodAssociation(t *testing.T) { } } - m.testConsume(ctx, traces, metrics, logs, nil) + m.testConsume(ctx, traces, metrics, logs, profiles, nil) m.assertBatchesLen(i + 1) m.assertResource(i, func(res pcommon.Resource) { require.Positive(t, res.Attributes().Len()) @@ -607,18 +663,20 @@ func TestIPSourceWithPodAssociation(t *testing.T) { traces := generateTraces() metrics := generateMetrics() logs := generateLogs() + profiles := generateProfiles() resources := []pcommon.Resource{ traces.ResourceSpans().At(0).Resource(), metrics.ResourceMetrics().At(0).Resource(), logs.ResourceLogs().At(0).Resource(), + profiles.ResourceProfiles().At(0).Resource(), } for _, res := range resources { res.Attributes().PutStr(tc.labelName, tc.labelValue) } - m.testConsume(ctx, traces, metrics, logs, nil) + m.testConsume(ctx, traces, metrics, logs, profiles, nil) m.assertBatchesLen(i + 1) m.assertResource(i, func(res pcommon.Resource) { require.Positive(t, res.Attributes().Len()) @@ -659,6 +717,7 @@ func TestPodUID(t *testing.T) { generateTraces(withPodUID("ef10d10b-2da5-4030-812e-5f45c1531227")), generateMetrics(withPodUID("ef10d10b-2da5-4030-812e-5f45c1531227")), generateLogs(withPodUID("ef10d10b-2da5-4030-812e-5f45c1531227")), + generateProfiles(withPodUID("ef10d10b-2da5-4030-812e-5f45c1531227")), nil) m.assertBatchesLen(1) @@ -719,6 +778,7 @@ func TestAddPodLabels(t *testing.T) { generateTraces(), generateMetrics(), generateLogs(), + generateProfiles(), func(err error) { assert.NoError(t, err) }) @@ -796,6 +856,7 @@ func TestAddNamespaceLabels(t *testing.T) { generateTraces(), generateMetrics(), generateLogs(), + generateProfiles(), func(err error) { assert.NoError(t, err) }) @@ -868,6 +929,7 @@ func TestAddNodeLabels(t *testing.T) { generateTraces(), generateMetrics(), generateLogs(), + generateProfiles(), func(err error) { assert.NoError(t, err) }) @@ -933,6 +995,7 @@ func TestAddNodeUID(t *testing.T) { generateTraces(), generateMetrics(), generateLogs(), + generateProfiles(), func(err error) { assert.NoError(t, err) }) @@ -1215,6 +1278,7 @@ func TestProcessorAddContainerAttributes(t *testing.T) { generateTraces(tt.resourceGens...), generateMetrics(tt.resourceGens...), generateLogs(tt.resourceGens...), + generateProfiles(tt.resourceGens...), nil, ) @@ -1266,6 +1330,7 @@ func TestProcessorPicksUpPassthoughPodIp(t *testing.T) { generateTraces(withPassthroughIP("2.2.2.2")), generateMetrics(withPassthroughIP("2.2.2.2")), generateLogs(withPassthroughIP("2.2.2.2")), + generateProfiles(withPassthroughIP("2.2.2.2")), func(err error) { assert.NoError(t, err) }) diff --git a/processor/k8sattributesprocessor/testdata/e2e/clusterrbac/collector/deployment.yaml b/processor/k8sattributesprocessor/testdata/e2e/clusterrbac/collector/deployment.yaml index a2011605a3e0..70dc41d4beb4 100644 --- a/processor/k8sattributesprocessor/testdata/e2e/clusterrbac/collector/deployment.yaml +++ b/processor/k8sattributesprocessor/testdata/e2e/clusterrbac/collector/deployment.yaml @@ -21,6 +21,7 @@ spec: command: - /otelcontribcol - --config=/conf/relay.yaml + - --feature-gates=service.profilesSupport image: "otelcontribcol:latest" imagePullPolicy: Never ports: diff --git a/processor/k8sattributesprocessor/testdata/e2e/mixrbac/collector/deployment.yaml b/processor/k8sattributesprocessor/testdata/e2e/mixrbac/collector/deployment.yaml index 14860e9513fd..36f669cf952b 100644 --- a/processor/k8sattributesprocessor/testdata/e2e/mixrbac/collector/deployment.yaml +++ b/processor/k8sattributesprocessor/testdata/e2e/mixrbac/collector/deployment.yaml @@ -21,6 +21,7 @@ spec: command: - /otelcontribcol - --config=/conf/relay.yaml + - --feature-gates=service.profilesSupport image: "otelcontribcol:latest" imagePullPolicy: Never ports: diff --git a/processor/k8sattributesprocessor/testdata/e2e/namespaced_rbac_no_pod_ip/collector/deployment.yaml b/processor/k8sattributesprocessor/testdata/e2e/namespaced_rbac_no_pod_ip/collector/deployment.yaml index bc1ee38dfd38..5b0d166325c8 100644 --- a/processor/k8sattributesprocessor/testdata/e2e/namespaced_rbac_no_pod_ip/collector/deployment.yaml +++ b/processor/k8sattributesprocessor/testdata/e2e/namespaced_rbac_no_pod_ip/collector/deployment.yaml @@ -21,6 +21,7 @@ spec: command: - /otelcontribcol - --config=/conf/relay.yaml + - --feature-gates=service.profilesSupport image: "otelcontribcol:latest" imagePullPolicy: Never ports: diff --git a/processor/k8sattributesprocessor/testdata/e2e/namespacedrbac/collector/deployment.yaml b/processor/k8sattributesprocessor/testdata/e2e/namespacedrbac/collector/deployment.yaml index b7ae9cb34342..a0f6ca56d1ff 100644 --- a/processor/k8sattributesprocessor/testdata/e2e/namespacedrbac/collector/deployment.yaml +++ b/processor/k8sattributesprocessor/testdata/e2e/namespacedrbac/collector/deployment.yaml @@ -21,6 +21,7 @@ spec: command: - /otelcontribcol - --config=/conf/relay.yaml + - --feature-gates=service.profilesSupport image: "otelcontribcol:latest" imagePullPolicy: Never ports: