Open donbourne opened 3 weeks ago
The following is the resource attributes we get when running Liberty, with OpenTelemetry, using mpTelemetry-2.0, where we are emitting Liberty logs via OTLP to the Open Telemetry Collector:
From the above OTel java instrumentation agent, quite a few fields are missing, like host and OS/process information. The resource attributes we get now with mpTelemetry-2.0, is just the configured service.name and information the SDK provides.
...
{
"resourceLogs": [
{
"resource": {
"attributes": [
{
"key": "service.name",
"value": {
"stringValue": "openliberty"
}
},
{
"key": "telemetry.sdk.language",
"value": {
"stringValue": "java"
}
},
{
"key": "telemetry.sdk.name",
"value": {
"stringValue": "opentelemetry"
}
},
{
"key": "telemetry.sdk.version",
"value": {
"stringValue": "1.35.0"
}
}
]
},
...
In order to identify data sources, OpenTelemetry provides the ability to set resource attributes. These resource attributes are sent with the data signals to downstream consumers. We need to be able to run Liberty, with OpenTelemetry, using either our mpTelemetry-2.0 feature or with the OTel agent.
When running with the OTel java instrumentation agent, this is a typical set of resource attributes (as seen from the logging output from an OTel collector):
We need to ensure we have a similarly complete list of resource attributes when running without an OTel java instrumentation agent.
For guidance on how to set some of these, see https://opentelemetry.io/docs/languages/java/resources/
Should this just be provided by the user of OL by setting
otel.resource.attributes
environment variables / system properties, or should we set these values programmatically? I'm thinking that if we can easily set them programmatically, that makes more sense, as it's difficult to get all the data for host/os/process otherwise, and it would be nicer if user just has to concern themselves with custom resource attributes they may want to add.