Closed AntonioLyubchev closed 1 day ago
Oops replied here because I saw that comment before this issue:
Let's use this as an issue to track fixing otel.experimental.resource.disabled-keys
to apply to the default attributes included in Resource.getDefault()
@jack-berg I see that the disabled keys option is labeled: "This option is experimental and subject to change or removal." But I think this is incredibly important to be present since we need to control what's added to the structured log.
@jack-berg ahh.... found it
The yaml format is restricted to comma separated list. Found it after some debugging and digging:
This solves the issue with the SDK attributes:
otel:
experimental:
resource:
disabled:
keys: "telemetry.sdk.language,telemetry.sdk.name,telemetry.sdk.version,data_stream.type,SeverityNumber"
However, SeverityNumber and data_stream.type are still present in the final log.
I assume it's because the functionality removes only "Resources", but in that case how do we remove other unnecessary fields?
On a side note, can I log somehow the JSON message to the console for debugging purposes? Since the collector's "debug" exporter doesn't show the literal JSON message in the output.
But I think this is incredibly important to be present since we need to control what's added to the structured log.
I agree. All of our properties go through a maturation cycle where they start as experimental for a period of time before being promoted to stable, with all the strong backwards compatibility guarantees. otel.experimental.resource.disabled-keys
has been around for a while and its probably time to consider stabilizing it.
However, SeverityNumber and data_stream.type are still present in the final log. I assume it's because the functionality removes only "Resources", but in that case how do we remove other unnecessary fields?
SeverityNumber is a top level field in the log data model, so resource attribute configuration has no affect. If you're using the collector, you may be able to remove it with the transformprocessor (haven't confirmed this but its what I would try).
I'm not sure what data_stream.type
is. It may be some artifact of the serializer used to print the data.
On a side note, can I log somehow the JSON message to the console for debugging purposes? Since the collector's "debug" exporter doesn't show the literal JSON message in the output.
You may be interested in the collector's fileexporter, which prints the OTLP JSON encoding of messages to files.
In opentelemetry-java
we publish OtlpJsonLogging{Signal}Exporter
s out of io.opentelemetry:opentelemetry-exporter-logging-otlp
. These are configured by setting OTEL_LOGS_EXPORTER=logging-otlp
, as disusssed here.
Closing as there is no more work here.
A good idea would be documenting that most yaml properties strictly rely on comma separated list.
A good idea would be documenting that most yaml properties strictly rely on comma separated list.
The YAML format you reference isn't defined as part of this repo. I believe its specific to the spring boot autoconfigure module. Maybe @zeitlinger, @jeanbisutti can comment.
the spring starter does support native lists - if proper support is added here - I simply forgot that one
Here's the PR to fix this https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/12434
Describe the bug Failure to disable resource properties from a structured log message.
I want to log only resource attributes I set in the configuration YAML, so I added
Which almost did the job, I still get:
I tried using:
Steps to reproduce Create a project using Spring Boot Starter and configure otlp export to collector through grpc. Produce a log message. Observe the log message in elastic through the elastic exporter.
What did you expect to see? When specifying
io.opentelemetry.sdk.autoconfigure.internal.EnvironmentResourceProvider
I expected to see onlysince this is what I have set in the application yaml.
What did you see instead? I saw an additional resource in the structured log message:
Full YAML config:
What version and what artifacts are you using? How did you reference these artifacts? pom.xml
Environment Compiler: coretto-21.0.4 OS: Windows 11
Additional context Just to note:
io.opentelemetry.sdk.autoconfigure.internal.EnvironmentResourceProvider
is not described here: https://opentelemetry.io/docs/languages/java/configuration/#resourceproviderAlso, can you please tell me how can I toggle all the other attributes present in the structured log: For example, I don't want: