From 291f263b5d24e9b92d948e620a222dc257d1fcb4 Mon Sep 17 00:00:00 2001 From: Vishal Raj Date: Wed, 11 Dec 2024 18:34:25 +0000 Subject: [PATCH 1/7] [pkg/ottl]Add trace_state.adjusted_count path to span context --- .chloggen/add-adjusted-count-path.yaml | 27 ++++++++++++++++ connector/countconnector/go.mod | 1 + connector/countconnector/go.sum | 2 ++ connector/datadogconnector/go.mod | 1 + connector/routingconnector/go.mod | 1 + connector/routingconnector/go.sum | 2 ++ connector/sumconnector/go.mod | 1 + connector/sumconnector/go.sum | 2 ++ .../datadogexporter/integrationtest/go.mod | 1 + .../integrationtest/go.mod | 1 + .../integrationtest/go.sum | 2 ++ exporter/honeycombmarkerexporter/go.mod | 1 + exporter/honeycombmarkerexporter/go.sum | 2 ++ internal/filter/go.mod | 1 + internal/filter/go.sum | 2 ++ pkg/ottl/contexts/internal/span.go | 31 +++++++++++++++++++ pkg/ottl/contexts/internal/span_test.go | 20 ++++++++++-- pkg/ottl/go.mod | 1 + pkg/ottl/go.sum | 2 ++ processor/attributesprocessor/go.mod | 1 + processor/attributesprocessor/go.sum | 2 ++ processor/filterprocessor/go.mod | 1 + processor/filterprocessor/go.sum | 2 ++ processor/logdedupprocessor/go.mod | 1 + processor/logdedupprocessor/go.sum | 2 ++ processor/routingprocessor/go.mod | 1 + processor/routingprocessor/go.sum | 2 ++ processor/spanprocessor/go.mod | 1 + processor/spanprocessor/go.sum | 2 ++ processor/tailsamplingprocessor/go.mod | 1 + processor/tailsamplingprocessor/go.sum | 2 ++ processor/transformprocessor/go.mod | 1 + processor/transformprocessor/go.sum | 2 ++ testbed/go.mod | 1 + testbed/go.sum | 2 ++ 35 files changed, 122 insertions(+), 3 deletions(-) create mode 100644 .chloggen/add-adjusted-count-path.yaml diff --git a/.chloggen/add-adjusted-count-path.yaml b/.chloggen/add-adjusted-count-path.yaml new file mode 100644 index 000000000000..bed2321a5184 --- /dev/null +++ b/.chloggen/add-adjusted-count-path.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/ottl + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Add `adjusted_count` path for OTTL spans context + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [36572] + +# (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: [user] diff --git a/connector/countconnector/go.mod b/connector/countconnector/go.mod index 899a56f47d5e..5b6426944bf0 100644 --- a/connector/countconnector/go.mod +++ b/connector/countconnector/go.mod @@ -51,6 +51,7 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.115.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/ua-parser/uap-go v0.0.0-20240611065828-3a4781585db6 // indirect go.opentelemetry.io/collector/config/configtelemetry v0.115.1-0.20241206185113-3f3e208e71b8 // indirect diff --git a/connector/countconnector/go.sum b/connector/countconnector/go.sum index a5fef996f5cb..8584678b72e2 100644 --- a/connector/countconnector/go.sum +++ b/connector/countconnector/go.sum @@ -72,6 +72,8 @@ 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/sampling v0.115.0 h1:R9MRrO+dSkAHBQLZjuwjv2RHXHQqF2Wtm1Ki0VKD5cs= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0/go.mod h1:rKXLXmwdUVcUHwTilroKSejbg3KSwLeYzNPSpkIEnv4= 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/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= diff --git a/connector/datadogconnector/go.mod b/connector/datadogconnector/go.mod index f63e15aa8c62..58d0de96c7cd 100644 --- a/connector/datadogconnector/go.mod +++ b/connector/datadogconnector/go.mod @@ -197,6 +197,7 @@ require ( github.com/open-telemetry/opentelemetry-collector-contrib/internal/metadataproviders v0.115.0 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl v0.115.0 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry v0.115.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0 // indirect github.com/opencontainers/runtime-spec v1.1.0-rc.3 // indirect github.com/openshift/api v3.9.0+incompatible // indirect github.com/openshift/client-go v0.0.0-20210521082421-73d9475a9142 // indirect diff --git a/connector/routingconnector/go.mod b/connector/routingconnector/go.mod index aef46dedf9bc..e3c2d61f40a7 100644 --- a/connector/routingconnector/go.mod +++ b/connector/routingconnector/go.mod @@ -50,6 +50,7 @@ require ( github.com/modern-go/reflect2 v1.0.2 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.115.0 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.115.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/ua-parser/uap-go v0.0.0-20240611065828-3a4781585db6 // indirect go.opentelemetry.io/collector/config/configtelemetry v0.115.1-0.20241206185113-3f3e208e71b8 // indirect diff --git a/connector/routingconnector/go.sum b/connector/routingconnector/go.sum index 5d9c4dd2b5b3..5136b02c9204 100644 --- a/connector/routingconnector/go.sum +++ b/connector/routingconnector/go.sum @@ -71,6 +71,8 @@ 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/sampling v0.115.0 h1:R9MRrO+dSkAHBQLZjuwjv2RHXHQqF2Wtm1Ki0VKD5cs= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0/go.mod h1:rKXLXmwdUVcUHwTilroKSejbg3KSwLeYzNPSpkIEnv4= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= diff --git a/connector/sumconnector/go.mod b/connector/sumconnector/go.mod index 52e17fff39e4..a1f398184767 100644 --- a/connector/sumconnector/go.mod +++ b/connector/sumconnector/go.mod @@ -51,6 +51,7 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.115.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/ua-parser/uap-go v0.0.0-20240611065828-3a4781585db6 // indirect go.opentelemetry.io/collector/config/configtelemetry v0.115.1-0.20241206185113-3f3e208e71b8 // indirect diff --git a/connector/sumconnector/go.sum b/connector/sumconnector/go.sum index a5fef996f5cb..8584678b72e2 100644 --- a/connector/sumconnector/go.sum +++ b/connector/sumconnector/go.sum @@ -72,6 +72,8 @@ 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/sampling v0.115.0 h1:R9MRrO+dSkAHBQLZjuwjv2RHXHQqF2Wtm1Ki0VKD5cs= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0/go.mod h1:rKXLXmwdUVcUHwTilroKSejbg3KSwLeYzNPSpkIEnv4= 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/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= diff --git a/exporter/datadogexporter/integrationtest/go.mod b/exporter/datadogexporter/integrationtest/go.mod index 91e3e800b510..e07f65f7cee5 100644 --- a/exporter/datadogexporter/integrationtest/go.mod +++ b/exporter/datadogexporter/integrationtest/go.mod @@ -250,6 +250,7 @@ require ( github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl v0.115.0 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.115.0 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry v0.115.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus v0.115.0 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.0 // indirect diff --git a/exporter/elasticsearchexporter/integrationtest/go.mod b/exporter/elasticsearchexporter/integrationtest/go.mod index 0cfcd089ef68..d22c746174de 100644 --- a/exporter/elasticsearchexporter/integrationtest/go.mod +++ b/exporter/elasticsearchexporter/integrationtest/go.mod @@ -104,6 +104,7 @@ require ( github.com/open-telemetry/opentelemetry-collector-contrib/pkg/golden v0.115.0 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl v0.115.0 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.115.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza v0.115.0 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/jaeger v0.115.0 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/opencensus v0.115.0 // indirect diff --git a/exporter/elasticsearchexporter/integrationtest/go.sum b/exporter/elasticsearchexporter/integrationtest/go.sum index 7497f245523e..4e1a9aa8d918 100644 --- a/exporter/elasticsearchexporter/integrationtest/go.sum +++ b/exporter/elasticsearchexporter/integrationtest/go.sum @@ -189,6 +189,8 @@ github.com/mostynb/go-grpc-compression v1.2.3 h1:42/BKWMy0KEJGSdWvzqIyOZ95YcR9mL github.com/mostynb/go-grpc-compression v1.2.3/go.mod h1:AghIxF3P57umzqM9yz795+y1Vjs47Km/Y2FE6ouQ7Lg= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0 h1:R9MRrO+dSkAHBQLZjuwjv2RHXHQqF2Wtm1Ki0VKD5cs= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0/go.mod h1:rKXLXmwdUVcUHwTilroKSejbg3KSwLeYzNPSpkIEnv4= github.com/openzipkin/zipkin-go v0.4.3 h1:9EGwpqkgnwdEIJ+Od7QVSEIH+ocmm5nPat0G7sjsSdg= github.com/openzipkin/zipkin-go v0.4.3/go.mod h1:M9wCJZFWCo2RiY+o1eBCEMe0Dp2S5LDHcMZmk3RmK7c= github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= diff --git a/exporter/honeycombmarkerexporter/go.mod b/exporter/honeycombmarkerexporter/go.mod index 055c79bfaacc..a7db520c8c22 100644 --- a/exporter/honeycombmarkerexporter/go.mod +++ b/exporter/honeycombmarkerexporter/go.mod @@ -59,6 +59,7 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.115.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0 // 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 diff --git a/exporter/honeycombmarkerexporter/go.sum b/exporter/honeycombmarkerexporter/go.sum index 672e7542e89f..df295752d3c6 100644 --- a/exporter/honeycombmarkerexporter/go.sum +++ b/exporter/honeycombmarkerexporter/go.sum @@ -82,6 +82,8 @@ 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/sampling v0.115.0 h1:R9MRrO+dSkAHBQLZjuwjv2RHXHQqF2Wtm1Ki0VKD5cs= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0/go.mod h1:rKXLXmwdUVcUHwTilroKSejbg3KSwLeYzNPSpkIEnv4= 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= diff --git a/internal/filter/go.mod b/internal/filter/go.mod index a1b0b84d16d8..f2913e31b34a 100644 --- a/internal/filter/go.mod +++ b/internal/filter/go.mod @@ -47,6 +47,7 @@ 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/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/ua-parser/uap-go v0.0.0-20240611065828-3a4781585db6 // indirect go.opentelemetry.io/collector/config/configtelemetry v0.115.1-0.20241206185113-3f3e208e71b8 // indirect diff --git a/internal/filter/go.sum b/internal/filter/go.sum index c82373603b5d..5d1a87e8581a 100644 --- a/internal/filter/go.sum +++ b/internal/filter/go.sum @@ -76,6 +76,8 @@ 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/sampling v0.115.0 h1:R9MRrO+dSkAHBQLZjuwjv2RHXHQqF2Wtm1Ki0VKD5cs= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0/go.mod h1:rKXLXmwdUVcUHwTilroKSejbg3KSwLeYzNPSpkIEnv4= 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/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= diff --git a/pkg/ottl/contexts/internal/span.go b/pkg/ottl/contexts/internal/span.go index 607cb2e110f9..13aa8253eebe 100644 --- a/pkg/ottl/contexts/internal/span.go +++ b/pkg/ottl/contexts/internal/span.go @@ -15,6 +15,7 @@ import ( "github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal/traceutil" "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl" + "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling" ) const ( @@ -62,6 +63,10 @@ func SpanPathGetSetter[K SpanContext](path ottl.Path[K]) (ottl.GetSetter[K], err return accessSpanID[K](), nil case "trace_state": mapKey := path.Keys() + nextPath := path.Next() + if nextPath != nil && nextPath.Name() == "adjusted_count" { + return accessAdjustedCount[K](), nil + } if mapKey == nil { return accessTraceState[K](), nil } @@ -585,3 +590,29 @@ func accessStatusMessage[K SpanContext]() ottl.StandardGetSetter[K] { }, } } + +func accessAdjustedCount[K SpanContext]() ottl.StandardGetSetter[K] { + return ottl.StandardGetSetter[K]{ + Getter: func(_ context.Context, tCtx K) (any, error) { + tracestate := tCtx.GetSpan().TraceState().AsRaw() + w3cTraceState, err := sampling.NewW3CTraceState(tracestate) + if err != nil { + return float64(0), fmt.Errorf("failed to parse w3c tracestate: %w", err) + } + otTraceState := w3cTraceState.OTelValue() + if otTraceState == nil { + // If otel trace state is missing, default to 1 + return float64(1), nil + } + if len(otTraceState.TValue()) == 0 { + // For non-probabilistic sampler OR always sampling threshold, default to 1 + return float64(1), nil + } + return otTraceState.AdjustedCount(), nil + }, + Setter: func(context.Context, K, any) error { + // cannot set adjusted count + return nil + }, + } +} diff --git a/pkg/ottl/contexts/internal/span_test.go b/pkg/ottl/contexts/internal/span_test.go index 899d12493424..ddfdc587f53f 100644 --- a/pkg/ottl/contexts/internal/span_test.go +++ b/pkg/ottl/contexts/internal/span_test.go @@ -101,7 +101,7 @@ func TestSpanPathGetSetter(t *testing.T) { path: &TestPath[*spanContext]{ N: "trace_state", }, - orig: "key1=val1,key2=val2", + orig: "key1=val1,key2=val2,ot=th:c", newVal: "key=newVal", modified: func(span ptrace.Span) { span.TraceState().FromRaw("key=newVal") @@ -120,7 +120,21 @@ func TestSpanPathGetSetter(t *testing.T) { orig: "val1", newVal: "newVal", modified: func(span ptrace.Span) { - span.TraceState().FromRaw("key1=newVal,key2=val2") + span.TraceState().FromRaw("key1=newVal,key2=val2,ot=th:c") + }, + }, + { + name: "trace_state adjusted count", + path: &TestPath[*spanContext]{ + N: "trace_state", + NextPath: &TestPath[*spanContext]{ + N: "adjusted_count", + }, + }, + orig: float64(4), + newVal: float64(4), + modified: func(span ptrace.Span) { + // no-op as setters are not supported }, }, { @@ -627,7 +641,7 @@ func createSpan() ptrace.Span { span := ptrace.NewSpan() span.SetTraceID(traceID) span.SetSpanID(spanID) - span.TraceState().FromRaw("key1=val1,key2=val2") + span.TraceState().FromRaw("key1=val1,key2=val2,ot=th:c") span.SetParentSpanID(spanID2) span.SetName("bear") span.SetKind(ptrace.SpanKindServer) diff --git a/pkg/ottl/go.mod b/pkg/ottl/go.mod index c05df29241a5..53af7573be95 100644 --- a/pkg/ottl/go.mod +++ b/pkg/ottl/go.mod @@ -13,6 +13,7 @@ require ( github.com/iancoleman/strcase v0.3.0 github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.115.0 github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest v0.115.0 + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0 github.com/stretchr/testify v1.10.0 github.com/ua-parser/uap-go v0.0.0-20240611065828-3a4781585db6 go.opentelemetry.io/collector/component v0.115.1-0.20241206185113-3f3e208e71b8 diff --git a/pkg/ottl/go.sum b/pkg/ottl/go.sum index 5be279ddd94a..4175d38bbeb4 100644 --- a/pkg/ottl/go.sum +++ b/pkg/ottl/go.sum @@ -58,6 +58,8 @@ 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/sampling v0.115.0 h1:R9MRrO+dSkAHBQLZjuwjv2RHXHQqF2Wtm1Ki0VKD5cs= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0/go.mod h1:rKXLXmwdUVcUHwTilroKSejbg3KSwLeYzNPSpkIEnv4= 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/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= diff --git a/processor/attributesprocessor/go.mod b/processor/attributesprocessor/go.mod index e5b913cdafea..e8640207e9af 100644 --- a/processor/attributesprocessor/go.mod +++ b/processor/attributesprocessor/go.mod @@ -52,6 +52,7 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.115.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/ua-parser/uap-go v0.0.0-20240611065828-3a4781585db6 // indirect diff --git a/processor/attributesprocessor/go.sum b/processor/attributesprocessor/go.sum index 13243dd2675e..61fa1453caaa 100644 --- a/processor/attributesprocessor/go.sum +++ b/processor/attributesprocessor/go.sum @@ -76,6 +76,8 @@ 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/sampling v0.115.0 h1:R9MRrO+dSkAHBQLZjuwjv2RHXHQqF2Wtm1Ki0VKD5cs= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0/go.mod h1:rKXLXmwdUVcUHwTilroKSejbg3KSwLeYzNPSpkIEnv4= 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/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= diff --git a/processor/filterprocessor/go.mod b/processor/filterprocessor/go.mod index fa4a425dba01..d2eae12e9699 100644 --- a/processor/filterprocessor/go.mod +++ b/processor/filterprocessor/go.mod @@ -57,6 +57,7 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.115.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/ua-parser/uap-go v0.0.0-20240611065828-3a4781585db6 // indirect diff --git a/processor/filterprocessor/go.sum b/processor/filterprocessor/go.sum index 0909fac27d2a..4489ea87bd69 100644 --- a/processor/filterprocessor/go.sum +++ b/processor/filterprocessor/go.sum @@ -76,6 +76,8 @@ 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/sampling v0.115.0 h1:R9MRrO+dSkAHBQLZjuwjv2RHXHQqF2Wtm1Ki0VKD5cs= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0/go.mod h1:rKXLXmwdUVcUHwTilroKSejbg3KSwLeYzNPSpkIEnv4= 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/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= diff --git a/processor/logdedupprocessor/go.mod b/processor/logdedupprocessor/go.mod index a58133fc7467..b4534a8552df 100644 --- a/processor/logdedupprocessor/go.mod +++ b/processor/logdedupprocessor/go.mod @@ -59,6 +59,7 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.115.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0 // indirect github.com/ua-parser/uap-go v0.0.0-20240611065828-3a4781585db6 // indirect go.opentelemetry.io/collector/component/componentstatus v0.115.1-0.20241206185113-3f3e208e71b8 // indirect go.opentelemetry.io/collector/consumer/consumerprofiles v0.115.1-0.20241206185113-3f3e208e71b8 // indirect diff --git a/processor/logdedupprocessor/go.sum b/processor/logdedupprocessor/go.sum index 6788cc40fd6b..b2d38bd891b0 100644 --- a/processor/logdedupprocessor/go.sum +++ b/processor/logdedupprocessor/go.sum @@ -72,6 +72,8 @@ 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/sampling v0.115.0 h1:R9MRrO+dSkAHBQLZjuwjv2RHXHQqF2Wtm1Ki0VKD5cs= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0/go.mod h1:rKXLXmwdUVcUHwTilroKSejbg3KSwLeYzNPSpkIEnv4= 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/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= diff --git a/processor/routingprocessor/go.mod b/processor/routingprocessor/go.mod index e4ffbc554518..4515cf05ee1b 100644 --- a/processor/routingprocessor/go.mod +++ b/processor/routingprocessor/go.mod @@ -63,6 +63,7 @@ require ( github.com/modern-go/reflect2 v1.0.2 // indirect github.com/mostynb/go-grpc-compression v1.2.3 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.115.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/ua-parser/uap-go v0.0.0-20240611065828-3a4781585db6 // indirect go.opentelemetry.io/collector/component/componentstatus v0.115.1-0.20241206185113-3f3e208e71b8 // indirect diff --git a/processor/routingprocessor/go.sum b/processor/routingprocessor/go.sum index 67132db42fec..daf885ee6e04 100644 --- a/processor/routingprocessor/go.sum +++ b/processor/routingprocessor/go.sum @@ -80,6 +80,8 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/mostynb/go-grpc-compression v1.2.3 h1:42/BKWMy0KEJGSdWvzqIyOZ95YcR9mLPqKctH7Uo//I= github.com/mostynb/go-grpc-compression v1.2.3/go.mod h1:AghIxF3P57umzqM9yz795+y1Vjs47Km/Y2FE6ouQ7Lg= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0 h1:R9MRrO+dSkAHBQLZjuwjv2RHXHQqF2Wtm1Ki0VKD5cs= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0/go.mod h1:rKXLXmwdUVcUHwTilroKSejbg3KSwLeYzNPSpkIEnv4= 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/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= diff --git a/processor/spanprocessor/go.mod b/processor/spanprocessor/go.mod index bc24d1c86cdf..7639d3241d0b 100644 --- a/processor/spanprocessor/go.mod +++ b/processor/spanprocessor/go.mod @@ -51,6 +51,7 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.115.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/ua-parser/uap-go v0.0.0-20240611065828-3a4781585db6 // indirect diff --git a/processor/spanprocessor/go.sum b/processor/spanprocessor/go.sum index b77220b1838f..b387eeb73891 100644 --- a/processor/spanprocessor/go.sum +++ b/processor/spanprocessor/go.sum @@ -74,6 +74,8 @@ 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/sampling v0.115.0 h1:R9MRrO+dSkAHBQLZjuwjv2RHXHQqF2Wtm1Ki0VKD5cs= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0/go.mod h1:rKXLXmwdUVcUHwTilroKSejbg3KSwLeYzNPSpkIEnv4= 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/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= diff --git a/processor/tailsamplingprocessor/go.mod b/processor/tailsamplingprocessor/go.mod index f55b655a8f6d..0f5859c63d6a 100644 --- a/processor/tailsamplingprocessor/go.mod +++ b/processor/tailsamplingprocessor/go.mod @@ -57,6 +57,7 @@ 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/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/ua-parser/uap-go v0.0.0-20240611065828-3a4781585db6 // indirect go.opentelemetry.io/collector/component/componentstatus v0.115.1-0.20241206185113-3f3e208e71b8 // indirect diff --git a/processor/tailsamplingprocessor/go.sum b/processor/tailsamplingprocessor/go.sum index 5aa1fb4d2503..782f6cbb1534 100644 --- a/processor/tailsamplingprocessor/go.sum +++ b/processor/tailsamplingprocessor/go.sum @@ -72,6 +72,8 @@ 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/sampling v0.115.0 h1:R9MRrO+dSkAHBQLZjuwjv2RHXHQqF2Wtm1Ki0VKD5cs= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0/go.mod h1:rKXLXmwdUVcUHwTilroKSejbg3KSwLeYzNPSpkIEnv4= 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/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= diff --git a/processor/transformprocessor/go.mod b/processor/transformprocessor/go.mod index 28d73f6c477c..0968c32bd69d 100644 --- a/processor/transformprocessor/go.mod +++ b/processor/transformprocessor/go.mod @@ -61,6 +61,7 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.115.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/ua-parser/uap-go v0.0.0-20240611065828-3a4781585db6 // indirect diff --git a/processor/transformprocessor/go.sum b/processor/transformprocessor/go.sum index b77220b1838f..b387eeb73891 100644 --- a/processor/transformprocessor/go.sum +++ b/processor/transformprocessor/go.sum @@ -74,6 +74,8 @@ 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/sampling v0.115.0 h1:R9MRrO+dSkAHBQLZjuwjv2RHXHQqF2Wtm1Ki0VKD5cs= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0/go.mod h1:rKXLXmwdUVcUHwTilroKSejbg3KSwLeYzNPSpkIEnv4= 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/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= diff --git a/testbed/go.mod b/testbed/go.mod index d37e071db73c..2caae0fe1e25 100644 --- a/testbed/go.mod +++ b/testbed/go.mod @@ -222,6 +222,7 @@ require ( github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl v0.115.0 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.115.0 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry v0.115.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/opencensus v0.115.0 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus v0.115.0 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/signalfx v0.115.0 // indirect diff --git a/testbed/go.sum b/testbed/go.sum index f2b0e8896f53..51bab3b260b1 100644 --- a/testbed/go.sum +++ b/testbed/go.sum @@ -556,6 +556,8 @@ github.com/onsi/ginkgo/v2 v2.13.0 h1:0jY9lJquiL8fcf3M4LAXN5aMlS/b2BV86HFFPCPMgE4 github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o= github.com/onsi/gomega v1.29.0 h1:KIA/t2t5UBzoirT4H9tsML45GEbo3ouUnBHsCfD2tVg= github.com/onsi/gomega v1.29.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0 h1:R9MRrO+dSkAHBQLZjuwjv2RHXHQqF2Wtm1Ki0VKD5cs= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0/go.mod h1:rKXLXmwdUVcUHwTilroKSejbg3KSwLeYzNPSpkIEnv4= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQb2IpWsCzug= From a4ccbcf97c16805cd2277799e7d6a238050e0b0f Mon Sep 17 00:00:00 2001 From: Vishal Raj Date: Mon, 16 Dec 2024 19:35:33 +0000 Subject: [PATCH 2/7] Return error on setting adjusted count via path --- pkg/ottl/contexts/internal/span.go | 4 ++-- pkg/ottl/contexts/internal/span_test.go | 23 +++++++++++++---------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/pkg/ottl/contexts/internal/span.go b/pkg/ottl/contexts/internal/span.go index 13aa8253eebe..f3cb2223001a 100644 --- a/pkg/ottl/contexts/internal/span.go +++ b/pkg/ottl/contexts/internal/span.go @@ -6,6 +6,7 @@ package internal // import "github.com/open-telemetry/opentelemetry-collector-co import ( "context" "encoding/hex" + "errors" "fmt" "time" @@ -611,8 +612,7 @@ func accessAdjustedCount[K SpanContext]() ottl.StandardGetSetter[K] { return otTraceState.AdjustedCount(), nil }, Setter: func(context.Context, K, any) error { - // cannot set adjusted count - return nil + return errors.New("adjusted count cannot be set") }, } } diff --git a/pkg/ottl/contexts/internal/span_test.go b/pkg/ottl/contexts/internal/span_test.go index ddfdc587f53f..daac72833575 100644 --- a/pkg/ottl/contexts/internal/span_test.go +++ b/pkg/ottl/contexts/internal/span_test.go @@ -40,11 +40,12 @@ func TestSpanPathGetSetter(t *testing.T) { newStatus.SetMessage("new status") tests := []struct { - name string - path ottl.Path[*spanContext] - orig any - newVal any - modified func(span ptrace.Span) + name string + path ottl.Path[*spanContext] + orig any + newVal any + modified func(span ptrace.Span) + expectedSetterErrMsg string }{ { name: "trace_id", @@ -131,11 +132,9 @@ func TestSpanPathGetSetter(t *testing.T) { N: "adjusted_count", }, }, - orig: float64(4), - newVal: float64(4), - modified: func(span ptrace.Span) { - // no-op as setters are not supported - }, + orig: float64(4), + newVal: float64(1), // setters not allowed + expectedSetterErrMsg: "adjusted count cannot be set", }, { name: "parent_span_id", @@ -627,6 +626,10 @@ func TestSpanPathGetSetter(t *testing.T) { assert.Equal(t, tt.orig, got) err = accessor.Set(context.Background(), newSpanContext(span), tt.newVal) + if tt.expectedSetterErrMsg != "" { + assert.ErrorContains(t, err, tt.expectedSetterErrMsg) + return + } assert.NoError(t, err) expectedSpan := createSpan() From b9e7f27168bd0f63e0673cbf7cbbbbf9c0b0290f Mon Sep 17 00:00:00 2001 From: Vishal Raj Date: Mon, 16 Dec 2024 19:55:10 +0000 Subject: [PATCH 3/7] make checks --- connector/countconnector/go.mod | 2 ++ connector/countconnector/go.sum | 2 -- connector/routingconnector/go.mod | 2 ++ connector/routingconnector/go.sum | 2 -- connector/sumconnector/go.mod | 2 ++ connector/sumconnector/go.sum | 2 -- exporter/elasticsearchexporter/integrationtest/go.mod | 2 ++ exporter/elasticsearchexporter/integrationtest/go.sum | 2 -- exporter/honeycombmarkerexporter/go.mod | 2 ++ exporter/honeycombmarkerexporter/go.sum | 2 -- internal/filter/go.mod | 2 ++ internal/filter/go.sum | 2 -- pkg/ottl/go.mod | 2 ++ pkg/ottl/go.sum | 2 -- processor/attributesprocessor/go.mod | 2 ++ processor/attributesprocessor/go.sum | 2 -- processor/cumulativetodeltaprocessor/go.mod | 2 ++ processor/filterprocessor/go.mod | 2 ++ processor/filterprocessor/go.sum | 2 -- processor/logdedupprocessor/go.mod | 2 ++ processor/logdedupprocessor/go.sum | 2 -- processor/routingprocessor/go.mod | 2 ++ processor/routingprocessor/go.sum | 2 -- processor/spanprocessor/go.mod | 2 ++ processor/spanprocessor/go.sum | 2 -- processor/tailsamplingprocessor/go.mod | 2 ++ processor/tailsamplingprocessor/go.sum | 2 -- processor/transformprocessor/go.mod | 2 ++ processor/transformprocessor/go.sum | 2 -- receiver/hostmetricsreceiver/go.mod | 2 ++ testbed/go.mod | 2 ++ testbed/go.sum | 2 -- 32 files changed, 34 insertions(+), 30 deletions(-) diff --git a/connector/countconnector/go.mod b/connector/countconnector/go.mod index 42771de911ae..8ad13c6a4d8d 100644 --- a/connector/countconnector/go.mod +++ b/connector/countconnector/go.mod @@ -94,3 +94,5 @@ retract ( ) replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/golden => ../../pkg/golden + +replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling => ../../pkg/sampling diff --git a/connector/countconnector/go.sum b/connector/countconnector/go.sum index 65aab3c61a75..977df118f9a6 100644 --- a/connector/countconnector/go.sum +++ b/connector/countconnector/go.sum @@ -72,8 +72,6 @@ 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/sampling v0.115.0 h1:R9MRrO+dSkAHBQLZjuwjv2RHXHQqF2Wtm1Ki0VKD5cs= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0/go.mod h1:rKXLXmwdUVcUHwTilroKSejbg3KSwLeYzNPSpkIEnv4= 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/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= diff --git a/connector/routingconnector/go.mod b/connector/routingconnector/go.mod index f4af889a75e1..e050fc455446 100644 --- a/connector/routingconnector/go.mod +++ b/connector/routingconnector/go.mod @@ -85,3 +85,5 @@ replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest => ../../pkg/pdatatest replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/golden => ../../pkg/golden + +replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling => ../../pkg/sampling diff --git a/connector/routingconnector/go.sum b/connector/routingconnector/go.sum index 0d84e14967a8..30d4bae57cad 100644 --- a/connector/routingconnector/go.sum +++ b/connector/routingconnector/go.sum @@ -71,8 +71,6 @@ 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/sampling v0.115.0 h1:R9MRrO+dSkAHBQLZjuwjv2RHXHQqF2Wtm1Ki0VKD5cs= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0/go.mod h1:rKXLXmwdUVcUHwTilroKSejbg3KSwLeYzNPSpkIEnv4= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= diff --git a/connector/sumconnector/go.mod b/connector/sumconnector/go.mod index b04b8bdadb73..4850656d0e07 100644 --- a/connector/sumconnector/go.mod +++ b/connector/sumconnector/go.mod @@ -89,3 +89,5 @@ replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/golden => replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil => ../../pkg/pdatautil replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest => ../../pkg/pdatatest + +replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling => ../../pkg/sampling diff --git a/connector/sumconnector/go.sum b/connector/sumconnector/go.sum index 65aab3c61a75..977df118f9a6 100644 --- a/connector/sumconnector/go.sum +++ b/connector/sumconnector/go.sum @@ -72,8 +72,6 @@ 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/sampling v0.115.0 h1:R9MRrO+dSkAHBQLZjuwjv2RHXHQqF2Wtm1Ki0VKD5cs= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0/go.mod h1:rKXLXmwdUVcUHwTilroKSejbg3KSwLeYzNPSpkIEnv4= 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/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= diff --git a/exporter/elasticsearchexporter/integrationtest/go.mod b/exporter/elasticsearchexporter/integrationtest/go.mod index ed3a6c54f91c..0224f005a5aa 100644 --- a/exporter/elasticsearchexporter/integrationtest/go.mod +++ b/exporter/elasticsearchexporter/integrationtest/go.mod @@ -312,3 +312,5 @@ replace github.com/open-telemetry/opentelemetry-collector-contrib/connector/rout replace github.com/open-telemetry/opentelemetry-collector-contrib/internal/exp/metrics => ../../../internal/exp/metrics replace github.com/open-telemetry/opentelemetry-collector-contrib/internal/pdatautil => ../../../internal/pdatautil + +replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling => ../../../pkg/sampling diff --git a/exporter/elasticsearchexporter/integrationtest/go.sum b/exporter/elasticsearchexporter/integrationtest/go.sum index c6c5d34ff8f0..440df230a59b 100644 --- a/exporter/elasticsearchexporter/integrationtest/go.sum +++ b/exporter/elasticsearchexporter/integrationtest/go.sum @@ -189,8 +189,6 @@ github.com/mostynb/go-grpc-compression v1.2.3 h1:42/BKWMy0KEJGSdWvzqIyOZ95YcR9mL github.com/mostynb/go-grpc-compression v1.2.3/go.mod h1:AghIxF3P57umzqM9yz795+y1Vjs47Km/Y2FE6ouQ7Lg= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0 h1:R9MRrO+dSkAHBQLZjuwjv2RHXHQqF2Wtm1Ki0VKD5cs= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0/go.mod h1:rKXLXmwdUVcUHwTilroKSejbg3KSwLeYzNPSpkIEnv4= github.com/openzipkin/zipkin-go v0.4.3 h1:9EGwpqkgnwdEIJ+Od7QVSEIH+ocmm5nPat0G7sjsSdg= github.com/openzipkin/zipkin-go v0.4.3/go.mod h1:M9wCJZFWCo2RiY+o1eBCEMe0Dp2S5LDHcMZmk3RmK7c= github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= diff --git a/exporter/honeycombmarkerexporter/go.mod b/exporter/honeycombmarkerexporter/go.mod index 4b0c14b632c0..eae22601edd7 100644 --- a/exporter/honeycombmarkerexporter/go.mod +++ b/exporter/honeycombmarkerexporter/go.mod @@ -111,3 +111,5 @@ replace github.com/open-telemetry/opentelemetry-collector-contrib/internal/corei replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil => ../../pkg/pdatautil replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/golden => ../../pkg/golden + +replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling => ../../pkg/sampling diff --git a/exporter/honeycombmarkerexporter/go.sum b/exporter/honeycombmarkerexporter/go.sum index e1f073048d5e..9bb0aff7f27d 100644 --- a/exporter/honeycombmarkerexporter/go.sum +++ b/exporter/honeycombmarkerexporter/go.sum @@ -82,8 +82,6 @@ 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/sampling v0.115.0 h1:R9MRrO+dSkAHBQLZjuwjv2RHXHQqF2Wtm1Ki0VKD5cs= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0/go.mod h1:rKXLXmwdUVcUHwTilroKSejbg3KSwLeYzNPSpkIEnv4= 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= diff --git a/internal/filter/go.mod b/internal/filter/go.mod index 5c4abb5645b9..01d43ae8bce1 100644 --- a/internal/filter/go.mod +++ b/internal/filter/go.mod @@ -84,3 +84,5 @@ retract ( replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest => ../../pkg/pdatatest replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/golden => ../../pkg/golden + +replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling => ../../pkg/sampling diff --git a/internal/filter/go.sum b/internal/filter/go.sum index 51aaac7e9f7d..1513a0213fc2 100644 --- a/internal/filter/go.sum +++ b/internal/filter/go.sum @@ -76,8 +76,6 @@ 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/sampling v0.115.0 h1:R9MRrO+dSkAHBQLZjuwjv2RHXHQqF2Wtm1Ki0VKD5cs= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0/go.mod h1:rKXLXmwdUVcUHwTilroKSejbg3KSwLeYzNPSpkIEnv4= 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/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= diff --git a/pkg/ottl/go.mod b/pkg/ottl/go.mod index 7a34f2eccb1d..e9efdd8f6799 100644 --- a/pkg/ottl/go.mod +++ b/pkg/ottl/go.mod @@ -70,3 +70,5 @@ replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest => ../pdatatest replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/golden => ../golden + +replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling => ../sampling diff --git a/pkg/ottl/go.sum b/pkg/ottl/go.sum index 81a38b7c97cd..d792c07b6a5c 100644 --- a/pkg/ottl/go.sum +++ b/pkg/ottl/go.sum @@ -58,8 +58,6 @@ 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/sampling v0.115.0 h1:R9MRrO+dSkAHBQLZjuwjv2RHXHQqF2Wtm1Ki0VKD5cs= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0/go.mod h1:rKXLXmwdUVcUHwTilroKSejbg3KSwLeYzNPSpkIEnv4= 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/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= diff --git a/processor/attributesprocessor/go.mod b/processor/attributesprocessor/go.mod index bf3810cb8128..bfaca8728a58 100644 --- a/processor/attributesprocessor/go.mod +++ b/processor/attributesprocessor/go.mod @@ -99,3 +99,5 @@ retract ( ) replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/golden => ../../pkg/golden + +replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling => ../../pkg/sampling diff --git a/processor/attributesprocessor/go.sum b/processor/attributesprocessor/go.sum index 79da19d84b93..6e2e6823750c 100644 --- a/processor/attributesprocessor/go.sum +++ b/processor/attributesprocessor/go.sum @@ -76,8 +76,6 @@ 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/sampling v0.115.0 h1:R9MRrO+dSkAHBQLZjuwjv2RHXHQqF2Wtm1Ki0VKD5cs= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0/go.mod h1:rKXLXmwdUVcUHwTilroKSejbg3KSwLeYzNPSpkIEnv4= 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/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= diff --git a/processor/cumulativetodeltaprocessor/go.mod b/processor/cumulativetodeltaprocessor/go.mod index a8b21a73265d..84b8e6d14afb 100644 --- a/processor/cumulativetodeltaprocessor/go.mod +++ b/processor/cumulativetodeltaprocessor/go.mod @@ -76,3 +76,5 @@ replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest => ../../pkg/pdatatest replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/golden => ../../pkg/golden + +replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling => ../../pkg/sampling diff --git a/processor/filterprocessor/go.mod b/processor/filterprocessor/go.mod index 2aec0820e386..67c98b3b79bb 100644 --- a/processor/filterprocessor/go.mod +++ b/processor/filterprocessor/go.mod @@ -97,3 +97,5 @@ retract ( replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest => ../../pkg/pdatatest replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/golden => ../../pkg/golden + +replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling => ../../pkg/sampling diff --git a/processor/filterprocessor/go.sum b/processor/filterprocessor/go.sum index d9b273bfe4f5..844b8ec08835 100644 --- a/processor/filterprocessor/go.sum +++ b/processor/filterprocessor/go.sum @@ -76,8 +76,6 @@ 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/sampling v0.115.0 h1:R9MRrO+dSkAHBQLZjuwjv2RHXHQqF2Wtm1Ki0VKD5cs= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0/go.mod h1:rKXLXmwdUVcUHwTilroKSejbg3KSwLeYzNPSpkIEnv4= 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/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= diff --git a/processor/logdedupprocessor/go.mod b/processor/logdedupprocessor/go.mod index 119df4a11e77..c1a503f66d6d 100644 --- a/processor/logdedupprocessor/go.mod +++ b/processor/logdedupprocessor/go.mod @@ -92,3 +92,5 @@ replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl => .. replace github.com/open-telemetry/opentelemetry-collector-contrib/internal/filter => ../../internal/filter replace github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal => ../../internal/coreinternal + +replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling => ../../pkg/sampling diff --git a/processor/logdedupprocessor/go.sum b/processor/logdedupprocessor/go.sum index c3d0e5e3a8da..751300d0eb6a 100644 --- a/processor/logdedupprocessor/go.sum +++ b/processor/logdedupprocessor/go.sum @@ -72,8 +72,6 @@ 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/sampling v0.115.0 h1:R9MRrO+dSkAHBQLZjuwjv2RHXHQqF2Wtm1Ki0VKD5cs= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0/go.mod h1:rKXLXmwdUVcUHwTilroKSejbg3KSwLeYzNPSpkIEnv4= 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/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= diff --git a/processor/routingprocessor/go.mod b/processor/routingprocessor/go.mod index 41efbc4a01db..2d682d9c44f0 100644 --- a/processor/routingprocessor/go.mod +++ b/processor/routingprocessor/go.mod @@ -118,3 +118,5 @@ replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest => ../../pkg/pdatatest replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/golden => ../../pkg/golden + +replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling => ../../pkg/sampling diff --git a/processor/routingprocessor/go.sum b/processor/routingprocessor/go.sum index 540f5e1bf0c2..61c8433faaec 100644 --- a/processor/routingprocessor/go.sum +++ b/processor/routingprocessor/go.sum @@ -80,8 +80,6 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/mostynb/go-grpc-compression v1.2.3 h1:42/BKWMy0KEJGSdWvzqIyOZ95YcR9mLPqKctH7Uo//I= github.com/mostynb/go-grpc-compression v1.2.3/go.mod h1:AghIxF3P57umzqM9yz795+y1Vjs47Km/Y2FE6ouQ7Lg= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0 h1:R9MRrO+dSkAHBQLZjuwjv2RHXHQqF2Wtm1Ki0VKD5cs= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0/go.mod h1:rKXLXmwdUVcUHwTilroKSejbg3KSwLeYzNPSpkIEnv4= 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/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= diff --git a/processor/spanprocessor/go.mod b/processor/spanprocessor/go.mod index 54867019a6f2..fef341c52594 100644 --- a/processor/spanprocessor/go.mod +++ b/processor/spanprocessor/go.mod @@ -97,3 +97,5 @@ retract ( ) replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/golden => ../../pkg/golden + +replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling => ../../pkg/sampling diff --git a/processor/spanprocessor/go.sum b/processor/spanprocessor/go.sum index 7080af8c7003..c145b6a929f3 100644 --- a/processor/spanprocessor/go.sum +++ b/processor/spanprocessor/go.sum @@ -74,8 +74,6 @@ 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/sampling v0.115.0 h1:R9MRrO+dSkAHBQLZjuwjv2RHXHQqF2Wtm1Ki0VKD5cs= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0/go.mod h1:rKXLXmwdUVcUHwTilroKSejbg3KSwLeYzNPSpkIEnv4= 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/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= diff --git a/processor/tailsamplingprocessor/go.mod b/processor/tailsamplingprocessor/go.mod index cfca57fa675f..9551bca13dae 100644 --- a/processor/tailsamplingprocessor/go.mod +++ b/processor/tailsamplingprocessor/go.mod @@ -96,3 +96,5 @@ replace github.com/open-telemetry/opentelemetry-collector-contrib/internal/filte replace github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal => ../../internal/coreinternal replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/golden => ../../pkg/golden + +replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling => ../../pkg/sampling diff --git a/processor/tailsamplingprocessor/go.sum b/processor/tailsamplingprocessor/go.sum index c388b59021a8..56b39124e53b 100644 --- a/processor/tailsamplingprocessor/go.sum +++ b/processor/tailsamplingprocessor/go.sum @@ -72,8 +72,6 @@ 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/sampling v0.115.0 h1:R9MRrO+dSkAHBQLZjuwjv2RHXHQqF2Wtm1Ki0VKD5cs= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0/go.mod h1:rKXLXmwdUVcUHwTilroKSejbg3KSwLeYzNPSpkIEnv4= 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/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= diff --git a/processor/transformprocessor/go.mod b/processor/transformprocessor/go.mod index 741ac95c893c..b781fbd69681 100644 --- a/processor/transformprocessor/go.mod +++ b/processor/transformprocessor/go.mod @@ -104,3 +104,5 @@ replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/golden => replace github.com/open-telemetry/opentelemetry-collector-contrib/internal/filter => ../../internal/filter replace github.com/open-telemetry/opentelemetry-collector-contrib/internal/pdatautil => ../../internal/pdatautil + +replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling => ../../pkg/sampling diff --git a/processor/transformprocessor/go.sum b/processor/transformprocessor/go.sum index 7080af8c7003..c145b6a929f3 100644 --- a/processor/transformprocessor/go.sum +++ b/processor/transformprocessor/go.sum @@ -74,8 +74,6 @@ 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/sampling v0.115.0 h1:R9MRrO+dSkAHBQLZjuwjv2RHXHQqF2Wtm1Ki0VKD5cs= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0/go.mod h1:rKXLXmwdUVcUHwTilroKSejbg3KSwLeYzNPSpkIEnv4= 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/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= diff --git a/receiver/hostmetricsreceiver/go.mod b/receiver/hostmetricsreceiver/go.mod index d5b813568966..d495c85607c5 100644 --- a/receiver/hostmetricsreceiver/go.mod +++ b/receiver/hostmetricsreceiver/go.mod @@ -180,3 +180,5 @@ replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/golden => ../../pkg/golden replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/experimentalmetricmetadata => ../../pkg/experimentalmetricmetadata + +replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling => ../../pkg/sampling diff --git a/testbed/go.mod b/testbed/go.mod index e2bfd8626c31..716f57644fae 100644 --- a/testbed/go.mod +++ b/testbed/go.mod @@ -439,3 +439,5 @@ replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl => .. replace github.com/open-telemetry/opentelemetry-collector-contrib/internal/exp/metrics => ../internal/exp/metrics replace github.com/open-telemetry/opentelemetry-collector-contrib/internal/pdatautil => ../internal/pdatautil + +replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling => ../pkg/sampling diff --git a/testbed/go.sum b/testbed/go.sum index 6e244e599ab4..92dbb59f9208 100644 --- a/testbed/go.sum +++ b/testbed/go.sum @@ -556,8 +556,6 @@ github.com/onsi/ginkgo/v2 v2.13.0 h1:0jY9lJquiL8fcf3M4LAXN5aMlS/b2BV86HFFPCPMgE4 github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o= github.com/onsi/gomega v1.29.0 h1:KIA/t2t5UBzoirT4H9tsML45GEbo3ouUnBHsCfD2tVg= github.com/onsi/gomega v1.29.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0 h1:R9MRrO+dSkAHBQLZjuwjv2RHXHQqF2Wtm1Ki0VKD5cs= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0/go.mod h1:rKXLXmwdUVcUHwTilroKSejbg3KSwLeYzNPSpkIEnv4= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQb2IpWsCzug= From d95e209addb0f6c780a192ffe3c0d78948d67bdc Mon Sep 17 00:00:00 2001 From: Vishal Raj Date: Wed, 18 Dec 2024 11:11:48 +0000 Subject: [PATCH 4/7] make checks --- internal/filter/go.mod | 2 +- processor/tailsamplingprocessor/go.mod | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/filter/go.mod b/internal/filter/go.mod index ec6eff9d25a0..5e73877b9cd0 100644 --- a/internal/filter/go.mod +++ b/internal/filter/go.mod @@ -47,7 +47,7 @@ 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/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.116.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/ua-parser/uap-go v0.0.0-20240611065828-3a4781585db6 // indirect go.opentelemetry.io/collector/config/configtelemetry v0.116.0 // indirect diff --git a/processor/tailsamplingprocessor/go.mod b/processor/tailsamplingprocessor/go.mod index 3a8b47a8b391..d0256b5b0f00 100644 --- a/processor/tailsamplingprocessor/go.mod +++ b/processor/tailsamplingprocessor/go.mod @@ -57,7 +57,7 @@ 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/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.115.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.116.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/ua-parser/uap-go v0.0.0-20240611065828-3a4781585db6 // indirect go.opentelemetry.io/collector/component/componentstatus v0.116.0 // indirect From a680d76042cfee604e7874ad476638e4174db67f Mon Sep 17 00:00:00 2001 From: Vishal Raj Date: Mon, 23 Dec 2024 10:01:50 +0000 Subject: [PATCH 5/7] Update .chloggen/add-adjusted-count-path.yaml Co-authored-by: Evan Bradley <11745660+evan-bradley@users.noreply.github.com> --- .chloggen/add-adjusted-count-path.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.chloggen/add-adjusted-count-path.yaml b/.chloggen/add-adjusted-count-path.yaml index bed2321a5184..37ba46715693 100644 --- a/.chloggen/add-adjusted-count-path.yaml +++ b/.chloggen/add-adjusted-count-path.yaml @@ -7,7 +7,7 @@ change_type: enhancement component: pkg/ottl # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Add `adjusted_count` path for OTTL spans context +note: Add the `trace_state.adjusted_count` path in the span context # Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. issues: [36572] From c260e610f15f0458d960ad113fcce17fadfdfcf8 Mon Sep 17 00:00:00 2001 From: Vishal Raj Date: Mon, 23 Dec 2024 10:51:06 +0000 Subject: [PATCH 6/7] Add dedicated test for adjusted count --- pkg/ottl/contexts/internal/span_test.go | 37 +++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/pkg/ottl/contexts/internal/span_test.go b/pkg/ottl/contexts/internal/span_test.go index daac72833575..888e45b2bbf7 100644 --- a/pkg/ottl/contexts/internal/span_test.go +++ b/pkg/ottl/contexts/internal/span_test.go @@ -10,6 +10,7 @@ import ( "time" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "go.opentelemetry.io/collector/pdata/pcommon" "go.opentelemetry.io/collector/pdata/ptrace" @@ -640,6 +641,42 @@ func TestSpanPathGetSetter(t *testing.T) { } } +func TestAccessAdjustedCount(t *testing.T) { + for _, tc := range []struct { + tracestate string + want float64 + errMsg string + }{ + {tracestate: "", want: 1}, + {tracestate: "invalid=p:8;th:8", want: 1}, // otel trace state nil, default to 1 + {tracestate: "ot=notfound:8", want: 1}, // otel tvalue 0, default to 1 + {tracestate: "ot=404:0", errMsg: "failed to parse"}, // invalid syntax + {tracestate: "ot=th:0", want: 1}, // 100% sampling + {tracestate: "ot=th:8", want: 2}, // 50% sampling + {tracestate: "ot=th:c", want: 4}, // 25% sampling + } { + t.Run("tracestate/"+tc.tracestate, func(t *testing.T) { + span := ptrace.NewSpan() + span.TraceState().FromRaw(tc.tracestate) + + accessor, err := SpanPathGetSetter[*spanContext](&TestPath[*spanContext]{ + N: "trace_state", + NextPath: &TestPath[*spanContext]{ + N: "adjusted_count", + }, + }) + require.NoError(t, err) + got, err := accessor.Get(context.Background(), newSpanContext(span)) + if tc.errMsg != "" { + require.ErrorContains(t, err, tc.errMsg) + return + } + require.NoError(t, err) + assert.Equal(t, tc.want, got) + }) + } +} + func createSpan() ptrace.Span { span := ptrace.NewSpan() span.SetTraceID(traceID) From 8f44a8db1c106370894ffceeeaa1d340c9a83c38 Mon Sep 17 00:00:00 2001 From: Vishal Raj Date: Mon, 23 Dec 2024 11:12:14 +0000 Subject: [PATCH 7/7] make checks --- testbed/go.sum | 2 -- 1 file changed, 2 deletions(-) diff --git a/testbed/go.sum b/testbed/go.sum index 021a31df6e1f..b36485e60a2b 100644 --- a/testbed/go.sum +++ b/testbed/go.sum @@ -556,8 +556,6 @@ github.com/onsi/ginkgo/v2 v2.13.0 h1:0jY9lJquiL8fcf3M4LAXN5aMlS/b2BV86HFFPCPMgE4 github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o= github.com/onsi/gomega v1.29.0 h1:KIA/t2t5UBzoirT4H9tsML45GEbo3ouUnBHsCfD2tVg= github.com/onsi/gomega v1.29.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.104.0 h1:iNr5/wS/0Rg4PnPO2Zf3Yj4Qc1RooVQ/7U7jKzocyPo= -github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.104.0/go.mod h1:4bLfc6BnVKRp3yY+ueEUEeyNWjW/InCGbFs9ZA7o/ko= github.com/open-telemetry/opentelemetry-collector-contrib/processor/probabilisticsamplerprocessor v0.104.0 h1:W2OartqDicbzoLjAp2MCi+FIt2FBy5PyeYce0kIuerc= github.com/open-telemetry/opentelemetry-collector-contrib/processor/probabilisticsamplerprocessor v0.104.0/go.mod h1:I2so4Vn+ROaCECo0bdQXNxyUjY9tbq1JvcyuWPETLcM= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=