Posts

Showing posts with the label opentelemetry

.NET Metrics

Image
Introduction I recently posted about OpenTelemetry , and I mentioned metrics there, as it's an important part of observability . On this post I will dig a bit more about metrics, what they are and how they are used by .NET and ASP.NET Core. Very important, these definitions match the observability/ OpenTelemetry  standard, specifically, the Metrics API , and are designed to work together. Creating Metrics There are different kinds of metrics, and they are all usually created from the  Meter  class, part of the .NET System.Diagnostics.Metrics API. A  Meter  has a name ( Name ), an optional scope ( Scope ), an optional version ( Version ), and some optional tags ( Tags ), all unchangeable and initialised at constructor time, except tags. Besides this, it has build methods for all supported meters/instrument types. It can be constructed directly: var meter = new Meter("Some.Meter", version: "1.0.0"); The  Meter  class is disposable , so make sure you dis...

OpenTelemetry with ASP.NET Core

Image
Introduction I wrote a post not too long ago about the building blocks of telemetry , or distributed tracing , with ASP.NET Core. Now I'm going to talk about how we can see it working using an open source bundle, otel-lgtm . Mind you, this may not be 100% suitable for production, but for development purposes, it should be fine, all concepts apply, of course. I won't cover everything about OpenTelemetry here, but should hopefully give you some insights as to what's there and how you can make good use of it. First, lets see what some of the concepts are. If you're interested in learning more about metrics, I suggest having a look at my post on this topic . OpenTelemetry OpenTelemetry  (OTel) provides a single, open-source standard, and a set of technologies to capture and export metrics, traces, and logs from your cloud-native applications and infrastructure. OTel is both a standard and a reference implementation that builds on other standards, such as W3C Distributed Tr...

ASP.NET Core Distributed Tracing

Image
Introduction Distributed tracing is a technique that allows us to detect failures and performance issues in distributed applications. For example, you send a request to a web app and this web app needs, in turn, to talk to one or more microservices, and possibly some of these microservices need also to talk to others. Distributed tracing is a way to correlate all these calls under the same umbrella. This is usually achieved through special request headers that must be present for distributed tracing to take place. ASP.NET Core offers mechanisms to make our lives easier when working with these headers, which is an implementation of the OpenTelemetry standard.  OpenTelemetry  is an observability framework and toolkit designed to create and manage telemetry data such as traces, metrics, and logs. For now, we'll focus on the building blocks of distributed tracing. You can think of a distributed trace as a transaction with an identifier and many operations, which are ocorring on ...