opentelemetry-instrumentation-aws_lambda 0.1.0 → 0.2.0

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: 8aaeb5ccdef7fdcbffb476fb16c62fb5cbed347344baa912a6d2ea196a10bad6
4
+ data.tar.gz: 958208610a3e8d6afa1c4a7f6513508f8ccfb54d9e62e7ad9bd7fd709d59e0c0
5
5
  SHA512:
6
- metadata.gz: d959a0614ce836cb6d8579d0e5966a9b9a81982a7d05b5d28a2586d1e097c7cab7161d31fc93cfa8c19ea0e0a51f830fd78f3f90fa6de6844bc144399454e504
7
- data.tar.gz: 352b3bc74695b9aa54f3eef67274a0a7ff549444020afe17a19439255ad4f33768630b9391c8c29977b8503c41ff5f07b867d3eefa6598dba135fc07c9afa73b
6
+ metadata.gz: 6a9a8e52b61b6594849e64e1f390fa91cb7736d04fc2cfab39665307336caf1e9bce6445586ba6ec5cf7e876cbe94fd478bd9688acfc8347d52e6ff8eb3ec91f
7
+ data.tar.gz: 04c2dac7e2c15bee49aaf262082dd9695b91cf69ea02e0c6d3496f01224f606ef3100e48924a8030bc22b235a4c1fa2016754a3a2d150db2317ebfa8344c0f67
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Release History: opentelemetry-instrumentation-aws_lambda
2
2
 
3
+ ### v0.2.0 / 2025-01-16
4
+
5
+ * BREAKING CHANGE: Set minimum supported version to Ruby 3.1
6
+
7
+ * ADDED: Set minimum supported version to Ruby 3.1
8
+
9
+ ### v0.1.1 / 2024-07-30
10
+
11
+ * FIXED: Register lambda span
12
+
3
13
  ### v0.1.0 / 2024-05-11
4
14
 
5
15
  Initial release.
data/README.md CHANGED
@@ -2,17 +2,18 @@
2
2
 
3
3
  The OpenTelemetry `aws-lambda` gem is a community-maintained instrumentation for [AWS Lambda functions](https://docs.aws.amazon.com/lambda/latest/dg/ruby-handler.html).
4
4
 
5
- ## How do I get started?
5
+ ## How do I get started?
6
6
 
7
- Installation of the `opentelemetry-instrumentation-aws_lambda` gem is handled by the [OpenTelemetry Lambda Layer for Ruby](https://github.com/open-telemetry/opentelemetry-lambda/tree/main/ruby).
7
+ Installation of the `opentelemetry-instrumentation-aws_lambda` gem is handled by the [OpenTelemetry Lambda Layer for Ruby](https://github.com/open-telemetry/opentelemetry-lambda/tree/main/ruby).
8
8
 
9
9
  We do not advise installing the `opentelemetry-instrumentation-aws_lambda` gem directly into your Ruby lambda. Instead, clone the [OpenTelemetry Lambda Layer for Ruby](https://github.com/open-telemetry/opentelemetry-lambda/tree/main/ruby) and build the layer locally. Then, save it in your AWS account.
10
10
 
11
11
  ## Usage
12
12
 
13
- From the Lambda Layer side, create the wrapper. More information can be found at https://github.com/open-telemetry/opentelemetry-lambda/tree/main/ruby
13
+ From the Lambda Layer side, create the wrapper. More information can be found at <https://github.com/open-telemetry/opentelemetry-lambda/tree/main/ruby>
14
14
 
15
15
  Below is an example of `ruby/src/layer/wrapper.rb`, where you can configure the layer to suit your needs before building it:
16
+
16
17
  ```ruby
17
18
  require 'opentelemetry/sdk'
18
19
  require 'opentelemetry/instrumentation/aws_lambda'
@@ -36,6 +37,7 @@ To run the example:
36
37
  * `bundle install`
37
38
  2. Run the sample client script
38
39
  * `ruby trace_demonstration.rb`
40
+ * or `bundle exec ruby trace_demonstration.rb`
39
41
 
40
42
  This will run SNS publish command, printing OpenTelemetry traces to the console as it goes.
41
43
 
@@ -43,16 +45,15 @@ This will run SNS publish command, printing OpenTelemetry traces to the console
43
45
 
44
46
  The `opentelemetry-instrumentation-aws_lambda` gem source is [on github][repo-github], along with related gems including `opentelemetry-api` and `opentelemetry-sdk`.
45
47
 
46
- The OpenTelemetry Ruby gems are maintained by the OpenTelemetry-Ruby special interest group (SIG). You can get involved by joining us in [GitHub Discussions][discussions-url] or attending our weekly meeting. See the [meeting calendar][community-meetings] for dates and times. For more information on this and other language SIGs, see the OpenTelemetry [community page][ruby-sig].
48
+ The OpenTelemetry Ruby gems are maintained by the OpenTelemetry Ruby special interest group (SIG). You can get involved by joining us on our [GitHub Discussions][discussions-url], [Slack Channel][slack-channel] or attending our weekly meeting. See the [meeting calendar][community-meetings] for dates and times. For more information on this and other language SIGs, see the OpenTelemetry [community page][ruby-sig].
47
49
 
48
50
  ## License
49
51
 
50
52
  Apache 2.0 license. See [LICENSE][license-github] for more information.
51
53
 
52
- [aws-sdk-home]: https://github.com/aws/aws-sdk-ruby
53
- [bundler-home]: https://bundler.io
54
54
  [repo-github]: https://github.com/open-telemetry/opentelemetry-ruby
55
55
  [license-github]: https://github.com/open-telemetry/opentelemetry-ruby-contrib/blob/main/LICENSE
56
56
  [ruby-sig]: https://github.com/open-telemetry/community#ruby-sig
57
57
  [community-meetings]: https://github.com/open-telemetry/community#community-meetings
58
+ [slack-channel]: https://cloud-native.slack.com/archives/C01NWKKMKMY
58
59
  [discussions-url]: https://github.com/open-telemetry/opentelemetry-ruby/discussions
@@ -30,7 +30,6 @@ module OpenTelemetry
30
30
  def call_wrapped(event:, context:)
31
31
  parent_context = extract_parent_context(event)
32
32
 
33
- span_kind = nil
34
33
  span_kind = if event['Records'] && AWS_TRIGGERS.include?(event['Records'].dig(0, 'eventSource'))
35
34
  :consumer
36
35
  else
@@ -40,33 +39,25 @@ module OpenTelemetry
40
39
  original_handler_error = nil
41
40
  original_response = nil
42
41
  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
42
+ tracer.in_span(@original_handler, attributes: otel_attributes(event, context), kind: span_kind) do |span|
43
+ begin
44
+ response = call_original_handler(event: event, context: context)
45
+ status_code = response['statusCode'] || response[:statusCode] if response.is_a?(Hash)
46
+ span.set_attribute(OpenTelemetry::SemanticConventions::Trace::HTTP_STATUS_CODE, status_code) if status_code
47
+ rescue StandardError => e
48
+ original_handler_error = e
49
+ ensure
50
+ original_response = response
51
+ end
52
+ if original_handler_error
53
+ span.record_exception(original_handler_error)
54
+ span.status = OpenTelemetry::Trace::Status.error(original_handler_error.message)
55
+ end
58
56
  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
57
  end
69
58
 
59
+ OpenTelemetry.tracer_provider.force_flush(timeout: @flush_timeout)
60
+
70
61
  raise original_handler_error if original_handler_error
71
62
 
72
63
  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.2.0'
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.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenTelemetry Authors
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-11 00:00:00.000000000 Z
11
+ date: 2025-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opentelemetry-api
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.22.1
33
+ version: 0.23.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.22.1
40
+ version: 0.23.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: appraisal
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -156,28 +156,28 @@ dependencies:
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: 1.56.1
159
+ version: 1.69.1
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.69.1
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: rubocop-performance
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: 1.19.1
173
+ version: 1.23.0
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: 1.19.1
180
+ version: 1.23.0
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: simplecov
183
183
  requirement: !ruby/object:Gem::Requirement
@@ -198,14 +198,14 @@ dependencies:
198
198
  requirements:
199
199
  - - "~>"
200
200
  - !ruby/object:Gem::Version
201
- version: '3.19'
201
+ version: 3.24.0
202
202
  type: :development
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
206
  - - "~>"
207
207
  - !ruby/object:Gem::Version
208
- version: '3.19'
208
+ version: 3.24.0
209
209
  - !ruby/object:Gem::Dependency
210
210
  name: yard
211
211
  requirement: !ruby/object:Gem::Requirement
@@ -241,11 +241,11 @@ 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.2.0/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
248
- post_install_message:
247
+ documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-aws_lambda/0.2.0
248
+ post_install_message:
249
249
  rdoc_options: []
250
250
  require_paths:
251
251
  - lib
@@ -253,15 +253,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
253
253
  requirements:
254
254
  - - ">="
255
255
  - !ruby/object:Gem::Version
256
- version: '3.0'
256
+ version: '3.1'
257
257
  required_rubygems_version: !ruby/object:Gem::Requirement
258
258
  requirements:
259
259
  - - ">="
260
260
  - !ruby/object:Gem::Version
261
261
  version: '0'
262
262
  requirements: []
263
- rubygems_version: 3.2.33
264
- signing_key:
263
+ rubygems_version: 3.3.27
264
+ signing_key:
265
265
  specification_version: 4
266
266
  summary: AWS Lambda instrumentation for the OpenTelemetry framework
267
267
  test_files: []