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

aspire-dashboard Structured logs -> Log entry details -> Resource attributes not always correct/seem cached #5126

Closed
1 task done
dlosch opened this issue Jul 31, 2024 · 7 comments · Fixed by #5526
Closed
1 task done
Assignees

Comments

@dlosch
Copy link

dlosch commented Jul 31, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Hi,

when exporting otel logging data from a .NET app to both Seq and Aspire Dashboard (8.0.2 and 8.1.0 show same behavior), aspire dashboard doesn't seem to render attribute values under Structured logs -> Log entry details -> Resource -> attributes correctly at all times (sometimes it seems parts of the attributes get cached).

First of all, displayed values for a specific log entry differ between seq (correct) and aspire dashboard (not correct).

1.) Run the app, attribute foo=value1
2.) Seq and Aspire dashboard display the entry with foo=value1
3.) stop app, change value to foo=newValue
4.) re run app
5.) Seq=>foo=newValue, aspire dashboard (no restart of container) foo=value1

Yesterday, with 8.0.2, I also had issues that some attribute pairs did not show up at all at times in aspire dashboard (not a rendering issue).

Expected Behavior

No response

Steps To Reproduce

  • asp.net 8 app
  • builder.Services.AddLogging(logging => logging.AddOpenTelemetry(openTelemetryLoggerOptions => {
    openTelemetryLoggerOptions.SetResourceBuilder(
    [...]
    .AddAttributes(new Dictionary<string, object> {
    [...]

Exceptions (if any)

No response

.NET Version info

SDK 8.0.303
Runtime: 8.0.7
AOT publish

Anything else?

Affects aspire-dashboard 8.1.0 and 8.0.2

@adamint
Copy link
Member

adamint commented Aug 5, 2024

I think the important part is here:

5.) Seq=>foo=newValue, aspire dashboard (no restart of container) foo=value1

@samsp-msft samsp-msft assigned samsp-msft and JamesNK and unassigned samsp-msft Aug 7, 2024
@samsp-msft
Copy link
Member

James - this seems like an issue with how we associate resources on each batch to the last. We probably need some kind of hash of all the resource properties to account for potential differences.

@JamesNK
Copy link
Member

JamesNK commented Aug 8, 2024

@dlosch What do you expect to happen when a resource adds and remove attributes?

For example:

1.) Run the app, attribute foo=true, record one log entry
2.) Seq and Aspire dashboard display the entry with foo=true
3.) stop app, change attribute to bar=true
4.) re run app, record one log entry
5.) ???

There are now two log entries for the resource. What attributes should the log entry resource display?

Option 1 - resource attributes reflect what was last sent to the dashboard:
Log entry 1, resource attribute bar=true
Log entry 2, resource attribute bar=true

Option 2 - resource attributes are combined over the lifetime of the dashboard:
Log entry 1, resource attribute foo=true, bar=true
Log entry 2, resource attribute foo=true, bar=true

Option 3 - resource attributes are snapshotted to the point in time they were received with the telemetry:
Log entry 1, resource attribute foo=true
Log entry 2, resource attribute bar=true

Option 1 & 2 would be simple to do. Option 3 would require larger changes.

I'm curious what seq does.

@dlosch
Copy link
Author

dlosch commented Aug 8, 2024

Would prefer option 3 if possible. I only superficially scanned over the open telemetry spec, but my interpretation was that the attributes are effectively scoped to the log entry (at least regarding the output)(?) Are resource attributes transmitted independently (and only if changed) from log entries and then correlated back, or are these attributes attached to each record (when adding a console logger, they are attached to each log entry)? The spec also mentions that a resource is immutable ... how is the intended behavior if a resource is restarted? In my case I did attach the runtimeFrameworkVersion value to the resource as an attribute, which may change between restarts.

A quick test showed that Seq behaves as in option 3.

The dashboard is superb, has helped me track down several not obvious issues with aot (logging+metrics).

@liammclennan
Copy link
Contributor

Seq stores all the resource data on all events - so Option 3.

@JamesNK
Copy link
Member

JamesNK commented Aug 12, 2024

Sounds like option 3 is the way to go. It will be a non-trivial change: the current design is resources are added once, never change, and referenced directly by telemetry. But hopefully not too difficult to change to support having a right resource attribtues against telemetry.

We'll still want to share the resource as much as possible, and then have snapshots of the resource attributes for telemetry. Snapshots should be shared when equal to keep memory usage down.

@JamesNK
Copy link
Member

JamesNK commented Sep 6, 2024

Fixed with #5526

@JamesNK JamesNK closed this as completed Sep 6, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Oct 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants