.NET on AWS Blog
Announcing the general availability of AWS .NET OpenTelemetry libraries
Observability has become a crucial aspect of modern software development, enabling developers to gain insights into the behavior and performance of their applications. The OpenTelemetry project, a Cloud Native Computing Foundation (CNCF) hosted project, has emerged as a powerful solution for generating, collecting, and exporting telemetry data, providing a vendor-neutral and standardized approach to observability.
AWS customers have been able to use OpenTelemetry in their dotnet workloads since the initial release of the OpenTelemetry.Contrib.Extensions.AWSXRay and OpenTelemetry.Contrib.Instrumentation.AWS NuGet packages in February 2021.
Today we’re excited to announce that the latest iteration of these packages have been released and are available in NuGet. The packages have been reworked for simplicity and to conform to the latest OpenTelemetry naming conventions. They include new features like support for enhanced observability in AWS SDK for .NET and additional instrumentation for AWS services, including Amazon Bedrock, as well as multiple bug fixes, enhancements and contributions by the OpenTelemetry community.
What’s new?
This release introduces new package names without the former Contrib portion. The details for these updated packages are as follows:
- OpenTelemetry.Instrumentation.AWS – Enhances metrics and tracing calls with additional data about AWS services while using AWS SDK for .NET.
- OpenTelemetry.Instrumentation.AWSLambda – SDK methods to instrument AWS Lambda Handler to create incoming spans.
- OpenTelemetry.Resources.AWS – AWS specific resource detectors to enhance telemetry with metadata based on where your application is running. Includes support for Amazon EC2, AWS Elastic Beanstalk, Amazon Elastic Container Service (Amazon ECS), and Amazon Elastic Kubernetes Service (Amazon EKS).
- OpenTelemetry.Extensions.AWS – Supports Trace Context propagation via AWS X-Ray.
Installation
Add one or more of the packages above to your Project. This can be done, among other ways, via the dotnet CLIi:
dotnet add package OpenTelemetry.Instrumentation.AWS
Then, use the extensions methods, such as AddAWSInstrumentation
, when building your OpenTelemetry Trace Provider or Metrics Provider:
For example, in the beginning of a Program.cs for a console application:
The AddAWSInstrumentation
method seamlessly integrates OpenTelemetry tracing into your application. The AddConsoleExporter
method adds a simple console exporter for your OpenTelemetry data. For a full example, read through the Enhancing Observability in the AWS SDK for .NET with OpenTelemetry blog post.
Because of the OpenTelemetry naming convention change, you must replace previous versions of the AWS OpenTelemetry extension packages:
OpenTelemetry.Contrib.Instrumentation.AWS is now OpenTelemetry.Instrumentation.AWS
OpenTelemetry.Contrib.Extensions.AWSXRay is now OpenTelemetry.Extensions.AWS
Be sure to also update any using statements that reference the old packages with the new package names. For example:
using OpenTelemetry.Instrumentation.AWS;
using OpenTelemetry.Extensions.AWS;
Conclusion
OpenTelemetry is quickly becoming the de facto standard framework for generating, collecting, and exporting your applications observability signals. These signals can then be processed and analyzed using managed AWS Observability tools that include AWS-native solutions like Amazon CloudWatch and AWS X-Ray to managed open-source solutions like Amazon Managed Grafana and Amazon Managed Service for Prometheus.
Whether you’re a seasoned .NET developer on AWS already leveraging OpenTelemetry, integrating it into your applications for the first time, or utilizing it through .NET Aspire, we’re thrilled to introduce the latest enhancements for observability into your .NET workloads running on AWS. These improvements will provide you with deeper insights, streamlined troubleshooting, and enhanced visibility into the performance and behavior of your .NET applications deployed on the AWS platform.
Try these new libraries to implement observability in your .NET applications on AWS and give us feedback by sending an issue or creating a pull request at https://github.com/open-telemetry/opentelemetry-dotnet-contrib.
We recommend the following additional readings, which cover various topics related to this blog post.
- Enhancing Observability in the AWS SDK for .NET with OpenTelemetry
- Metrics using Amazon Managed Prometheus and Grafana
- Distributed tracing with AWS X-Ray
Finally, a big thank you to the OpenTelemetry community and especially the OpenTelemetry .NET Contrib Maintainers for collaborating with us and making this release possible!