Skip to content

Conversation

@JamesNK
Copy link
Member

@JamesNK JamesNK commented Dec 9, 2025

Description

Improve structured logs page to link to GenAI visualizer when the log entry belongs to a span with GenAI telemetry.

note: This button isn't new. It would appear if the log entry contained GenAI telemetry. Now it also appears if the log entry is for a span and the span has GenAI telemetry.

image

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

@github-actions
Copy link
Contributor

github-actions bot commented Dec 9, 2025

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 13411

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 13411"

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the structured logs page to display a GenAI visualizer button for log entries that belong to spans with GenAI telemetry. The main improvement is that the system now checks not only if the log entry itself has GenAI attributes, but also whether its associated span has GenAI attributes.

Key changes:

  • Renamed IsGenAISpan to HasGenAIAttribute in GenAIHelpers for better clarity about what the method checks
  • Added IsGenAILogEntry method to determine if a log entry should show the GenAI visualizer button by checking both the log entry and its associated span
  • Updated the context span retrieval logic to filter by SpanId/TraceId fields instead of the GenAISystem field

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/Aspire.Dashboard/Model/GenAI/GenAIHelpers.cs Renamed helper method from IsGenAISpan to HasGenAIAttribute for clarity
src/Aspire.Dashboard/Components/ResourcesGridColumns/LogMessageColumnDisplay.razor.cs Added IsGenAILogCallback parameter to support custom GenAI detection logic
src/Aspire.Dashboard/Components/ResourcesGridColumns/LogMessageColumnDisplay.razor Simplified GenAI detection by delegating to callback instead of inline logic
src/Aspire.Dashboard/Components/Pages/TraceDetail.razor.cs Updated call to renamed HasGenAIAttribute method
src/Aspire.Dashboard/Components/Pages/StructuredLogs.razor.cs Added IsGenAILogEntry method and updated context span retrieval to check both log and span attributes
src/Aspire.Dashboard/Components/Pages/StructuredLogs.razor Wired up the new IsGenAILogCallback parameter
src/Aspire.Dashboard/Components/Controls/SpanDetails.razor.cs Updated call to renamed HasGenAIAttribute method

@JamesNK
Copy link
Member Author

JamesNK commented Dec 9, 2025

@copilot To improve performance, update OtlpLogEntry and OtlpSpan with a property for whether they have GenAI information. This should be calculated in the repository when a log entry or span is added/removed. See IsGenAILogEntry for the logic for whether this is true or not.

Copy link
Contributor

Copilot AI commented Dec 9, 2025

@JamesNK I've opened a new pull request, #13413, to work on those changes. Once the pull request is ready, I'll request review from you.

@JamesNK JamesNK changed the title Log entries for a genai span now link to genai visualizer Log entries for a GenAI span now link to GenAI visualizer Dec 9, 2025
@mitchdenny
Copy link
Member

This looks fine although I cannot test at the moment due to what is probably an unrelated blazor issue.

@JamesNK JamesNK merged commit 63233f0 into main Dec 9, 2025
286 checks passed
@JamesNK JamesNK deleted the jamesnk/logentries-genai-button branch December 9, 2025 11:15
@dotnet-policy-service dotnet-policy-service bot added this to the 13.1 milestone Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants