Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pkg/ottl] Add debug logging (#33274)
**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 ottl@v0.101.0/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 ottl@v0.101.0/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
- Loading branch information