-
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
OTTL 'log' function needed for debugging complex transform pipelines #30932
Comments
Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
@ringerc maybe instead of parameters a function like Ultimately what I'd really like to do some time is add tracing to OTTL/transformprocessor. It would be great to create a span for each statement and record in the trace how the telemetry was change with each statement. Since the collector can export its spans now this is doable. |
Pinging code owners for pkg/ottl: @TylerHelmuth @kentquirk @bogdandrutu @evan-bradley. See Adding Labels via Comments if you do not have permissions to add labels yourself. |
@TylerHelmuth Sounds viable, though very noisy in the logs if the context is large. This was prompted by wrestling a quite complex transform pipeline that adds different attributes for different target monitoring platform vendors. I'm hoping to get some time to actually work on the collector itself soon. |
This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
It seems I made a duplicate with #31912, lets keep the discussion here. A highlight from that issue is that I think it would be nice to be able to print the |
We should consider if a solution can be added specifically to OTTL so that any component that uses OTTL can benefit. It might be enough to add some debug logs to |
**Description:** Adds debug logging to `StatementSequence.Execute` to allow printing the state of the `TransformContext` after each statement. Example logs: ``` 2024-05-28T16:19:29.198-0600 debug [email protected]/parser.go:265 initial TransformContext {"kind": "processor", "name": "transform", "pipeline": "logs", "tCtx": {"resource": {"attributes": {}, "dropped_attribute_count": 0}, "instrumentation_scope": {"attributes": {}, "dropped_attribute_count": 0, "name": "", "version": ""}, "log_record": {"attributes": {"log.file.name": "test.log"}, "body": "test", "dropped_attribute_count": 0, "flags": 0, "observed_time_unix_nano": "2024-05-28 22:19:29.098833 +0000 UTC", "severity_number": 0, "severity_text": "", "span_id": "", "time_unix_nano": "1970-01-01 00:00:00 +0000 UTC", "trace_id": ""}, "cache": {}}} 2024-05-28T16:19:29.199-0600 debug [email protected]/parser.go:268 after transformation {"kind": "processor", "name": "transform", "pipeline": "logs", "statement": "set(attributes[\"test\"], \"pass\")", "tCtx": {"resource": {"attributes": {}, "dropped_attribute_count": 0}, "instrumentation_scope": {"attributes": {}, "dropped_attribute_count": 0, "name": "", "version": ""}, "log_record": {"attributes": {"log.file.name": "test.log", "test": "pass"}, "body": "test", "dropped_attribute_count": 0, "flags": 0, "observed_time_unix_nano": "2024-05-28 22:19:29.098833 +0000 UTC", "severity_number": 0, "severity_text": "", "span_id": "", "time_unix_nano": "1970-01-01 00:00:00 +0000 UTC", "trace_id": ""}, "cache": {}}} ``` Formatted json ```json { "kind": "processor", "name": "transform", "pipeline": "logs", "statement": "set(attributes[\"test\"], \"pass\")", "tCtx": { "resource": { "attributes": {}, "dropped_attribute_count": 0 }, "instrumentation_scope": { "attributes": {}, "dropped_attribute_count": 0, "name": "", "version": "" }, "log_record": { "attributes": { "log.file.name": "test.log", "test": "pass" }, "body": "test", "dropped_attribute_count": 0, "flags": 0, "observed_time_unix_nano": "2024-05-28 22:19:29.098833 +0000 UTC", "severity_number": 0, "severity_text": "", "span_id": "", "time_unix_nano": "1970-01-01 00:00:00 +0000 UTC", "trace_id": "" }, "cache": {} } } ``` **Link to tracking Issue:** <Issue number if applicable> Related to #30932
Component(s)
processor/transform
Is your feature request related to a problem? Please describe.
It's difficult to inspect and diagnose the behaviour of complex transform processor pipelines because of the lack of a means of inspecting the state and execution partway through the pipeline.
Answering questions like "why does this 'where' clause not match" is considerably more difficult than might be expected.
Describe the solution you'd like
An OTTL
debug_log
function that writes its argument(s) out in json form to the otel collector log stream would be very helpful. If passed multiple arguments it would log each in turn. If passed a path, it would serialize and log all children of the path, following the usual access rules.It would take a key/value pairing of log field label to log field value, and emit them through the otel collector's logger, so if json logging is turned on the results would be distinct json logging keys.
E.g.
For use in the filter processor, logging converter variants may make sense. These would take their first argument and return it unchanged, then take all additional parameters as data to emit as logs.
Describe alternatives you've considered
Presently debugging complex pipelines often involves commenting out various parts, or splitting them up into two separate processors linked by a connector with a debug exporter in the middle. It's wholly impractical.
Ideally some form of attachable debugger could be added, where it could establish a socket to the running collector and place probes dynamically. This is far beyond what's practical to add to the OTTL stack at present however.
Sometimes it's possible to get the info needed by using
set
to apply various attributes to carry the info required, then inspect with a debug exporter. But this quickly fall down for more complex transforms.Additional context
No response
The text was updated successfully, but these errors were encountered: