Skip to content

Adds metric tags to storage instrumentation#9595

Merged
ReubenBond merged 3 commits into
dotnet:mainfrom
cdemi:feature/storage-metric-tags
Jul 11, 2025
Merged

Adds metric tags to storage instrumentation#9595
ReubenBond merged 3 commits into
dotnet:mainfrom
cdemi:feature/storage-metric-tags

Conversation

@cdemi

@cdemi cdemi commented Jul 4, 2025

Copy link
Copy Markdown
Contributor

This PR aims to add support for tagging telemetry with contextual metadata (Storage Provider Name, State Name and State Type).

The current telemetry for storage operations (read/write/delete/errors) provides aggregate insights but lacks the granularity needed to troubleshoot issues or analyze behavior per provider or state.

This will enable, for example, Prometheus queries like:

sum by (provider_name, state_name) (orleans_storage_write_errors)

I think it will be very useful for identifying noisy or error-prone storage providers, differentiating latency by grain state type or maybe alerting on specific grain state issues.

The StateStorageBridge<TState> constructs the tag array once per instance and reuses it for all metric operations. Since I made changes here I also changed the storage provider type name .GetType().Name to be computed once during construction instead of on every operation, reducing redundant string allocations

Microsoft Reviewers: Open in CodeFlow

@cdemi

cdemi commented Jul 8, 2025

Copy link
Copy Markdown
Contributor Author

@ReubenBond, could I trouble you to have a look at this PR?

Comment thread src/Orleans.Runtime/Storage/StateStorageBridge.cs Outdated
@ReubenBond

Copy link
Copy Markdown
Member

Thanks for the ping, @cdemi - I left a comment. I believe we should address that before merge

@cdemi

cdemi commented Jul 9, 2025

Copy link
Copy Markdown
Contributor Author

Thanks for the feedback, @ReubenBond! I have made changes according to your feedback. I can't pass StateStorageBridgeShared<TState> to StorageInstruments since Orleans.Runtime depends on Orleans.Core so I added them as parameters instead

Comment thread src/Orleans.Runtime/Storage/StateStorageBridge.cs Outdated
@ReubenBond

Copy link
Copy Markdown
Member

Thanks, @cdemi! I added one last comment, otherwise LGTM

@cdemi

cdemi commented Jul 10, 2025

Copy link
Copy Markdown
Contributor Author

You're absolutely right. Should be OK now

cdemi added 3 commits July 11, 2025 10:54
It's clearer that we are referring to the type name of the provider and not the user-defined name given to the provider during configuration
@ReubenBond ReubenBond merged commit 9e34ae6 into dotnet:main Jul 11, 2025
28 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 11, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants