-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[pkg/ottl] Move debug log into Statement.Execute #36456
Merged
TylerHelmuth
merged 3 commits into
open-telemetry:main
from
TylerHelmuth:ottl-improve-telemetry
Nov 25, 2024
Merged
[pkg/ottl] Move debug log into Statement.Execute #36456
TylerHelmuth
merged 3 commits into
open-telemetry:main
from
TylerHelmuth:ottl-improve-telemetry
Nov 25, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TylerHelmuth
requested review from
bogdandrutu,
evan-bradley and
a team
as code owners
November 19, 2024 19:30
edmocosta
reviewed
Nov 20, 2024
edmocosta
approved these changes
Nov 20, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 👍
djaglowski
approved these changes
Nov 22, 2024
shivanthzen
pushed a commit
to shivanthzen/opentelemetry-collector-contrib
that referenced
this pull request
Dec 5, 2024
#### Description @tdarwin noticed that the routingconnector wasnt emitting ottl logs when debug logging was enabled. This turned out to be because we added the debug statement to `StatementSequence.Execute` but the routingconnector uses `Statement.Execute`, but it only works with single statements. This PR moves the debug log into the `Statement.Execute` function so that more components benefit from the debug logs. <!--Describe what testing was performed and which tests were added.--> #### Testing Tested locally using this config: ```yaml receivers: otlpjsonfile: include: - /Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json connectors: routing: default_pipelines: [traces/a] table: - statement: route() where attributes["service.name"] == "checkpoint-test" pipelines: [traces/b] processors: transform: error_mode: ignore trace_statements: - context: resource statements: - set(attributes["test"], "pass") exporters: debug/a: debug/b: service: telemetry: logs: level: debug pipelines: traces: receivers: - otlpjsonfile exporters: - routing traces/a: receivers: - routing exporters: - debug/a traces/b: receivers: - routing processors: - transform exporters: - debug/b ``` The collector spit out these logs: ``` ❯ ./bin/otelcontribcol_darwin_arm64 --config ./local/config.yaml 2024-11-19T12:29:41.671-0700 info service@v0.114.0/service.go:166 Setting up own telemetry... 2024-11-19T12:29:41.671-0700 info telemetry/metrics.go:70 Serving metrics {"address": "localhost:8888", "metrics level": "Normal"} 2024-11-19T12:29:41.672-0700 info builders/builders.go:26 Development component. May change in the future. {"kind": "exporter", "data_type": "traces", "name": "debug/b"} 2024-11-19T12:29:41.672-0700 debug builders/builders.go:24 Alpha component. May change in the future. {"kind": "processor", "name": "transform", "pipeline": "traces/b"} 2024-11-19T12:29:41.672-0700 info builders/builders.go:26 Development component. May change in the future. {"kind": "exporter", "data_type": "traces", "name": "debug/a"} 2024-11-19T12:29:41.672-0700 debug builders/builders.go:24 Alpha component. May change in the future. {"kind": "connector", "name": "routing", "exporter_in_pipeline": "traces", "receiver_in_pipeline": "traces"} 2024-11-19T12:29:41.673-0700 debug builders/builders.go:24 Alpha component. May change in the future. {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces"} 2024-11-19T12:29:41.673-0700 info service@v0.114.0/service.go:238 Starting otelcontribcol... {"Version": "0.114.0-dev", "NumCPU": 10} 2024-11-19T12:29:41.673-0700 info extensions/extensions.go:39 Starting extensions... 2024-11-19T12:29:41.673-0700 info service@v0.114.0/service.go:261 Everything is ready. Begin running and processing data. 2024-11-19T12:29:41.875-0700 debug fileconsumer/file.go:125 matched files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:41.875-0700 debug fileconsumer/file.go:157 Consuming files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:42.076-0700 debug fileconsumer/file.go:125 matched files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:42.076-0700 debug fileconsumer/file.go:157 Consuming files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:42.275-0700 debug fileconsumer/file.go:125 matched files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:42.275-0700 debug fileconsumer/file.go:157 Consuming files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:42.474-0700 debug fileconsumer/file.go:125 matched files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:42.474-0700 debug fileconsumer/file.go:157 Consuming files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:42.675-0700 debug fileconsumer/file.go:125 matched files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:42.675-0700 debug fileconsumer/file.go:157 Consuming files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:42.875-0700 debug fileconsumer/file.go:125 matched files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:42.875-0700 debug fileconsumer/file.go:157 Consuming files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:43.076-0700 debug fileconsumer/file.go:125 matched files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:43.076-0700 debug fileconsumer/file.go:157 Consuming files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:43.274-0700 debug fileconsumer/file.go:125 matched files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:43.274-0700 debug fileconsumer/file.go:157 Consuming files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:43.475-0700 debug fileconsumer/file.go:125 matched files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:43.475-0700 debug fileconsumer/file.go:157 Consuming files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:43.675-0700 debug fileconsumer/file.go:125 matched files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:43.675-0700 debug fileconsumer/file.go:157 Consuming files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:44.474-0700 info fileconsumer/file.go:265 Started watching file {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "path": "/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"} 2024-11-19T12:29:44.475-0700 debug ottl@v0.114.0/parser.go:34 TransformContext after statement execution {"kind": "connector", "name": "routing", "exporter_in_pipeline": "traces", "receiver_in_pipeline": "traces", "statement": "route() where attributes[\"service.name\"] == \"checkpoint-test\"", "condition matched": true, "TransformContext": {"resource": {"attributes": {"service.name": "checkpoint-test", "platform.env": "prd"}, "dropped_attribute_count": 0}, "cache": {}}} 2024-11-19T12:29:44.475-0700 debug ottl@v0.114.0/parser.go:340 initial TransformContext before executing StatementSequence {"kind": "processor", "name": "transform", "pipeline": "traces/b", "TransformContext": {"resource": {"attributes": {"service.name": "checkpoint-test", "platform.env": "prd"}, "dropped_attribute_count": 0}, "cache": {}}} 2024-11-19T12:29:44.475-0700 debug ottl@v0.114.0/parser.go:34 TransformContext after statement execution {"kind": "processor", "name": "transform", "pipeline": "traces/b", "statement": "set(attributes[\"test\"], \"pass\")", "condition matched": true, "TransformContext": {"resource": {"attributes": {"service.name": "checkpoint-test", "platform.env": "prd", "test": "pass"}, "dropped_attribute_count": 0}, "cache": {}}} 2024-11-19T12:29:44.475-0700 info Traces {"kind": "exporter", "data_type": "traces", "name": "debug/b", "resource spans": 1, "spans": 1} ^C2024-11-19T12:29:48.931-0700 info otelcol@v0.114.0/collector.go:328 Received signal from OS {"signal": "interrupt"} 2024-11-19T12:29:48.931-0700 info service@v0.114.0/service.go:303 Starting shutdown... 2024-11-19T12:29:48.931-0700 info extensions/extensions.go:66 Stopping extensions... 2024-11-19T12:29:48.931-0700 info service@v0.114.0/service.go:317 Shutdown complete. ```
ZenoCC-Peng
pushed a commit
to ZenoCC-Peng/opentelemetry-collector-contrib
that referenced
this pull request
Dec 6, 2024
#### Description @tdarwin noticed that the routingconnector wasnt emitting ottl logs when debug logging was enabled. This turned out to be because we added the debug statement to `StatementSequence.Execute` but the routingconnector uses `Statement.Execute`, but it only works with single statements. This PR moves the debug log into the `Statement.Execute` function so that more components benefit from the debug logs. <!--Describe what testing was performed and which tests were added.--> #### Testing Tested locally using this config: ```yaml receivers: otlpjsonfile: include: - /Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json connectors: routing: default_pipelines: [traces/a] table: - statement: route() where attributes["service.name"] == "checkpoint-test" pipelines: [traces/b] processors: transform: error_mode: ignore trace_statements: - context: resource statements: - set(attributes["test"], "pass") exporters: debug/a: debug/b: service: telemetry: logs: level: debug pipelines: traces: receivers: - otlpjsonfile exporters: - routing traces/a: receivers: - routing exporters: - debug/a traces/b: receivers: - routing processors: - transform exporters: - debug/b ``` The collector spit out these logs: ``` ❯ ./bin/otelcontribcol_darwin_arm64 --config ./local/config.yaml 2024-11-19T12:29:41.671-0700 info service@v0.114.0/service.go:166 Setting up own telemetry... 2024-11-19T12:29:41.671-0700 info telemetry/metrics.go:70 Serving metrics {"address": "localhost:8888", "metrics level": "Normal"} 2024-11-19T12:29:41.672-0700 info builders/builders.go:26 Development component. May change in the future. {"kind": "exporter", "data_type": "traces", "name": "debug/b"} 2024-11-19T12:29:41.672-0700 debug builders/builders.go:24 Alpha component. May change in the future. {"kind": "processor", "name": "transform", "pipeline": "traces/b"} 2024-11-19T12:29:41.672-0700 info builders/builders.go:26 Development component. May change in the future. {"kind": "exporter", "data_type": "traces", "name": "debug/a"} 2024-11-19T12:29:41.672-0700 debug builders/builders.go:24 Alpha component. May change in the future. {"kind": "connector", "name": "routing", "exporter_in_pipeline": "traces", "receiver_in_pipeline": "traces"} 2024-11-19T12:29:41.673-0700 debug builders/builders.go:24 Alpha component. May change in the future. {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces"} 2024-11-19T12:29:41.673-0700 info service@v0.114.0/service.go:238 Starting otelcontribcol... {"Version": "0.114.0-dev", "NumCPU": 10} 2024-11-19T12:29:41.673-0700 info extensions/extensions.go:39 Starting extensions... 2024-11-19T12:29:41.673-0700 info service@v0.114.0/service.go:261 Everything is ready. Begin running and processing data. 2024-11-19T12:29:41.875-0700 debug fileconsumer/file.go:125 matched files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:41.875-0700 debug fileconsumer/file.go:157 Consuming files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:42.076-0700 debug fileconsumer/file.go:125 matched files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:42.076-0700 debug fileconsumer/file.go:157 Consuming files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:42.275-0700 debug fileconsumer/file.go:125 matched files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:42.275-0700 debug fileconsumer/file.go:157 Consuming files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:42.474-0700 debug fileconsumer/file.go:125 matched files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:42.474-0700 debug fileconsumer/file.go:157 Consuming files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:42.675-0700 debug fileconsumer/file.go:125 matched files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:42.675-0700 debug fileconsumer/file.go:157 Consuming files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:42.875-0700 debug fileconsumer/file.go:125 matched files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:42.875-0700 debug fileconsumer/file.go:157 Consuming files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:43.076-0700 debug fileconsumer/file.go:125 matched files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:43.076-0700 debug fileconsumer/file.go:157 Consuming files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:43.274-0700 debug fileconsumer/file.go:125 matched files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:43.274-0700 debug fileconsumer/file.go:157 Consuming files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:43.475-0700 debug fileconsumer/file.go:125 matched files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:43.475-0700 debug fileconsumer/file.go:157 Consuming files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:43.675-0700 debug fileconsumer/file.go:125 matched files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:43.675-0700 debug fileconsumer/file.go:157 Consuming files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:44.474-0700 info fileconsumer/file.go:265 Started watching file {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "path": "/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"} 2024-11-19T12:29:44.475-0700 debug ottl@v0.114.0/parser.go:34 TransformContext after statement execution {"kind": "connector", "name": "routing", "exporter_in_pipeline": "traces", "receiver_in_pipeline": "traces", "statement": "route() where attributes[\"service.name\"] == \"checkpoint-test\"", "condition matched": true, "TransformContext": {"resource": {"attributes": {"service.name": "checkpoint-test", "platform.env": "prd"}, "dropped_attribute_count": 0}, "cache": {}}} 2024-11-19T12:29:44.475-0700 debug ottl@v0.114.0/parser.go:340 initial TransformContext before executing StatementSequence {"kind": "processor", "name": "transform", "pipeline": "traces/b", "TransformContext": {"resource": {"attributes": {"service.name": "checkpoint-test", "platform.env": "prd"}, "dropped_attribute_count": 0}, "cache": {}}} 2024-11-19T12:29:44.475-0700 debug ottl@v0.114.0/parser.go:34 TransformContext after statement execution {"kind": "processor", "name": "transform", "pipeline": "traces/b", "statement": "set(attributes[\"test\"], \"pass\")", "condition matched": true, "TransformContext": {"resource": {"attributes": {"service.name": "checkpoint-test", "platform.env": "prd", "test": "pass"}, "dropped_attribute_count": 0}, "cache": {}}} 2024-11-19T12:29:44.475-0700 info Traces {"kind": "exporter", "data_type": "traces", "name": "debug/b", "resource spans": 1, "spans": 1} ^C2024-11-19T12:29:48.931-0700 info otelcol@v0.114.0/collector.go:328 Received signal from OS {"signal": "interrupt"} 2024-11-19T12:29:48.931-0700 info service@v0.114.0/service.go:303 Starting shutdown... 2024-11-19T12:29:48.931-0700 info extensions/extensions.go:66 Stopping extensions... 2024-11-19T12:29:48.931-0700 info service@v0.114.0/service.go:317 Shutdown complete. ```
sbylica-splunk
pushed a commit
to sbylica-splunk/opentelemetry-collector-contrib
that referenced
this pull request
Dec 17, 2024
#### Description @tdarwin noticed that the routingconnector wasnt emitting ottl logs when debug logging was enabled. This turned out to be because we added the debug statement to `StatementSequence.Execute` but the routingconnector uses `Statement.Execute`, but it only works with single statements. This PR moves the debug log into the `Statement.Execute` function so that more components benefit from the debug logs. <!--Describe what testing was performed and which tests were added.--> #### Testing Tested locally using this config: ```yaml receivers: otlpjsonfile: include: - /Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json connectors: routing: default_pipelines: [traces/a] table: - statement: route() where attributes["service.name"] == "checkpoint-test" pipelines: [traces/b] processors: transform: error_mode: ignore trace_statements: - context: resource statements: - set(attributes["test"], "pass") exporters: debug/a: debug/b: service: telemetry: logs: level: debug pipelines: traces: receivers: - otlpjsonfile exporters: - routing traces/a: receivers: - routing exporters: - debug/a traces/b: receivers: - routing processors: - transform exporters: - debug/b ``` The collector spit out these logs: ``` ❯ ./bin/otelcontribcol_darwin_arm64 --config ./local/config.yaml 2024-11-19T12:29:41.671-0700 info service@v0.114.0/service.go:166 Setting up own telemetry... 2024-11-19T12:29:41.671-0700 info telemetry/metrics.go:70 Serving metrics {"address": "localhost:8888", "metrics level": "Normal"} 2024-11-19T12:29:41.672-0700 info builders/builders.go:26 Development component. May change in the future. {"kind": "exporter", "data_type": "traces", "name": "debug/b"} 2024-11-19T12:29:41.672-0700 debug builders/builders.go:24 Alpha component. May change in the future. {"kind": "processor", "name": "transform", "pipeline": "traces/b"} 2024-11-19T12:29:41.672-0700 info builders/builders.go:26 Development component. May change in the future. {"kind": "exporter", "data_type": "traces", "name": "debug/a"} 2024-11-19T12:29:41.672-0700 debug builders/builders.go:24 Alpha component. May change in the future. {"kind": "connector", "name": "routing", "exporter_in_pipeline": "traces", "receiver_in_pipeline": "traces"} 2024-11-19T12:29:41.673-0700 debug builders/builders.go:24 Alpha component. May change in the future. {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces"} 2024-11-19T12:29:41.673-0700 info service@v0.114.0/service.go:238 Starting otelcontribcol... {"Version": "0.114.0-dev", "NumCPU": 10} 2024-11-19T12:29:41.673-0700 info extensions/extensions.go:39 Starting extensions... 2024-11-19T12:29:41.673-0700 info service@v0.114.0/service.go:261 Everything is ready. Begin running and processing data. 2024-11-19T12:29:41.875-0700 debug fileconsumer/file.go:125 matched files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:41.875-0700 debug fileconsumer/file.go:157 Consuming files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:42.076-0700 debug fileconsumer/file.go:125 matched files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:42.076-0700 debug fileconsumer/file.go:157 Consuming files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:42.275-0700 debug fileconsumer/file.go:125 matched files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:42.275-0700 debug fileconsumer/file.go:157 Consuming files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:42.474-0700 debug fileconsumer/file.go:125 matched files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:42.474-0700 debug fileconsumer/file.go:157 Consuming files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:42.675-0700 debug fileconsumer/file.go:125 matched files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:42.675-0700 debug fileconsumer/file.go:157 Consuming files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:42.875-0700 debug fileconsumer/file.go:125 matched files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:42.875-0700 debug fileconsumer/file.go:157 Consuming files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:43.076-0700 debug fileconsumer/file.go:125 matched files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:43.076-0700 debug fileconsumer/file.go:157 Consuming files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:43.274-0700 debug fileconsumer/file.go:125 matched files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:43.274-0700 debug fileconsumer/file.go:157 Consuming files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:43.475-0700 debug fileconsumer/file.go:125 matched files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:43.475-0700 debug fileconsumer/file.go:157 Consuming files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:43.675-0700 debug fileconsumer/file.go:125 matched files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:43.675-0700 debug fileconsumer/file.go:157 Consuming files {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "paths": ["/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"]} 2024-11-19T12:29:44.474-0700 info fileconsumer/file.go:265 Started watching file {"kind": "receiver", "name": "otlpjsonfile", "data_type": "traces", "component": "fileconsumer", "path": "/Users/tylerhelmuth/projects/opentelemetry-collector-contrib/local/test.json"} 2024-11-19T12:29:44.475-0700 debug ottl@v0.114.0/parser.go:34 TransformContext after statement execution {"kind": "connector", "name": "routing", "exporter_in_pipeline": "traces", "receiver_in_pipeline": "traces", "statement": "route() where attributes[\"service.name\"] == \"checkpoint-test\"", "condition matched": true, "TransformContext": {"resource": {"attributes": {"service.name": "checkpoint-test", "platform.env": "prd"}, "dropped_attribute_count": 0}, "cache": {}}} 2024-11-19T12:29:44.475-0700 debug ottl@v0.114.0/parser.go:340 initial TransformContext before executing StatementSequence {"kind": "processor", "name": "transform", "pipeline": "traces/b", "TransformContext": {"resource": {"attributes": {"service.name": "checkpoint-test", "platform.env": "prd"}, "dropped_attribute_count": 0}, "cache": {}}} 2024-11-19T12:29:44.475-0700 debug ottl@v0.114.0/parser.go:34 TransformContext after statement execution {"kind": "processor", "name": "transform", "pipeline": "traces/b", "statement": "set(attributes[\"test\"], \"pass\")", "condition matched": true, "TransformContext": {"resource": {"attributes": {"service.name": "checkpoint-test", "platform.env": "prd", "test": "pass"}, "dropped_attribute_count": 0}, "cache": {}}} 2024-11-19T12:29:44.475-0700 info Traces {"kind": "exporter", "data_type": "traces", "name": "debug/b", "resource spans": 1, "spans": 1} ^C2024-11-19T12:29:48.931-0700 info otelcol@v0.114.0/collector.go:328 Received signal from OS {"signal": "interrupt"} 2024-11-19T12:29:48.931-0700 info service@v0.114.0/service.go:303 Starting shutdown... 2024-11-19T12:29:48.931-0700 info extensions/extensions.go:66 Stopping extensions... 2024-11-19T12:29:48.931-0700 info service@v0.114.0/service.go:317 Shutdown complete. ```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
@tdarwin noticed that the routingconnector wasnt emitting ottl logs when debug logging was enabled. This turned out to be because we added the debug statement to
StatementSequence.Execute
but the routingconnector usesStatement.Execute
, but it only works with single statements.This PR moves the debug log into the
Statement.Execute
function so that more components benefit from the debug logs.Testing
Tested locally using this config:
The collector spit out these logs: