Skip to content
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

Incorrect container id reported #1562

Open
1 of 2 tasks
joegoldman2 opened this issue Feb 2, 2024 · 2 comments · May be fixed by #1699
Open
1 of 2 tasks

Incorrect container id reported #1562

joegoldman2 opened this issue Feb 2, 2024 · 2 comments · May be fixed by #1699
Labels
comp:resources.container Things related to OpenTelemetry.Resources.Container

Comments

@joegoldman2
Copy link
Contributor

Issue with OpenTelemetry.ResourceDetectors.Container

List of all OpenTelemetry NuGet packages and version that you are using (e.g. OpenTelemetry 1.3.2):

  • OpenTelemetry.Exporter.OpenTelemetryProtocol 1.7.0
  • OpenTelemetry.Extensions.Hosting 1.7.0
  • OpenTelemetry.Instrumentation.AspNetCore 1.7.0
  • OpenTelemetry.ResourceDetectors.Container 1.0.0-beta.5

Is this a feature request or a bug?

  • Feature Request
  • Bug

What is the expected behavior?

The correct container id is reported in the Resource attributes.

What is the actual behavior?

The container id doesn't seem to be correct.

Otel Collector with debug exporter:

2024-02-02T09:32:08.834Z        info    ResourceSpans #0
Resource SchemaURL:
Resource attributes:
     -> container.id: Str(b7f67556f672a21eef1344ce6670797fe54e1f49bcd4fdaf8a746d2cd24acf6e)

But the output of kubectl describe pods is not reporting the same value:

> kubectl describe pods -n api
Name:             basket-api-765214ace9-6frsx
....
Containers:
  basket-api:
    Container ID:   containerd://b6e87264844654c35996d2e67b1bd7904b1620310bce307bddd92bd724124361
// rest of the output omitted for brevity

Additional Context

The application is using .NET 8 and is running on AKS.

@joegoldman2 joegoldman2 added the comp:resources.container Things related to OpenTelemetry.Resources.Container label Feb 2, 2024
@Kielek
Copy link
Contributor

Kielek commented Feb 5, 2024

@iskiselev, FYI

@iskiselev
Copy link
Contributor

iskiselev commented Feb 5, 2024

There is work in progress on workaround for the issue: #1529. It would require some tweaks form the user: allow container to fetch some metadata information from K8 API (so, give some additional rights to pod) and pass container name into pod through environment variable (can be easily done in pod description yaml).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:resources.container Things related to OpenTelemetry.Resources.Container
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants