A lightweight library for tracking application telemetry with Azure Monitor.
Authored and maintained by Stas Sultanov.
Support the author, if this library benefits your business.
For usage instructions, refer to the documentation.
This library has been developed with a strong focus on business adaptability to serve IT solutions of all kinds.
The library is guided by the following key design principles:
- Efficiency – Run fast with minimal memory usage due to lightweight codebase and low complexity.
- Responsibility – Embrace control over how telemetry is tracked and managed, with decisions left to the developer.
- Simplicity – Minimize the number of classes, relationships, and hierarchies to keep the design as lean as possible.
- Transparency – Gain full visibility into how telemetry is tracked and published, without unnecessary abstraction layers.
- Versatility – Use in any type of application, from distributed systems to standalone apps and plugins.
Strict quality standards are applied throughout the development of this library and reflected in the following safeguards:
- The repository is configured with branch protection rules targeting the main branch, including the following:
- Require signed commits.
- Require a pull request before merging, with the allowed method: Squash.
- Require code scanning results via CodeQL.
- The workflow Check is created to run on pull requests to the main branch and performs the following:
- Checks that the code builds with no errors.
- Executes unit tests with a coverage threshold of 95%.
- Executes integration tests with a coverage threshold of 75%, using a temporary Azure environment that is automatically provisioned and disposed.
- The workflow Release is created to:
- Perform artifacts attestation.
- The project build is configured to:
- Treat all warnings as errors.
- Set the warning level to MAX.
- Enforce code style in the build via editorconfig.
- Use dotNet analyzers with analysis level latest-all.
- Ensure that all public members are documented.
Why build or use a custom library when Microsoft already provides an official SDK?
There are several technical reasons why this library was developed:
- The OpenTelemetry with Azure.Monitor.OpenTelemetry.Exporter is not designed for plugin development.
Implementation relies on static members that do not implement a thread-safe singleton pattern. - The Microsoft.ApplicationInsights has critical flaw in its implementation.
Entra authentication is implemented in a way that makes it impossible to use the library for plugin development.
The issue is described by the author here, with no expectation that it will ever be fixed. - Both Microsoft.ApplicationInsights and OpenTelemetry with Azure.Monitor.OpenTelemetry.Exporter are extremely heavy in some applications like NET462.
See the comparison below for a breakdown of size and complexity.
A comparison of sizes and file counts of libraries when used with Entra-based authentication:
Package(s) | NET462 | NET8 | NET9 |
---|---|---|---|
Stas.Azure.Monitor.Telemetry 1.2.0 | Files: 1 Size: 64KB |
Files: 1 Size: 63KB |
Files: 1 Size: 63KB |
Microsoft.ApplicationInsights 2.23.0 Azure.Core 1.45.0 |
Files: 109 Size: 4644KB |
Files: 5 Size: 945KB |
Files: 5 Size: 945KB |
OpenTelemetry 1.11.2 Azure.Monitor.OpenTelemetry.Exporter 1.3.0 |
Files: 126 Size: 5250KB |
Files: 23 Size: 1887KB |
Files: 22 Size: 1728KB |
Donations express appreciation for the author’s dedication and the substantial effort invested in creating this library.
The author resides in a country affected by ongoing military conflict since February 2022.
Due to the war, securing stable income is extremely difficult, and donations provide essential support.
If you’d like to make a donation, please use the button below:
Any support is much appreciated!