Skip to content

Commit f7fc3f7

Browse files
committed

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/Merq/MessageBus.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ public void Notify<TEvent>(TEvent e, [CallerMemberName] string? callerName = def
369369
}
370370
finally
371371
{
372-
Publishing.Record(watch.ElapsedMilliseconds, new Tag("Event", type.FullName));
372+
Sending.Record(watch.ElapsedMilliseconds, new Tag("Event", type.FullName));
373373
}
374374
}
375375

src/Merq/Telemetry.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,19 @@ static class Telemetry
2222
/// <summary>
2323
/// Duration of event publishing by the Merq message bus.
2424
/// </summary>
25-
public static Histogram<long> Publishing { get; } =
26-
Meter.CreateHistogram<long>("Publishing", unit: "ms", description: "Duration of event publishing by the Merq message bus.");
25+
public static Histogram<long> Sending { get; } =
26+
Meter.CreateHistogram<long>("Sending", unit: "ms", description: "Duration of event sending by the Merq message bus.");
2727

2828
static Telemetry()
2929
{
3030
commands = Meter.CreateCounter<long>("Commands", description: "Commands executed by the Merq message bus.");
3131
events = Meter.CreateCounter<long>("Events", description: "Events published to the Merq message bus.");
3232
}
3333

34-
// See https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/messaging.md#operation-names
34+
// See https://opentelemetry.io/docs/specs/semconv/messaging/messaging-spans/#operation-types
3535
// publish: A message is sent to a destination by a message producer/client.
3636
// This would be the event being published to the bus.
37-
public const string Publish = "publish";
37+
public const string Send = "send";
3838
// receive: A message is received from a destination by a message consumer/server.
3939
// This would be the event being received by an event handler via the OnNext on the Subject.
4040
public const string Receive = "receive";
@@ -47,20 +47,20 @@ static Telemetry()
4747
=> StartActivity(type, Process, callerName, callerFile, callerLine, "Command", command);
4848

4949
public static Activity? StartEventActivity(Type type, object @event, string? callerName, string? callerFile, int? callerLine)
50-
=> StartActivity(type, Publish, callerName, callerFile, callerLine, "Event", @event);
50+
=> StartActivity(type, Send, callerName, callerFile, callerLine, "Event", @event);
5151

5252
public static Activity? StartActivity(Type type, string operation, string? callerName, string? callerFile, int? callerLine, string? property = default, object? value = default)
5353
{
54-
if (operation == Publish)
54+
if (operation == Send)
5555
events.Add(1, new KeyValuePair<string, object?>("Name", type.FullName));
5656
else if (operation == Process)
5757
commands.Add(1, new KeyValuePair<string, object?>("Name", type.FullName));
5858

59-
// Span name convention should be: <destination> <operation> (see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/messaging.md#span-name)
59+
// Span name convention should be: {messaging.operation.name} {destination} (see https://opentelemetry.io/docs/specs/semconv/messaging/messaging-spans/#span-name)
6060
// Requirement is that the destination has low cardinality.
6161
// The event/command is the destination in our case, and the operation distinguishes
6262
// events (publish/receive operations) from commands (process operation).
63-
var activity = tracer.CreateActivity($"{type.FullName} {operation}", ActivityKind.Producer)
63+
var activity = tracer.CreateActivity($"{operation} {type.FullName}", ActivityKind.Producer)
6464
?.SetTag("code.function", callerName)
6565
?.SetTag("code.filepath", callerFile)
6666
?.SetTag("code.lineno", callerLine)
@@ -91,7 +91,7 @@ public static void RecordException(this Activity? activity, Exception e)
9191
activity.SetTag("otel.status_code", "ERROR");
9292
activity.SetTag("otel.status_description", e.Message);
9393

94-
// See https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/exceptions.md
94+
// See https://opentelemetry.io/docs/specs/semconv/exceptions/exceptions-spans/
9595
activity.AddEvent(new ActivityEvent("exception", tags: new()
9696
{
9797
{ "exception.message", e.Message },

0 commit comments

Comments
 (0)