Sha256: 9e4c2a4f0b2bb511fb5b801c3d8f2a99ceca31cf1ac798d6f9da5a507d3953e6
Contents?: true
Size: 1.19 KB
Versions: 26
Compression:
Stored size: 1.19 KB
Contents
# (c) Copyright IBM Corp. 2021 # (c) Copyright Instana Inc. 2021 require 'base64' module Instana module Instrumentation class Lambda < Seahorse::Client::Plugin class Handler < Seahorse::Client::Handler def call(context) return @handler.call(context) unless [:invoke_async, :invoke].include?(context.operation_name) if context.params[:client_context].nil? && ::Instana.tracer.tracing? && context.operation_name == :invoke span_context = ::Instana.tracer.context payload = { 'X-INSTANA-T' => span_context.trace_id, 'X-INSTANA-S' => span_context.span_id, 'X-INSTANA-L' => span_context.level.to_s } context.params[:client_context] = JSON.dump(payload) end tags = { function: context.params[:function_name], type: context.params[:invocation_type] }.reject { |_, v| v.nil? } ::Instana.tracer.trace(:"aws.lambda.invoke", {aws: {lambda: {invoke: tags}}}) { @handler.call(context) } end end def add_handlers(handlers, _config) handlers.add(Handler, step: :initialize) end end end end
Version data entries
26 entries across 26 versions & 1 rubygems