Extend framework support with OneAgent SDK for .NET (EAP)

We recently announced beta releases of the Dynatrace OneAgent SDK for C/C++ and other native applications, Java, and Node.js, as well as the start of the early access program for the Python SDK. The OneAgent SDK enables you to extend AI-based root cause analysis to additional languages, technologies, and frameworks and also capture custom request attributes.

We’ve now added support for another technology: beginning with Dynatrace OneAgent version 1.153, we are happy to announce the early access program (EAP) of the OneAgent SDK for .NET.

Dynatrace OneAgent SDK for .NET

Dynatrace provides extensive monitoring capabilities for .NET Core and .NET Framework, including process metrics, end-to-end transaction tracing, response time analysis, insight into database calls, and CPU method hotspots. Many frameworks and database services are already supported out-of-the-box. However, some users are looking for insights into additional database systems or frameworks. With only a few lines of code and the OneAgent SDK, you can now add code-level visibility for such calls. Here’s an example.

Tracing Graph API calls to Azure Cosmos DB

Azure Cosmos DB (built on the earlier Azure DocumentDB) is Microsoft’s globally distributed, multi-model database. It is schema-less and generally classified as a NoSQL database. Cosmos DB supports several mechanism for querying the database. While the Mongo DB API is supported by our agent out-of-the-box since OneAgent version 1.151 (beta support for .NET / MongoDB), the Graph API isn’t currently supported. The Azure Cosmos DB Graph API provides graph modeling and traversal APIs using the Gremlin language.

When using the Graph API to connect to Cosmos DB, a first HTTP GET request is sent to connect to the database, as shown in the Service Flow and PurePath below. This lacks visibility into the rest of the communication between client and database, missing valuable information such as the response time baselined for each database call.

Cosmos DB initial GET request service flow Cosmos DB GET request PurePath

This leaves the database unmonitored:

Unmonitored Cosmos DB

Let’s see how we can change that with a couple of lines of code using the OneAgent SDK for .NET.

Integrating the SDK into an application

If you want to integrate the OneAgent SDK into your application, just add the following NuGet dependency package to your project: Dynatrace.OneAgent.Sdk.

The Dynatrace OneAgent SDK for .NET has no further dependencies. It can be used for both .NET Core and .NET Framework. We’ve added support for both synchronous and asynchronous methods. Here’s a simple example showing how to trace a query within a synchronous method:

var instance = OneAgentSdkFactory.CreateInstance();
var dbinfo = instance.CreateDatabaseInfo("graphdb", "CosmosDB", Dynatrace.OneAgent.Sdk.Api.Enums.ChannelType.TCP_IP, hostname);

var query = "g.V().count()";
var dbTracer = instance.TraceSQLDatabaseRequest(dbinfo, "query");

    // Create task to execute the Gremlin query.
    var task = gremlinClient.SubmitAsync<dynamic>(query);

    foreach (var result in task.Result)
        string output = JsonConvert.SerializeObject(result);
        Console.WriteLine(String.Format("\tResult:\n\t{0}", output));

    dbTracer.Error("DB call failed");

Once the change is implemented, we see the database calls appearing in the PurePath.

Cosmos DB calls in PurePath

We see that our database service graphdb now appears in the service flow and that Dynatrace detects that it contributes 88% to the response time of our requests.

Database service graphdb service flow

The Cosmos DB database is automatically detected and monitored.

Cosmos DB detected and monitored

With this added visibility, we can now work on optimizing our database access by looking at the top database requests.

graphdb top database requests

Early Access Program

The OneAgent SDK for .NET is currently available to all customers as an open EAP release with a limited feature set. We encourage you to try it out. Feel free to use and modify the sample application, play around with it, or even integrate it into your non-production .NET applications.

The OneAgent SDK for .NET is now available in an early access release.

What’s next?

Stay tuned for the following upcoming announcements:

  • Supported Beta version of the OneAgent SDK for .NET later this year
  • Continuous improvements and new features for the C/C++, Node.js, Java, Python, and .NET SDKs

We’d love to hear your feedback! The OneAgent SDK is an open source project, available on GitHub. All user contributions (from additional language bindings for the C/C++ SDK to the reporting of minor defects, issues, or typos) are welcome. The best way for you to do this is via the GitHub repository issue tracker. You can also comment on our roadmap thread in AnswerHub.

Sonja is a Technical Product Manager for Dynatrace. She has a broad technical expertise acquired from more than 15 years working in IT. Contact her at @SonjaChevre

Looking for answers?

Start a new discussion or ask for help in our Q&A forum.

Go to forum