Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update logging metadata to include entity URIs and FQDNs #623

Merged
merged 1 commit into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ private async Task OnMessageReceivedAsync(IServiceScope scope, EventRegistration
sequenceNumber: sequenceNumber,
extras: new Dictionary<string, string?>
{
["QueueUrl"] = queueUrl,
[MetadataNames.EntityUri] = queueUrl,
["ReceiptHandle"] = message.ReceiptHandle,
[nameof(message.MD5OfBody)] = message.MD5OfBody,
[nameof(message.MD5OfMessageAttributes)] = message.MD5OfMessageAttributes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,11 +362,12 @@ private async Task OnEventReceivedAsync(EventRegistration reg, EventConsumerRegi
sequenceNumber: data.SequenceNumber.ToString(),
extras: new Dictionary<string, string?>
{
[MetadataNames.FullyQualifiedNamespace] = processor.FullyQualifiedNamespace,
[MetadataNames.EventName] = eventName?.ToString(),
[MetadataNames.EventType] = eventType?.ToString(),
["PartitionId"] = partitionId,
["EventHubName"] = processor.EventHubName,
["ConsumerGroup"] = processor.ConsumerGroup,
["PartitionId"] = partitionId,
["PartitionKey"] = data.PartitionKey,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ private async Task OnMessageReceivedAsync(IServiceScope scope, EventRegistration
correlationId: null,
extras: new Dictionary<string, string?>
{
[MetadataNames.EntityUri] = queueClient.Uri.ToString(),
["PopReceipt"] = message.PopReceipt,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@ private static TimeSpan SafeDuplicateDetectionHistoryTimeWindow(TimeSpan value)

private async Task OnMessageReceivedAsync(EventRegistration reg, EventConsumerRegistration ecr, ServiceBusProcessor processor, ProcessMessageEventArgs args)
{
var fqdn = args.FullyQualifiedNamespace;
var entityPath = args.EntityPath;
var message = args.Message;
var messageId = message.MessageId;
Expand All @@ -511,7 +512,8 @@ private async Task OnMessageReceivedAsync(EventRegistration reg, EventConsumerRe
sequenceNumber: message.SequenceNumber.ToString(),
extras: new Dictionary<string, string?>
{
["EntityPath"] = entityPath,
[MetadataNames.FullyQualifiedNamespace] = fqdn,
[MetadataNames.EntityUri] = entityPath,
["EnqueuedSequenceNumber"] = message.EnqueuedSequenceNumber.ToString(),
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ private async Task OnMessageReceivedAsync(EventRegistration reg, EventConsumerRe
sequenceNumber: message.SequenceNumber.ToString(),
extras: new Dictionary<string, string?>
{
["EntityPath"] = entityPath,
[MetadataNames.EntityUri] = entityPath,
});

// Instrumentation
Expand Down
2 changes: 2 additions & 0 deletions src/Tingle.EventBus/MetadataNames.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ public static class MetadataNames
public const string CorrelationId = "CorrelationId";
public const string RequestId = "RequestId";
public const string InitiatorId = "InitiatorId";
public const string FullyQualifiedNamespace = "FullyQualifiedNamespace";
public const string EntityUri = "EntityUri";

public const string ActivityId = "EventBus.ActivityId";
public const string EventType = "EventBus.EventType";
Expand Down