dotnet / dotnet-monitor

This repository contains the source code for .NET Monitor - a tool that allows you to gather diagnostic data from running applications using HTTP endpoints
MIT License
636 stars 111 forks source link

Logs don't include TraceId, SpanId scopes #2545

Open lmolkova opened 1 year ago

lmolkova commented 1 year ago

Description

Logs from dotnet-monitor don't incude TraceId and SpanId scopes.

Configuration:

  "Console" : {
    "IncludeScopes" : true
  }

What I see in console:

info: System.Net.Http.HttpClient.storage.LogicalHandler[101]
       => SpanId:2eab45dce8666ecc, TraceId:2287adaf1b71318a94a722124e6495ab, ParentId:0000000000000000 => ConnectionId:0HMKUE1V6VF2N => RequestPath:/Meme RequestId:0HMKUE1V6VF2N:000000B0 => /Meme => HTTP GET http://storage:5050/memes/meme
       End processing HTTP request after 0.7847ms - 200

what I get from dotnet-monitor via POST /logs?pid=1 { "filterSpecs": { "System.Net.Http.HttpClient": "Information" }, "useAppFilters": false }

{
    "Timestamp": "2022-09-24 21:23:12Z",
    "LogLevel": "Information",
    "EventId": 101,
    "EventName": "RequestPipelineEnd",
    "Category": "System.Net.Http.HttpClient.storage.LogicalHandler",
    "Message": "End processing HTTP request after 0.7847ms - 200",
    "State": {
        "Message": "End processing HTTP request after 0.7847ms - 200",
        "ElapsedMilliseconds": "0.7847",
        "StatusCode": "200",
        "{OriginalFormat}": "End processing HTTP request after {ElapsedMilliseconds}ms - {StatusCode}"
    },
    "Scopes": [
        {
            "HttpMethod": "GET",
            "Uri": "http://storage:5050/memes/meme",
            "{OriginalFormat}": "HTTP {HttpMethod} {Uri}"
        }
    ]
}

Configuration

.NET SDK:
 Version:   7.0.100-preview.7.22377.5
 Commit:    ba310d9309

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.22000
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\7.0.100-preview.7.22377.5\

Host:
  Version:      7.0.0-preview.7.22375.6
  Architecture: x64
  Commit:       eecb028078

.NET SDKs installed:
  5.0.408 [C:\Program Files\dotnet\sdk]
  6.0.302 [C:\Program Files\dotnet\sdk]
  6.0.304 [C:\Program Files\dotnet\sdk]
  7.0.100-preview.7.22377.5 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.0-preview.7.22376.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.0-preview.7.22375.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 7.0.0-preview.7.22377.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
  x86   [C:\Program Files (x86)\dotnet]
    registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

Regression?

Probably, sample responses in docs have traceId and spanId:

image
jander-msft commented 1 year ago

Possible duplicate of #1131

If you have either a .NET Core 3.1 or .NET 5 application handy, could you try to reproduce this there? It might be a regression in the defaults provided by the runtime starting in .NET 6.

wiktork commented 1 year ago

This is likely a fallout of https://github.com/dotnet/aspnetcore/pull/22376