OpenTelemetry Resource Detectors for AWS ElasticBeanstalk, EC2, ECS, EKS.
$ dotnet add package OpenTelemetry.Resources.AWS| Status | |
|---|---|
| Stability | Stable |
| Code Owners | @srprash, @normj, @lukeina2z |
You need to install the
OpenTelemetry.Resources.AWS to be able to use the
AWS Resource Detectors.
The ADOT .NET SDK supports automatically recording metadata in EC2, Elastic Beanstalk, ECS, and EKS environments.
dotnet add package OpenTelemetry.Resources.AWS
You can configure AWS resource detector to
the ResourceBuilder with the following EC2 example.
using OpenTelemetry;
using OpenTelemetry.Resources;
using var tracerProvider = Sdk.CreateTracerProviderBuilder()
.ConfigureResource(resource => resource.AddAWSEC2Detector())
// other configurations
.Build();
using var meterProvider = Sdk.CreateMeterProviderBuilder()
.ConfigureResource(resource => resource.AddAWSEC2Detector())
// other configurations
.Build();
using var loggerFactory = LoggerFactory.Create(builder =>
{
builder.AddOpenTelemetry(options =>
{
options.SetResourceBuilder(ResourceBuilder.CreateDefault().AddAWSEC2Detector());
});
});
The resource detectors will record the following metadata based on where your application is running:
For an overview on Semantic Conventions, see Open Telemetery - Semantic Conventions.
While this library is intended for production use, it relies on several Semantic Conventions that are still considered Experimental, meaning they may undergo additional changes before becoming Stable. This can impact the aggregation and analysis of telemetry signals in environments with multiple applications or microservices.
For example, a microservice using an older version of the Semantic Conventions
for Http Attributes may emit "http.method" with a value of GET, while a
different microservice, using a new version of Semantic Convention may instead
emit the GET as "http.request.method".
Future versions the OpenTelemetry.*.AWS libraries will include updates to the Semantic Convention, which may break compatibility with a previous version.
The default will remain as V1_28_0 until the next major version bump.
To opt in to automatic upgrades, you can use SemanticConventionVersion.Latest
or you can specify a specific version:
using OpenTelemetry;
using OpenTelemetry.Resources;
using var tracerProvider = Sdk.CreateTracerProviderBuilder()
.ConfigureResource(resource => resource.AddAWSEC2Detector(
opt => {
// pin to a specific Semantic Convention version
opt.SemanticConventionVersion = SemanticConventionVersion.V1_29_0;
}
))
// other configurations
.Build();
NOTE: Once a Semantic Convention becomes Stable, OpenTelemetry.*.AWS libraries will remain on that version until the next major version bump.