dotnet / dotnet/docs

How to subscribe/listen to System.Diagnostics.Metrics based instruments out-of-proc programmatically?

Open
#37,359 7 comments 0 reactions 0 assignees View on GitHub
:watch: Not Triaged dotnet-fundamentals/svc
Dominant language
No language data
Stars
4.8k
Forks
6.1k
Avg merge
15h 21m
Merged PRs (30d)
370

Description

I have not found any documentation related to System.Diagnostics.Metrics based instruments subscription programmatically out-of-proc.

I have bunch of custom metrics created using [System.Diagnostics.Metrics](https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.metrics?view=net-7.0). I want to know how to subscribe them for viewing out-of-proc programmatically. I know we have _dotnet-counters_ CLI tool but I have requirement to show it some specific way programmatically out-of-proc.

I tried using **MeterListener** class but it only seems to be working in-proc. Please help me with solution for out-of-proc use-case.

Edit:
@Rick-Anderson @noahfalk @lmolkova tagging you guys because I see you responding to queries/bugs related to .NET metrics.

---
#### Document Details

⚠ *Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.*

* ID: cbacc590-317c-2ddb-1b5f-a3a39ff10cc7
* Version Independent ID: bdeccf7f-a105-68af-33a9-98991da6218d
* Content: [Metrics Overview - .NET](https://learn.microsoft.com/en-us/dotnet/core/diagnostics/metrics)
* Content Source: [docs/core/diagnostics/metrics.md](https://github.com/dotnet/docs/blob/main/docs/core/diagnostics/metrics.md)
* Product: **dotnet-fundamentals**
* GitHub Login: @tommcdon
* Microsoft Alias: **tommcdon**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.