GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(streaming): add telemetry tags to stream metrics by oising · Pull Request #8631 · dotnet/orleans

Conversation

@oising

@oising oising commented Sep 12, 2023 •
edited by ghost
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

This commit introduces telemetry features to several components of the Orleans streaming system. Specifically, a new class, StreamInstrumentsTagUtils, has been created to provide methods for initializing the relevant telemetry tags. This utility is now utilized in numerous places throughout the codebase, including the PubSubRendezvousGrain and PersistentStreamPullingAgent classes, where it facilitates the monitoring of crucial streaming activities. This aids in diagnostics and performance tracking, contributing to ongoing system improvement efforts.

Microsoft Reviewers: Open in CodeFlow

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@oising
oising marked this pull request as ready for review September 13, 2023 14:58
@ReubenBond
ReubenBond force-pushed the tagslist-for-streams-telemetry branch from 08da875 to 1b162ac Compare April 1, 2026 17:56
@ReubenBond
ReubenBond force-pushed the tagslist-for-streams-telemetry branch from 1b162ac to 3596e12 Compare May 14, 2026 20:28
@oising

oising commented May 14, 2026

Copy link
Copy Markdown
Contributor Author

It's alive! @ReubenBond

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ReubenBond
ReubenBond force-pushed the tagslist-for-streams-telemetry branch from b046194 to 5749ab7 Compare May 17, 2026 05:05
oising and others added 6 commits July 31, 2026 18:01
@oising @ReubenBond
Add telemetry support to various Orleans streaming components
0c119f4
This commit introduces telemetry features to several components of the Orleans streaming system. Specifically, a new class, StreamInstrumentsTagUtils, has been created to provide methods for initializing the relevant telemetry tags. This utility is now utilized in numerous places throughout the codebase, including the PubSubRendezvousGrain and PersistentStreamPullingAgent classes, where it facilitates the monitoring of crucial streaming activities. This aids in diagnostics and performance tracking, contributing to ongoing system improvement efforts.
@oising @ReubenBond
somehow hit ctrl+z before last commit
826cfb6
@ReubenBond
Reduce stream telemetry cardinality
1929db6
Use grain type instead of per-stream identifiers, keep consumer metrics balanced across add and remove paths, and add focused coverage in Orleans.Core.Tests.

Co-authored-by: Copilot <[email protected]>
@ReubenBond
Modernize stream telemetry tags
c50784c
Enable nullable annotations for the stream tag helper, align new tests with file-scoped namespace conventions, and preserve DiagnosticListener emissions while applying tagged stream metrics.

Co-authored-by: Copilot <[email protected]>
@ReubenBond
Remove whitespace-only stream telemetry changes
8b58b41
Revert formatting-only edits in PubSubRendezvousGrain while preserving the telemetry tag behavior changes.

Co-authored-by: Copilot <[email protected]>
@ReubenBond
Remove unused streaming telemetry import
2e03d91
Co-authored-by: Copilot App <[email protected]>

Copilot-Session: cd7955ca-4f1e-42b5-ac19-5d6d2c7c3959
@ReubenBond
ReubenBond force-pushed the tagslist-for-streams-telemetry branch from a16145c to 2e03d91 Compare August 1, 2026 01:10
Copilot AI review requested due to automatic review settings August 1, 2026 01:10
Copilot started reviewing on behalf of ReubenBond August 1, 2026 01:10
View session
Copilot AI reviewed Aug 1, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Pull request overview

Adds low-cardinality telemetry tags to Orleans streaming metrics to improve diagnostics and performance tracking across pub/sub and persistent streaming components.

Changes:

  • Introduces StreamInstrumentsTagUtils to centralize creation of bounded, stable tag dimensions for streaming-related metrics.
  • Updates pub/sub (PubSubRendezvousGrain) and persistent streaming (PersistentStreamPullingAgent) to emit metrics with tags only when instruments are enabled.
  • Adds unit tests validating tag stability/low cardinality and bounded dimensions.
Show a summary per file
File Description
test/Orleans.Core.Tests/OrleansRuntime/Streams/StreamInstrumentsTagUtilsTests.cs Adds coverage verifying tag stability and bounded dimensions for stream/grain and queue scenarios.
src/Orleans.Streaming/StreamInstrumentsTagUtils.cs New internal utility for generating low-cardinality TagList sets for stream/grain/queue metrics.
src/Orleans.Streaming/PubSub/PubSubRendezvousGrain.cs Emits pub/sub counters with tags when enabled (added/removed/total for producers/consumers).
src/Orleans.Streaming/PersistentStreams/PersistentStreamPullingAgent.cs Emits persistent stream read/sent message counters with tags when enabled.

Copilot's findings

  • Files reviewed: 4/4 changed files
  • Comments generated: 1

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/Orleans.Streaming/PubSub/PubSubRendezvousGrain.cs Outdated
Comment on lines +265 to +270
if (_streamInstruments.PubSubConsumersTotal.Enabled)
{
tags ??= StreamInstrumentsTagUtils.InitializeTags(streamId, streamConsumer);
_streamInstruments.PubSubConsumersTotal.Add(
-(initialProducerCount - State.Producers.Count), tags.Value);
}
@ReubenBond
Correct producer telemetry on automatic removal
1b24d42
Co-authored-by: Copilot App <[email protected]>

Copilot-Session: cd7955ca-4f1e-42b5-ac19-5d6d2c7c3959
Copilot AI review requested due to automatic review settings August 1, 2026 01:17
Copilot started reviewing on behalf of ReubenBond August 1, 2026 01:17
View session
Copilot AI reviewed Aug 1, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Copilot's findings

Suppressed comments (3)

src/Orleans.Streaming/PersistentStreams/PersistentStreamPullingAgent.cs:828

  • _streamInstruments is nullable, but is dereferenced without a null-guard when recording PersistentStreamSentMessages. Capturing _streamInstruments into a local avoids nullable dereference warnings and keeps the null-check and usage tied together.
                        if (_streamInstruments?.PersistentStreamSentMessages.Enabled is true)
                        {
                            tags ??= StreamInstrumentsTagUtils.InitializeTags(
                                consumerData.StreamId, consumerData.StreamConsumer.GetGrainId());
                            _streamInstruments.PersistentStreamSentMessages.Add(1, tags.Value);
                        }

src/Orleans.Streaming/PubSub/PubSubRendezvousGrain.cs:313

  • consumerState is looked up unconditionally, even when both PubSubConsumersRemoved and PubSubConsumersTotal instruments are disabled. That adds an avoidable linear scan on every call. Consider only performing the lookup when at least one of those instruments is enabled.
            var consumerState = State.Consumers.FirstOrDefault(s => s.Equals(subscriptionId));

src/Orleans.Streaming/PersistentStreams/PersistentStreamPullingAgent.cs:546

  • _streamInstruments is declared nullable, but is dereferenced without a null-guard in this block. While the ?. ... is true condition makes this safe at runtime, nullable flow analysis may still flag it and it’s easy to regress later. Capture _streamInstruments into a local and use that for the check and the Add call.

This issue also appears on line 823 of the same file.

            if (_streamInstruments?.PersistentStreamReadMessages.Enabled is true)
            {
                tags = StreamInstrumentsTagUtils.InitializeTags(myQueueId, streamProviderName);
                _streamInstruments.PersistentStreamReadMessages.Add(multiBatch.Count, tags.Value);
            }
  • Files reviewed: 4/4 changed files
  • Comments generated: 0 new

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ReubenBond
fix(streaming): bound telemetry tag cardinality
1267a83
Co-authored-by: Copilot App <[email protected]>

Copilot-Session: cd7955ca-4f1e-42b5-ac19-5d6d2c7c3959
Copilot AI review requested due to automatic review settings August 1, 2026 04:22
Copilot started reviewing on behalf of ReubenBond August 1, 2026 04:23
View session
ReubenBond
ReubenBond approved these changes Aug 1, 2026
View reviewed changes
@ReubenBond
ReubenBond enabled auto-merge August 1, 2026 04:24
Copilot AI reviewed Aug 1, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Copilot's findings

Suppressed comments (3)

src/Orleans.Streaming/PubSub/PubSubRendezvousGrain.cs:223

  • PubSubConsumersTotal is incremented unconditionally, even if this call is re-registering an existing subscription (ie, pubSubState was already present). Since this counter is used as a +/- delta to represent the current total, it can drift upward and become inaccurate.
                if (_streamInstruments.PubSubConsumersTotal.Enabled)
                {
                    tags ??= StreamInstrumentsTagUtils.InitializeTags(streamId, streamConsumer);
                    _streamInstruments.PubSubConsumersTotal.Add(1, tags.Value);
                }

src/Orleans.Streaming/StreamInstrumentsTagUtils.cs:18

  • grainId.Type.ToString() will not be null and does not map default/empty grain types to the intended low-cardinality "unknown" value. If a default GrainId is ever passed, this will emit an empty/implicit grain_type dimension instead of unknown.
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    internal static TagList InitializeTags(QualifiedStreamId streamId, GrainId grainId) =>
        CreateStreamTags(streamId, grainId.Type.ToString() ?? UnknownGrainType);

src/Orleans.Streaming/PubSub/PubSubRendezvousGrain.cs:133

  • PubSubProducersTotal is being incremented even when State.Producers.Add(...) is a no-op (eg, producer re-registers due to retries). Since this counter is used as a +/- delta to represent the current total, it can drift upward and become inaccurate.

This issue also appears on line 219 of the same file.

                if (_streamInstruments.PubSubProducersTotal.Enabled)
                {
                    tags ??= StreamInstrumentsTagUtils.InitializeTags(streamId, streamProducer);
                    _streamInstruments.PubSubProducersTotal.Add(1, tags.Value);
                }
  • Files reviewed: 4/4 changed files
  • Comments generated: 0 new

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ReubenBond ReubenBond changed the title Additional telemetry tags adds for various Orleans streaming components feat(streaming): add telemetry tags to stream metrics Aug 1, 2026
@ReubenBond
ReubenBond disabled auto-merge August 1, 2026 06:04
@ReubenBond
ReubenBond merged commit 7cbd5ba into dotnet:main Aug 1, 2026
67 checks passed

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Aug 28, 2026
Bump Microsoft.Orleans.Dashboard from 10.2.2 to 10.3.0 csrakowski/FeedManager#20
Merged
Bump Microsoft.Orleans.Persistence.AdoNet from 10.2.2 to 10.3.0 csrakowski/FeedManager#21
Merged
This was referenced Aug 28, 2026
Bump Microsoft.Orleans.Persistence.Memory from 10.2.2 to 10.3.0 csrakowski/FeedManager#22
Closed
Bump Microsoft.Orleans.Persistence.Redis from 10.2.2 to 10.3.0 csrakowski/FeedManager#23
Merged
Bump Microsoft.Orleans.Runtime from 10.2.2 to 10.3.0 csrakowski/FeedManager#24
Merged
Bump Microsoft.Orleans.Sdk from 10.2.2 to 10.3.0 csrakowski/FeedManager#25
Merged
Bump Microsoft.Orleans.Persistence.Memory and Microsoft.Orleans.Server csrakowski/FeedManager#26
Merged
Bump the dotnet-dependencies group with 1 update dills122/sandtable#67
Merged
Bump the dotnet group with 2 updates Kuestenlogik/Surgewave.Connectors#20
Merged
chore(deps): Bump the nuget-patch-and-minor group with 13 updates petesramek/microservices-vs-virtual-actors#7
Closed
chore: Bump Microsoft.Orleans.Persistence.Memory and Microsoft.Orleans.Runtime managedcode/Communication#151
Closed
chore: Bump Microsoft.Orleans.Runtime from 10.2.2 to 10.3.1 managedcode/Communication#152
Closed
chore: Bump Microsoft.Orleans.Sdk from 10.2.2 to 10.3.1 managedcode/Communication#153
Closed
chore: Bump Microsoft.Orleans.Serialization.Abstractions from 10.2.2 to 10.3.1 managedcode/Communication#154
Merged
chore: Bump Microsoft.Orleans.Persistence.Memory and 3 others managedcode/Communication#155
Closed
chore: Bump Microsoft.Orleans.TestingHost from 10.2.2 to 10.3.1 managedcode/Communication#156
Merged
Bump the orleans group with 1 update vgmello/momentum#341
Closed
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 31, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments
@ReubenBond ReubenBond ReubenBond approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@oising @ReubenBond
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.