lib/opentelemetry/instrumentation/aws_sdk/handler.rb in aspecto-opentelemetry-instrumentation-aws_sdk-0.1.4 vs lib/opentelemetry/instrumentation/aws_sdk/handler.rb in aspecto-opentelemetry-instrumentation-aws_sdk-0.1.5

- old
+ new

@@ -15,11 +15,11 @@ SNS_PUBLISH = 'SNS.Publish' def call(context) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity return super unless context - service_name = context.client.class.api.metadata['serviceId'] || context.client.class.to_s.split('::')[1] + service_name = context.client.class.to_s.split('::')[1] operation = context.operation&.name client_method = "#{service_name}.#{operation}" attributes = { 'aws.region' => context.config.region, OpenTelemetry::SemanticConventions::Trace::RPC_SYSTEM => 'aws-api', @@ -28,11 +28,11 @@ } attributes[SemanticConventions::Trace::DB_SYSTEM] = 'dynamodb' if service_name == 'DynamoDB' MessagingHelper.apply_sqs_attributes(attributes, context, client_method) if service_name == 'SQS' MessagingHelper.apply_sns_attributes(attributes, context, client_method) if service_name == 'SNS' - tracer.in_span(span_name(context, client_method), attributes: attributes, kind: span_kind(service_name, operation)) do |span| + tracer.in_span(span_name(context, client_method), attributes: attributes, kind: span_kind(operation)) do |span| inject_context(context, client_method) if instrumentation_config[:suppress_internal_instrumentation] OpenTelemetry::Common::Utilities.untraced { super } else super @@ -67,10 +67,10 @@ context.params[:message_attributes] ||= {} OpenTelemetry.propagation.inject(context.params[:message_attributes], setter: MessageAttributeSetter) end end - def span_kind(service_name, client_method) + def span_kind(client_method) case client_method when SQS_SEND_MESSAGE, SQS_SEND_MESSAGE_BATCH, SNS_PUBLISH OpenTelemetry::Trace::SpanKind::PRODUCER when SQS_RECEIVE_MESSAGE OpenTelemetry::Trace::SpanKind::CONSUMER