Skip to content

service.namespace can be set from the Docker swarm labels #9828

Open
@trajano

Description

@trajano

Is your feature request related to a problem? Please describe.

I see that the service.name is obtained but I was thinking if it can detect it based on Docker container labels.

Describe the solution you'd like

Assuming we can add docker-java to the instrumentation and you can get

if label "com.docker.swarm.task" exists {
  service.namespace= label "com.docker.stack.namespace"
  service.name=label "com.docker.swarm.service.name"
}

Describe alternatives you've considered

I guess I can always put it in as an environment variables like this

OTEL_SERVICE_NAME: '{{.Service.Name}}'
OTEL_RESOURCE_ATTRIBUTES: >
  service.instance.id={{.Task.Name}},
  service.namespace={{index .Service.Labels "com.docker.stack.namespace"}}

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestneeds triageNew issue that requires triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions