Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logs don't include TraceId, SpanId scopes #2545

Closed
lmolkova opened this issue Sep 24, 2022 · 3 comments
Closed

Logs don't include TraceId, SpanId scopes #2545

lmolkova opened this issue Sep 24, 2022 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@lmolkova
Copy link

lmolkova commented Sep 24, 2022

Description

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

Configuration:

  • .NET 6 razor app + dotnet-monitor 6.2.2 both run in docker (Linux)
  • or .NET 6 webapi + dotnet-monitor 6.2.2 windows
  • logging configuration:
  builder.Logging.Configure(options =>
  {
      options.ActivityTrackingOptions = ActivityTrackingOptions.TraceId | ActivityTrackingOptions.SpanId | ActivityTrackingOptions.ParentId;
  });
  "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

  • What OS and version, and what distro if applicable? windows or linux
  • What is the architecture (x64, x86, ARM, ARM64)? x64
  • Do you know whether it is specific to that configuration? not specific
  • Are you running in any particular type of environment? (e.g. Containers, a cloud scenario, app you are trying to target is a different user)
  • Is it a self-contained published application? no
  • What's the output of dotnet info
.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

@lmolkova lmolkova added the bug Something isn't working label Sep 24, 2022
@jander-msft
Copy link
Member

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 wiktork self-assigned this Sep 27, 2022
@wiktork
Copy link
Member

wiktork commented Oct 6, 2022

This is likely a fallout of dotnet/aspnetcore#22376

@jander-msft
Copy link
Member

Closing as this is a duplicate of #1131

@jander-msft jander-msft closed this as not planned Won't fix, can't repro, duplicate, stale Dec 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants