Skip to content

Conversation

@cdemi
Copy link
Contributor

@cdemi cdemi commented Jul 4, 2025

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 force-pushed the feature/storage-metric-tags branch 2 times, most recently from 765ed7d to 019398a Compare July 8, 2025 16:09
@cdemi
Copy link
Contributor Author

cdemi commented Jul 8, 2025

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

@ReubenBond
Copy link
Member

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

@cdemi cdemi force-pushed the feature/storage-metric-tags branch from 2587cb3 to 6d8bd0a Compare July 9, 2025 08:37
@cdemi
Copy link
Contributor Author

cdemi commented Jul 9, 2025

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

@ReubenBond
Copy link
Member

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

@cdemi cdemi force-pushed the feature/storage-metric-tags branch from 578736c to 198f1b5 Compare July 10, 2025 17:03
@cdemi
Copy link
Contributor Author

cdemi commented Jul 10, 2025

You're absolutely right. Should be OK now

@cdemi cdemi force-pushed the feature/storage-metric-tags branch from 198f1b5 to 8a11fb7 Compare July 10, 2025 17:10
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 force-pushed the feature/storage-metric-tags branch from 8a11fb7 to 36dd782 Compare July 11, 2025 17:54
@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