Module: Aws::Telemetry

Defined in:
lib/aws-sdk-core/telemetry.rb,
lib/aws-sdk-core/telemetry/base.rb,
lib/aws-sdk-core/telemetry/otel.rb,
lib/aws-sdk-core/telemetry/no_op.rb,
lib/aws-sdk-core/telemetry/span_kind.rb,
lib/aws-sdk-core/telemetry/span_status.rb

Overview

Observability is the extent to which a system’s current state can be inferred from the data it emits. The data emitted is commonly referred as Telemetry. The AWS SDK for Ruby currently supports traces as a telemetry signal.

A telemetry provider is used to emit telemetry data. By default, the NoOpTelemetryProvider will not record or emit any telemetry data. The SDK currently supports OpenTelemetry (OTel) as a provider. See OTelProvider for more information.

If a provider isn’t supported, you can implement your own provider by inheriting the following base classes and implementing the interfaces defined:

Defined Under Namespace

Modules: SpanKind Classes: ContextManagerBase, NoOpContextManager, NoOpSpan, NoOpTelemetryProvider, NoOpTracer, NoOpTracerProvider, OTelContextManager, OTelProvider, OTelSpan, OTelTracer, OTelTracerProvider, SpanBase, SpanStatus, TelemetryProviderBase, TracerBase, TracerProviderBase

Class Method Summary collapse

Class Method Details

.http_request_attrs(context) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/aws-sdk-core/telemetry.rb', line 36

def http_request_attrs(context)
  {
    'http.method' => context.http_request.http_method,
    'net.protocol.name' => 'http'
  }.tap do |h|
    h['net.protocol.version'] =
      if context.client.is_a? Seahorse::Client::AsyncBase
        '2'
      else
        Net::HTTP::HTTPVersion
      end

    unless context.config.stub_responses
      h['net.peer.name'] = context.http_request.endpoint.host
      h['net.peer.port'] = context.http_request.endpoint.port.to_s
    end

    if context.http_request.headers.key?('Content-Length')
      h['http.request_content_length'] =
        context.http_request.headers['Content-Length']
    end
  end
end

.http_response_attrs(context) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/aws-sdk-core/telemetry.rb', line 61

def http_response_attrs(context)
  {
    'http.status_code' => context.http_response.status_code.to_s
  }.tap do |h|
    if context.http_response.headers.key?('Content-Length')
      h['http.response_content_length'] =
        context.http_response.headers['Content-Length']
    end

    if context.http_response.headers.key?('x-amz-request-id')
      h['aws.request_id'] =
        context.http_response.headers['x-amz-request-id']
    end
  end
end

.module_to_tracer_name(module_name) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



31
32
33
# File 'lib/aws-sdk-core/telemetry.rb', line 31

def module_to_tracer_name(module_name)
  "#{module_name.gsub('::', '.')}.client".downcase
end