dnf
dnf

Reputation: 1789

dotnet-monitor and OpenTelemetry?

I'm learning OpenTelemetry and I wonder how dotnet-monitor is connected with OpenTelemetry (Meter). Are those things somehow connected or maybe dotnet-monitor is just custom MS tools that is not using standards from OpenTelemetry (API, SDK and exporters).

Upvotes: 3

Views: 706

Answers (1)

doron bargo
doron bargo

Reputation: 21

If you run dotnet-monitor on your machine it exposes the dotnet metrics in Prometheus format which mean you can set OpenTelemetry collector to scrape those metrics

For example in OpenTelemetry-collector-contrib configuration

    receivers:
      prometheus_exec:
        exec: dotnet monitor collect
        port: 52325

Please note that for dotnet-monitor to run you need to create a setting.json in theis path:

    $XDG_CONFIG_HOME/dotnet-monitor/settings.json

If $XDG_CONFIG_HOME is not defined, create the file in this path:

    $HOME/.config/dotnet-monitor/settings.json

If you want to identify the process by its PID, write this into settings.json (change Value to your PID):

    {
      "DefaultProcess": {
        "Filters": [{
          "Key": "ProcessId",
          "Value": "1"
        }]
      }
    }

If you want to identify the process by its name, write this into settings.json (change Value to your process name):

    {
      "DefaultProcess": {
        "Filters": [{
          "Key": "ProcessName",
          "Value": "iisexpress"
        }]
      },
    }

In my example I used this configuration:

    {
      "DefaultProcess": {
        "Filters": [{
          "Key": "ProcessId",
          "Value": "1"
        }]
      },
      "Metrics": {
        "Providers": [
          {
        "ProviderName": "System.Net.Http"      
          },
          {
        "ProviderName": "Microsoft-AspNetCore-Server-Kestrel"
          }
        ]
      }
    }

Upvotes: 2

Related Questions