opentelemetry-instrumentation-aws_lambda 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 478a1378e713439847ad37af7d626fa51ca417b80f3bf7aa517a03fb99205015
4
- data.tar.gz: 407cce283d1266bbb5566b25b98f65a51159111554dfea27118e2c89f11e4bb3
3
+ metadata.gz: 25cdbdbb4f636b8da6e8ee8ba34f85207ddb290289e90cfa9696c4da63c81cf2
4
+ data.tar.gz: 171eed89cc4964890346576d2cec1453075571fc8d8aa412fde20e0859bde6c9
5
5
  SHA512:
6
- metadata.gz: d959a0614ce836cb6d8579d0e5966a9b9a81982a7d05b5d28a2586d1e097c7cab7161d31fc93cfa8c19ea0e0a51f830fd78f3f90fa6de6844bc144399454e504
7
- data.tar.gz: 352b3bc74695b9aa54f3eef67274a0a7ff549444020afe17a19439255ad4f33768630b9391c8c29977b8503c41ff5f07b867d3eefa6598dba135fc07c9afa73b
6
+ metadata.gz: 565f46f2a5a333db8fb2b063e14de403c4292b6e0117200f2225a2e4fccc0f521f2a4d735a368cbaa7a8493c8a389d1903eee531bc3fc21017fe504445f4e639
7
+ data.tar.gz: 3e81740226a8e4f4919cd986743c381c46411bfbba07d2939e6be089db7fe580a2381eb874658357faaf6ff5e007df4aba91aaf3c947132fc47f14e1c645f825
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Release History: opentelemetry-instrumentation-aws_lambda
2
2
 
3
+ ### v0.1.1 / 2024-07-30
4
+
5
+ * FIXED: Register lambda span
6
+
3
7
  ### v0.1.0 / 2024-05-11
4
8
 
5
9
  Initial release.
data/README.md CHANGED
@@ -36,6 +36,7 @@ To run the example:
36
36
  * `bundle install`
37
37
  2. Run the sample client script
38
38
  * `ruby trace_demonstration.rb`
39
+ * or `bundle exec ruby trace_demonstration.rb`
39
40
 
40
41
  This will run SNS publish command, printing OpenTelemetry traces to the console as it goes.
41
42
 
@@ -40,33 +40,25 @@ module OpenTelemetry
40
40
  original_handler_error = nil
41
41
  original_response = nil
42
42
  OpenTelemetry::Context.with_current(parent_context) do
43
- span_attributes = otel_attributes(event, context)
44
- span = tracer.start_span(
45
- @original_handler,
46
- attributes: span_attributes,
47
- kind: span_kind
48
- )
49
-
50
- begin
51
- response = call_original_handler(event: event, context: context)
52
- status_code = response['statusCode'] || response[:statusCode] if response.is_a?(Hash)
53
- span.set_attribute(OpenTelemetry::SemanticConventions::Trace::HTTP_STATUS_CODE, status_code) if status_code
54
- rescue StandardError => e
55
- original_handler_error = e
56
- ensure
57
- original_response = response
43
+ tracer.in_span(@original_handler, attributes: otel_attributes(event, context), kind: span_kind) do |span|
44
+ begin
45
+ response = call_original_handler(event: event, context: context)
46
+ status_code = response['statusCode'] || response[:statusCode] if response.is_a?(Hash)
47
+ span.set_attribute(OpenTelemetry::SemanticConventions::Trace::HTTP_STATUS_CODE, status_code) if status_code
48
+ rescue StandardError => e
49
+ original_handler_error = e
50
+ ensure
51
+ original_response = response
52
+ end
53
+ if original_handler_error
54
+ span.record_exception(original_handler_error)
55
+ span.status = OpenTelemetry::Trace::Status.error(original_handler_error.message)
56
+ end
58
57
  end
59
- rescue StandardError => e
60
- OpenTelemetry.logger.error("aws-lambda instrumentation #{e.class}: #{e.message}")
61
- ensure
62
- if original_handler_error
63
- span&.record_exception(original_handler_error)
64
- span&.status = OpenTelemetry::Trace::Status.error(original_handler_error.message)
65
- end
66
- span&.finish
67
- OpenTelemetry.tracer_provider.force_flush(timeout: @flush_timeout)
68
58
  end
69
59
 
60
+ OpenTelemetry.tracer_provider.force_flush(timeout: @flush_timeout)
61
+
70
62
  raise original_handler_error if original_handler_error
71
63
 
72
64
  original_response
@@ -15,7 +15,7 @@ module OpenTelemetry
15
15
 
16
16
  # determine if current environment is lambda by checking _HANLDER or ORIG_HANDLER
17
17
  present do
18
- (ENV.key?('_HANDLER') || ENV.key?('ORIG_HANDLER'))
18
+ ENV.key?('_HANDLER') || ENV.key?('ORIG_HANDLER')
19
19
  end
20
20
 
21
21
  private
@@ -7,7 +7,7 @@
7
7
  module OpenTelemetry
8
8
  module Instrumentation
9
9
  module AwsLambda
10
- VERSION = '0.1.0'
10
+ VERSION = '0.1.1'
11
11
  end
12
12
  end
13
13
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opentelemetry-instrumentation-aws_lambda
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenTelemetry Authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-11 00:00:00.000000000 Z
11
+ date: 2024-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opentelemetry-api
@@ -156,14 +156,14 @@ dependencies:
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: 1.56.1
159
+ version: 1.65.0
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: 1.56.1
166
+ version: 1.65.0
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: rubocop-performance
169
169
  requirement: !ruby/object:Gem::Requirement
@@ -241,10 +241,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby-contrib
241
241
  licenses:
242
242
  - Apache-2.0
243
243
  metadata:
244
- changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-aws_lambda/0.1.0/file/CHANGELOG.md
244
+ changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-aws_lambda/0.1.1/file/CHANGELOG.md
245
245
  source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/main/instrumentation/aws_lambda
246
246
  bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues
247
- documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-aws_lambda/0.1.0
247
+ documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-aws_lambda/0.1.1
248
248
  post_install_message:
249
249
  rdoc_options: []
250
250
  require_paths: