# Using Microsoft.Extensions.Telemetry.Abstractions Source Generators for Strongly Typed .NET Metrics

DevFeed: [Using Microsoft.Extensions.Telemetry.Abstractions Source Generators for Strongly Typed .NET Metrics](<https://devfeed.tech/articles/exploring-the-underwhelming-system-diagnostics-metrics-source-generators-system-diagnostics-metrics-apis-part-2-51472.md>)

Original publisher: [Read original article](<https://andrewlock.net/creating-strongly-typed-metics-with-a-source-generator/>)

Author: Andrew Lock

Published: 2026-02-03T10:00:00Z

Content type: tutorial

Language: en

Sources: [Andrew Lock | .NET Escapades](<https://devfeed.tech/sources/andrew-lock-net-escapades.md>)

Topics: [source generators](<https://devfeed.tech/topics/source-generators.md>), [telemetry](<https://devfeed.tech/topics/telemetry.md>), [.NET](<https://devfeed.tech/topics/net.md>), [Code](<https://devfeed.tech/topics/code.md>), [Microsoft](<https://devfeed.tech/topics/microsoft.md>)

Tags: [boilerplate](<https://devfeed.tech/tags/boilerplate.md>), [documentation](<https://devfeed.tech/tags/documentation.md>), [net](<https://devfeed.tech/tags/net.md>), [net-core](<https://devfeed.tech/tags/net-core.md>), [observability](<https://devfeed.tech/tags/observability.md>), [observability-net-core](<https://devfeed.tech/tags/observability-net-core.md>), [source-generators](<https://devfeed.tech/tags/source-generators.md>), [telemetry](<https://devfeed.tech/tags/telemetry.md>)

## AI overview

This tutorial explores the source generators in Microsoft.Extensions.Telemetry.Abstractions for creating .NET metrics. It compares the generated approach with manual boilerplate, examines the generated code, and shows how strongly typed tag objects add type safety.

## Source excerpt

In this post I explore the source generators shipped in Microsoft.Extensions.Telemetry.Abstractions, explore the code, and discuss whether I would use them