Skip to content
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
4 changes: 2 additions & 2 deletions lib/commanded/opentelemetry/aggregate.ex
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ defmodule Commanded.OpenTelemetry.Aggregate do
{MessagingAttributes.messaging_destination_name(), handler_module_name},
{MessagingAttributes.messaging_message_id(), context.causation_id},
{MessagingAttributes.messaging_message_conversation_id(), context.correlation_id},
{MessagingAttributes.messaging_consumer_group_name(), meta.application},
{MessagingAttributes.messaging_consumer_group_name(), Helpers.module_name(meta.application)},
# OTel Code SemConv
{CodeAttributes.code_function(), to_string(context.function)},
{CodeAttributes.code_namespace(), handler_module_name},
# Commanded-specific
{CommandedAttributes.commanded_handler_kind(), "aggregate"},
{CommandedAttributes.commanded_application(), meta.application},
{CommandedAttributes.commanded_application(), Helpers.module_name(meta.application)},
Comment thread
yordis marked this conversation as resolved.
{CommandedAttributes.commanded_aggregate_uuid(), meta.aggregate_uuid},
{CommandedAttributes.commanded_aggregate_version(), meta.aggregate_version},
{CommandedAttributes.commanded_command(), Helpers.struct_name(context.command)},
Expand Down
4 changes: 2 additions & 2 deletions lib/commanded/opentelemetry/aggregate_populate.ex
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ defmodule Commanded.OpenTelemetry.AggregatePopulate do
{MessagingAttributes.messaging_destination_name(), aggregate_module_name},
{CodeAttributes.code_function(), "load"},
{CodeAttributes.code_namespace(), aggregate_module_name},
{CommandedAttributes.commanded_application(), meta.application},
{CommandedAttributes.commanded_application(), Helpers.module_name(meta.application)},
{CommandedAttributes.commanded_aggregate_uuid(), meta.aggregate_uuid},
{CommandedAttributes.commanded_aggregate_version(), meta.aggregate_version}
]
Expand Down Expand Up @@ -112,7 +112,7 @@ defmodule Commanded.OpenTelemetry.AggregatePopulate do
{CodeAttributes.code_function(), "populate"},
{CodeAttributes.code_namespace(), aggregate_module_name},
# Commanded-specific
{CommandedAttributes.commanded_application(), meta.application},
{CommandedAttributes.commanded_application(), Helpers.module_name(meta.application)},
{CommandedAttributes.commanded_aggregate_uuid(), meta.aggregate_uuid},
{CommandedAttributes.commanded_aggregate_version(), meta.aggregate_version}
]
Expand Down
2 changes: 1 addition & 1 deletion lib/commanded/opentelemetry/aggregate_snapshot.ex
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ defmodule Commanded.OpenTelemetry.AggregateSnapshot do
{MessagingAttributes.messaging_destination_name(), aggregate_module_name},
{CodeAttributes.code_function(), "snapshot"},
{CodeAttributes.code_namespace(), aggregate_module_name},
{CommandedAttributes.commanded_application(), meta.application},
{CommandedAttributes.commanded_application(), Helpers.module_name(meta.application)},
{CommandedAttributes.commanded_aggregate_uuid(), meta.aggregate_uuid},
{CommandedAttributes.commanded_aggregate_version(), meta.aggregate_version}
]
Expand Down
2 changes: 1 addition & 1 deletion lib/commanded/opentelemetry/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ defmodule Commanded.OpenTelemetry.Application do
{CodeAttributes.code_namespace(), handler_module_name},
# Commanded-specific
{CommandedAttributes.commanded_handler_kind(), "command_handler"},
{CommandedAttributes.commanded_application(), meta.application},
{CommandedAttributes.commanded_application(), Helpers.module_name(meta.application)},
{CommandedAttributes.commanded_command(), Helpers.struct_name(context.command)},
{CommandedAttributes.commanded_correlation_id(), context.correlation_id},
{CommandedAttributes.commanded_causation_id(), context.causation_id}
Expand Down
8 changes: 4 additions & 4 deletions lib/commanded/opentelemetry/event_handler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ defmodule Commanded.OpenTelemetry.EventHandler do
{MessagingAttributes.messaging_destination_subscription_name(), meta.handler_name},
{MessagingAttributes.messaging_message_id(), recorded_event.event_id},
{MessagingAttributes.messaging_message_conversation_id(), recorded_event.correlation_id},
{MessagingAttributes.messaging_consumer_group_name(), meta.application},
{MessagingAttributes.messaging_consumer_group_name(), Helpers.module_name(meta.application)},
# OTel Code SemConv
{CodeAttributes.code_function(), "handle"},
{CodeAttributes.code_namespace(), handler_module_name},
# Commanded-specific
{CommandedAttributes.commanded_handler_kind(), "event_handler"},
{CommandedAttributes.commanded_application(), meta.application},
{CommandedAttributes.commanded_application(), Helpers.module_name(meta.application)},
{CommandedAttributes.commanded_handler_name(), meta.handler_name},
{CommandedAttributes.commanded_event(), recorded_event.event_type},
{CommandedAttributes.commanded_event_number(), recorded_event.event_number},
Expand Down Expand Up @@ -184,14 +184,14 @@ defmodule Commanded.OpenTelemetry.EventHandler do
{MessagingAttributes.messaging_operation_name(), "batch"},
{MessagingAttributes.messaging_destination_name(), handler_module_name},
{MessagingAttributes.messaging_destination_subscription_name(), meta.handler_name},
{MessagingAttributes.messaging_consumer_group_name(), meta.application},
{MessagingAttributes.messaging_consumer_group_name(), Helpers.module_name(meta.application)},
{MessagingAttributes.messaging_batch_message_count(), meta.event_count},
# OTel Code SemConv
{CodeAttributes.code_function(), "handle_batch"},
{CodeAttributes.code_namespace(), handler_module_name},
# Commanded-specific
{CommandedAttributes.commanded_handler_kind(), "event_handler"},
{CommandedAttributes.commanded_application(), meta.application},
{CommandedAttributes.commanded_application(), Helpers.module_name(meta.application)},
{CommandedAttributes.commanded_handler_name(), meta.handler_name},
{CommandedAttributes.commanded_event_count(), meta.event_count},
{CommandedAttributes.commanded_batch_first_event_id(), meta.first_event_id},
Expand Down
2 changes: 1 addition & 1 deletion lib/commanded/opentelemetry/event_store.ex
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ defmodule Commanded.OpenTelemetry.EventStore do
{MessagingAttributes.messaging_system(), "commanded"},
{MessagingAttributes.messaging_operation_name(), action_name},
{CodeAttributes.code_function(), action_name},
{CommandedAttributes.commanded_application(), meta[:application]}
{CommandedAttributes.commanded_application(), Helpers.module_name(meta[:application])}
]
|> maybe_add_db_system(adapter)
|> Helpers.maybe_add_operation_type(operation_type)
Expand Down
8 changes: 4 additions & 4 deletions test/opentelemetry/aggregate_populate_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ defmodule Commanded.OpenTelemetry.AggregatePopulateTest do
"messaging.destination.name": "MockAggregate",
"code.function": "populate",
"code.namespace": "MockAggregate",
"commanded.application": MockApp,
"commanded.application": "MockApp",
"commanded.aggregate.uuid": aggregate_uuid,
"commanded.aggregate.version": 5,
"commanded.event.count": 0
Expand Down Expand Up @@ -140,7 +140,7 @@ defmodule Commanded.OpenTelemetry.AggregatePopulateTest do
"messaging.destination.name": "MockAggregate",
"code.function": "load",
"code.namespace": "MockAggregate",
"commanded.application": MockApp,
"commanded.application": "MockApp",
"commanded.aggregate.uuid": aggregate_uuid,
"commanded.aggregate.version": 0,
"commanded.event.count": 0,
Expand Down Expand Up @@ -217,7 +217,7 @@ defmodule Commanded.OpenTelemetry.AggregatePopulateTest do
"messaging.destination.name": "MockAggregate",
"code.function": "populate",
"code.namespace": "MockAggregate",
"commanded.application": MockApp,
"commanded.application": "MockApp",
"commanded.aggregate.uuid": aggregate_uuid,
"commanded.aggregate.version": 0,
"commanded.event.count": 0
Expand Down Expand Up @@ -253,7 +253,7 @@ defmodule Commanded.OpenTelemetry.AggregatePopulateTest do
"messaging.destination.name": "MockAggregate",
"code.function": "populate",
"code.namespace": "MockAggregate",
"commanded.application": MockApp,
"commanded.application": "MockApp",
"commanded.aggregate.uuid": aggregate_uuid,
"commanded.aggregate.version": 10,
"commanded.event.count": 10
Expand Down
2 changes: 1 addition & 1 deletion test/opentelemetry/aggregate_snapshot_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ defmodule Commanded.OpenTelemetry.AggregateSnapshotTest do
"messaging.destination.name": "MockAggregate",
"code.function": "snapshot",
"code.namespace": "MockAggregate",
"commanded.application": MockApp,
"commanded.application": "MockApp",
"commanded.aggregate.uuid": aggregate_uuid,
"commanded.aggregate.version": 10,
"commanded.snapshot.every": 5,
Expand Down
32 changes: 16 additions & 16 deletions test/opentelemetry/aggregate_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ defmodule Commanded.OpenTelemetry.AggregateTest do
"messaging.destination.name": "Commanded.TestSupport.TestDomain.Account",
"messaging.message.id": causation_id,
"messaging.message.conversation_id": correlation_id,
"messaging.consumer.group.name": MockApp,
"messaging.consumer.group.name": "MockApp",
"code.function": "execute",
"code.namespace": "Commanded.TestSupport.TestDomain.Account",
"commanded.handler.kind": "aggregate",
"commanded.application": MockApp,
"commanded.application": "MockApp",
"commanded.aggregate.uuid": aggregate_uuid,
"commanded.aggregate.version": 5,
"commanded.command": "Commanded.TestSupport.TestDomain.OpenAccount",
Expand Down Expand Up @@ -152,11 +152,11 @@ defmodule Commanded.OpenTelemetry.AggregateTest do
"messaging.destination.name": "Commanded.Middleware.Commands.CommandHandler",
"messaging.message.id": causation_id,
"messaging.message.conversation_id": correlation_id,
"messaging.consumer.group.name": Commanded.DefaultApp,
"messaging.consumer.group.name": "Commanded.DefaultApp",
"code.function": "handle",
"code.namespace": "Commanded.Middleware.Commands.CommandHandler",
"commanded.handler.kind": "aggregate",
"commanded.application": Commanded.DefaultApp,
"commanded.application": "Commanded.DefaultApp",
"commanded.aggregate.uuid": aggregate_uuid,
"commanded.aggregate.version": 0,
"commanded.command": "Commanded.Middleware.Commands.IncrementCount",
Expand Down Expand Up @@ -215,11 +215,11 @@ defmodule Commanded.OpenTelemetry.AggregateTest do
"messaging.destination.name": "Commanded.Middleware.Commands.CommandHandler",
"messaging.message.id": causation_id1,
"messaging.message.conversation_id": correlation_id1,
"messaging.consumer.group.name": Commanded.DefaultApp,
"messaging.consumer.group.name": "Commanded.DefaultApp",
"code.function": "handle",
"code.namespace": "Commanded.Middleware.Commands.CommandHandler",
"commanded.handler.kind": "aggregate",
"commanded.application": Commanded.DefaultApp,
"commanded.application": "Commanded.DefaultApp",
"commanded.aggregate.uuid": aggregate_uuid,
"commanded.aggregate.version": 0,
"commanded.command": "Commanded.Middleware.Commands.IncrementCount",
Expand Down Expand Up @@ -249,11 +249,11 @@ defmodule Commanded.OpenTelemetry.AggregateTest do
"messaging.destination.name": "Commanded.Middleware.Commands.CommandHandler",
"messaging.message.id": causation_id2,
"messaging.message.conversation_id": correlation_id2,
"messaging.consumer.group.name": Commanded.DefaultApp,
"messaging.consumer.group.name": "Commanded.DefaultApp",
"code.function": "handle",
"code.namespace": "Commanded.Middleware.Commands.CommandHandler",
"commanded.handler.kind": "aggregate",
"commanded.application": Commanded.DefaultApp,
"commanded.application": "Commanded.DefaultApp",
"commanded.aggregate.uuid": aggregate_uuid,
"commanded.aggregate.version": 1,
"commanded.command": "Commanded.Middleware.Commands.IncrementCount",
Expand Down Expand Up @@ -308,11 +308,11 @@ defmodule Commanded.OpenTelemetry.AggregateTest do
"messaging.destination.name": "Commanded.TestSupport.TestDomain.Account",
"messaging.message.id": causation_id,
"messaging.message.conversation_id": correlation_id,
"messaging.consumer.group.name": MockApp,
"messaging.consumer.group.name": "MockApp",
"code.function": "execute",
"code.namespace": "Commanded.TestSupport.TestDomain.Account",
"commanded.handler.kind": "aggregate",
"commanded.application": MockApp,
"commanded.application": "MockApp",
"commanded.aggregate.uuid": aggregate_uuid,
"commanded.aggregate.version": 0,
"commanded.command": "Commanded.TestSupport.TestDomain.OpenAccount",
Expand Down Expand Up @@ -412,11 +412,11 @@ defmodule Commanded.OpenTelemetry.AggregateTest do
"messaging.destination.name": "Commanded.TestSupport.TestDomain.Account",
"messaging.message.id": context.causation_id,
"messaging.message.conversation_id": context.correlation_id,
"messaging.consumer.group.name": meta.application,
"messaging.consumer.group.name": inspect(meta.application),
"code.function": to_string(context.function),
"code.namespace": "Commanded.TestSupport.TestDomain.Account",
"commanded.handler.kind": "aggregate",
"commanded.application": meta.application,
"commanded.application": inspect(meta.application),
"commanded.aggregate.uuid": meta.aggregate_uuid,
"commanded.aggregate.version": meta.aggregate_version,
"commanded.command": "Commanded.TestSupport.TestDomain.OpenAccount",
Expand Down Expand Up @@ -458,11 +458,11 @@ defmodule Commanded.OpenTelemetry.AggregateTest do
"messaging.destination.name": "Commanded.TestSupport.TestDomain.Account",
"messaging.message.id": context.causation_id,
"messaging.message.conversation_id": context.correlation_id,
"messaging.consumer.group.name": meta.application,
"messaging.consumer.group.name": inspect(meta.application),
"code.function": to_string(context.function),
"code.namespace": "Commanded.TestSupport.TestDomain.Account",
"commanded.handler.kind": "aggregate",
"commanded.application": meta.application,
"commanded.application": inspect(meta.application),
"commanded.aggregate.uuid": meta.aggregate_uuid,
"commanded.aggregate.version": meta.aggregate_version,
"commanded.command": "Commanded.TestSupport.TestDomain.OpenAccount",
Expand Down Expand Up @@ -651,11 +651,11 @@ defmodule Commanded.OpenTelemetry.AggregateTest do
"messaging.destination.name": "Commanded.TestSupport.TestDomain.Account",
"messaging.message.id": causation_id,
"messaging.message.conversation_id": correlation_id,
"messaging.consumer.group.name": MockApp,
"messaging.consumer.group.name": "MockApp",
"code.function": "execute",
"code.namespace": "Commanded.TestSupport.TestDomain.Account",
"commanded.handler.kind": "aggregate",
"commanded.application": MockApp,
"commanded.application": "MockApp",
"commanded.aggregate.uuid": aggregate_uuid,
"commanded.aggregate.version": 0,
"commanded.command": "Commanded.TestSupport.TestDomain.OpenAccount",
Expand Down
8 changes: 4 additions & 4 deletions test/opentelemetry/application_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ defmodule Commanded.OpenTelemetry.ApplicationTest do
"code.function": "handle",
"code.namespace": "Commanded.Middleware.Commands.CommandHandler",
"commanded.handler.kind": "command_handler",
"commanded.application": Commanded.DefaultApp,
"commanded.application": "Commanded.DefaultApp",
"commanded.command": "Commanded.Middleware.Commands.IncrementCount",
"commanded.correlation_id": correlation_id,
"commanded.causation_id": causation_id
Expand Down Expand Up @@ -226,7 +226,7 @@ defmodule Commanded.OpenTelemetry.ApplicationTest do
"code.function": "execute",
"code.namespace": "Commanded.TestSupport.TestDomain.Account",
"commanded.handler.kind": "command_handler",
"commanded.application": MockApp,
"commanded.application": "MockApp",
"commanded.command": "Commanded.TestSupport.TestDomain.OpenAccount",
"commanded.correlation_id": correlation_id,
"commanded.causation_id": causation_id,
Expand Down Expand Up @@ -369,7 +369,7 @@ defmodule Commanded.OpenTelemetry.ApplicationTest do
"code.function": to_string(context.function),
"code.namespace": "Commanded.TestSupport.TestDomain.Account",
"commanded.handler.kind": "command_handler",
"commanded.application": meta.application,
"commanded.application": inspect(meta.application),
"commanded.command": "Commanded.TestSupport.TestDomain.OpenAccount",
"commanded.correlation_id": context.correlation_id,
"commanded.causation_id": context.causation_id,
Expand Down Expand Up @@ -414,7 +414,7 @@ defmodule Commanded.OpenTelemetry.ApplicationTest do
"code.function": to_string(context.function),
"code.namespace": "Commanded.TestSupport.TestDomain.Account",
"commanded.handler.kind": "command_handler",
"commanded.application": meta.application,
"commanded.application": inspect(meta.application),
"commanded.command": "Commanded.TestSupport.TestDomain.OpenAccount",
"commanded.correlation_id": context.correlation_id,
"commanded.causation_id": context.causation_id,
Expand Down
Loading