OpenTelemetry.Resources.Container
1.21.0-beta.1
Prefix Reserved
dotnet add package OpenTelemetry.Resources.Container --version 1.21.0-beta.1
NuGet\Install-Package OpenTelemetry.Resources.Container -Version 1.21.0-beta.1
<PackageReference Include="OpenTelemetry.Resources.Container" Version="1.21.0-beta.1" />
<PackageVersion Include="OpenTelemetry.Resources.Container" Version="1.21.0-beta.1" />
<PackageReference Include="OpenTelemetry.Resources.Container" />
paket add OpenTelemetry.Resources.Container --version 1.21.0-beta.1
#r "nuget: OpenTelemetry.Resources.Container, 1.21.0-beta.1"
#:package OpenTelemetry.Resources.Container@1.21.0-beta.1
#addin nuget:?package=OpenTelemetry.Resources.Container&version=1.21.0-beta.1&prerelease
#tool nuget:?package=OpenTelemetry.Resources.Container&version=1.21.0-beta.1&prerelease
Container Resource Detectors
| Status | |
|---|---|
| Stability | Beta |
| Code Owners | @iskiselev |
Getting Started
You need to install the
OpenTelemetry.Resources.Container package to be able to use the
Container Resource Detectors.
dotnet add package OpenTelemetry.Resources.Container --prerelease
Usage
You can configure Container resource detector to
the ResourceBuilder with the following example.
using OpenTelemetry;
using OpenTelemetry.Resources.Container;
using var tracerProvider = Sdk.CreateTracerProviderBuilder()
.ConfigureResource(resource => resource.AddContainerDetector())
// other configurations
.Build();
using var meterProvider = Sdk.CreateMeterProviderBuilder()
.ConfigureResource(resource => resource.AddContainerDetector())
// other configurations
.Build();
using var loggerFactory = LoggerFactory.Create(builder =>
{
builder.AddOpenTelemetry(options =>
{
options.SetResourceBuilder(ResourceBuilder.CreateDefault().AddContainerDetector());
});
});
The resource detectors will record the following metadata based on where your application is running:
- ContainerDetector:
container.idcontainer.runtime.name(when the container runtime is Docker or Podman).
When running in Kubernetes with containerd and cgroup v2, the id of the
container is not exposed to the process inside the container. Only the id of
the pod sandbox is visible, which is shared by every container in the pod, so
it is not reported as container.id.
Adding container.id in Kubernetes
To add container.id in this environment, use the
k8sattributes processor
in the OpenTelemetry Collector. The processor does not add container.id by
default, and it can only identify the container when the telemetry it receives
includes the k8s.container.name resource attribute:
Set
k8s.container.namein your application's resource, for example by settingOTEL_RESOURCE_ATTRIBUTES=k8s.container.name=<container-name>in the container specification of the pod. This is required to identify the correct container in pods that have more than one container. Optionally, also setk8s.container.restart_count, as without it the processor cannot guarantee that the id of the current container instance is used after a container restart.Configure the processor to extract
container.id:processors: k8sattributes: extract: metadata: - container.id
References
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. net11.0 is compatible. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- OpenTelemetry (>= 1.21.0 && < 2.0.0)
-
net10.0
- OpenTelemetry (>= 1.21.0 && < 2.0.0)
-
net11.0
- OpenTelemetry (>= 1.21.0 && < 2.0.0)
NuGet packages (14)
Showing the top 5 NuGet packages that depend on OpenTelemetry.Resources.Container:
| Package | Downloads |
|---|---|
|
OpenTelemetry.AutoInstrumentation.Runtime.Managed
Managed components used by the OpenTelemetry.AutoInstrumentation project. |
|
|
Grafana.OpenTelemetry.Base
Minimal Grafana distribution of OpenTelemetry .NET |
|
|
Fluxera.Extensions.Hosting.Modules.OpenTelemetry
A module that enables OpenTelemetry monitoring. |
|
|
Indice.AspNetCore.Builder
Package Description |
|
|
SolarWindsAPM.OpenTelemetry.Agent
SolarWindsAPM .NET Open Telemetry Library |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on OpenTelemetry.Resources.Container:
| Repository | Stars |
|---|---|
|
bitfoundation/bitplatform
Build all of your apps using what you already know and love ❤️
|
| Version | Downloads | Last Updated |
|---|---|---|
| 1.21.0-beta.1 | 623 | 11/11/2026 |
| 1.20.1-beta.1 | 124,479 | 10/21/2026 |
| 1.20.0-beta.1 | 7,341 | 10/15/2026 |
| 1.19.1-beta.1 | 306,760 | 9/21/2026 |
| 1.19.0-beta.1 | 9,363 | 9/18/2026 |
| 1.18.0-beta.1 | 258,096 | 8/21/2026 |
| 1.17.0-beta.1 | 174,041 | 7/22/2026 |
| 1.16.0-beta.1 | 115,030 | 7/10/2026 |
| 1.15.1-beta.1 | 2,580,460 | 4/21/2026 |
| 1.15.0-beta.1 | 996,960 | 1/21/2026 |
| 1.14.0-beta.1 | 982,817 | 11/13/2025 |
| 1.13.0-beta.1 | 40,998 | 10/22/2025 |
| 1.12.0-beta.1 | 2,466,982 | 5/6/2025 |
| 1.11.0-beta.2 | 1,246,046 | 3/5/2025 |
| 1.11.0-beta.1 | 193,563 | 1/27/2025 |
| 1.10.0-beta.1 | 237,731 | 12/9/2024 |
| 1.0.0-beta.9 | 4,122,739 | 6/18/2024 |
| 1.0.0-beta.8 | 37,461 | 6/4/2024 |