Giter VIP home page Giter VIP logo

awslambda.net.tracing's Introduction

Trace .NET AWS Lambda Functions with Dynatrace

Distributed Tracing

Dynatrace offers an automatic instrumentation for AWS Lambda Python, Node.JS and Java via Dynatrace AWS Lambda Layer

For functions using the .NET runtime, Dynatrace provides distributed tracing for these types based on OpenTelemetry.

If you already use OpenTelemetry to instrument your functions you can ingest the telemetry either using the OpenTelemetry base functionality or using the Dynatrace (PurePath) exporter which adds additional benefits to fully leverage the automatic analysis capabilties of Dynatrace.

To make using OpenTelemetry easier, Dynatrace provides an enhanced library for AWS Lambda to reduce necessary OpenTelemetry boiler-plate code for trace-propagation, automatically applying resource attributes and initialization code as well to align with semantic conventions.

Eliminate the entry barrier

Whether you are new to OpenTelemetry or need to instrument thousands of functions or maybe just want to try out distributed tracing with minimal effort. The provided libary within this repository allows you to skip the need to fiddle around with OpenTelemetry or adding any additonal instrumentation code to your functions.

How-does it work?

The approach makes use of the aspect oriented programming (AOP) paradigm using Metalama Framework.

What is Metalama?

Metalama is a modern Roslyn-based meta-programming framework from the creators of Postsharp, which helps to improve code quality and productivity in C#. Metalama comes with a license model that can be used for free, up to 3 aspect classes per project, which allows the use of this project for no additional charge as the projects includes 1 aspect class. For more details see Metalama open source licensing

Features

The repository contains a ready-to-use nuget package, which includes an aspect to automatically instruments AWS Lambda handlers using the Dynarace AWS Lambda Instrumentation Package.

The aspect weaves distributed tracing into async as well as syncronous event handlers and supports tracecontext propagation for:

  • APIGatewayProxyRequest
  • APIGatewayHttpApiV2ProxyRequest
  • SQSEvent
  • SNSEvent

The aspect configures the OpenTelemetry trace-provider as described here and here to send the telemetry to Dynatrace and enabling built-in instrumentation for:

  • AWS SDK Instrumentation
  • and HTTPClient

How-To use

1. Add the nuget package to your project e.g. via command line.

NuGet

dotnet add package PaTh.AWSLambda.Tracing

2. Apply Dynatrace configuration

The Dynatrace package automatically reads the necessary configuration such as connection endpoints and authentication tokens, either from environment variables or a custom config file. To read more about configuration see Dynatrace Help

Examples / Testing / Debugging

In the /Examples folder you find various AWS Lambda sample functions, ready to test with e.g. The AWS .NET Mock Lambda Test Tool

Running the examples

To run the examples, you have to apply the necessary connection parameters in dtconfig.json as described in previous Step #2 - Apply Dynatrace configuration

Debugging transformed code

The provided Visual Studio solution is already prepared to debug the transformed code for the examples. For more details how to configure/debug your projects read here.

Troubleshooting

To get extensive log output to troubleshoot potential configuration issues, add the environment variable:

DT_LOGGING_DESTINATION=stdout

Troubleshooting issues when using the AWS .NET Mock Lambda Test Tool

The OpenTelemetry resource detector for AWS Lambda fails due to missing environment variables not set by the tool, which requires to set the following environment variables in the TestTool launch settings: AWS_LAMBDA_FUNCTION_VERSIONand AWS_REGION. See also the related github issue

Contribute

This is an open source project, and we gladly accept new contributions and contributors.

Support

This project is not an offical release of Dynatrace. If you have questions or any problems, open a github issue.

License

Licensed under Apache 2.0 license. See LICENSE for details.

awslambda.net.tracing's People

Contributors

dtpath avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.