Last active
January 23, 2019 14:30
-
-
Save dylan-asos/6a2f0394108618fdc64754e6d4392a04 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EventStreamBacklogTracing | |
{ | |
public static void LogSequenceDifference(EventData message, PartitionContext context) | |
{ | |
var messageSequence = message.SystemProperties.SequenceNumber; | |
var lastEnqueuedSequence = context.RuntimeInformation.LastSequenceNumber; | |
var sequenceDifference = lastEnqueuedSequence - messageSequence; | |
var client = new TelemetryClient(); | |
var metricData = client.GetMetric("PartitionSequenceDifference", "PartitionId", "ConsumerGroupName", "EventHubPath"); | |
metricData.TrackValue(sequenceDifference, context.PartitionId, context.ConsumerGroupName, context.EventHubPath); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment