signalfx-lambda 0.2.2 → 0.2.3

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: 017f434afdb0c59000e072360b64b35f3e239fcfd7b99cdde8f875d59f693286
4
- data.tar.gz: eb1704cf3eb290c791e28ed99df75f283c7a179efec5935b37f855dd30d4ef0c
3
+ metadata.gz: dcbb892d9545a5f51a42fa96a05d6ceca56837feaf63fe1d1f9841cd0f213974
4
+ data.tar.gz: 69fe913cbcf61d04852e5ad74c99b87291809272ff55eb2dc4ec49f6633c4399
5
5
  SHA512:
6
- metadata.gz: ca5df09ab26aad318af8f5467b3d4f3239fef14e3d0fcae4727f3dcd01f641f58ccc3ebb4d713bb8542aae9535f795d49fcefa2970ac76528f2eca172cc6b339
7
- data.tar.gz: 8f990b7f6ed62d02ae39b43979d36a9e7a2a48bb3177abacba544b411673d873158ab38aa0612fd053d7cd3e9a21d48f417ab7d3954f386b76072740d0fa054a
6
+ metadata.gz: 051f24fe3ccb000e698cb08516cb2ed76afb43bf5569dad2c3ec4fa7427e54b1adaa0d30ed8e2d6220fb3e77fac0071b1c343a8310bad74731a16a33d607c9e7
7
+ data.tar.gz: 07bca8e0c204e82f783619a04e9adeddb061e2e9a8c93bd19773f47eb7a46f5090da6230bb8ab5f242c46e460b5c082569f9e27dbc8441e5c38c8272647cdce7
data/README.md CHANGED
@@ -23,8 +23,10 @@ Add this line to the top of your file:
23
23
  require 'signalfx/lambda'
24
24
  ```
25
25
 
26
- To use the wrapper, register `source.SignalFx::Lambda::Tracing.wrapped_handler`
27
- in the console, where `source` is your Ruby source file. Then somewhere after
26
+ To use the wrapper, put `source.SignalFx::Lambda.wrapped_handler` as the handler
27
+ in the AWS console, where `source` is your Ruby source file (when you use AWS online
28
+ code editor the `source` is `lambda_function` and a complete handler value is
29
+ `lambda_function.SignalFx::Lambda.wrapped_handler`). Then somewhere after
28
30
  your handler function definition, the function can be registered to be
29
31
  automatically traced:
30
32
 
@@ -105,6 +107,9 @@ ingest endpoint (https://ingest.{REALM}.signalfx.com). To determine what realm
105
107
  you are in, check your profile page in the SignalFx web application (click the
106
108
  avatar in the upper right and click My Profile).
107
109
 
110
+ Send operation timeout (in seconds) can be specified with `SIGNALFX_SEND_TIMEOUT`
111
+ environment variable. Default value is 1 second.
112
+
108
113
  ## Trace and tags
109
114
 
110
115
  The wrapper will generate a trace per function invocation. The parent span will
@@ -1,8 +1,11 @@
1
+ require 'set'
1
2
  require 'signalfx'
2
3
 
3
4
  module SignalFx
4
5
  module Lambda
5
6
  module Metrics
7
+ @@ephemeral_dimensions = Set['aws_request_id', 'log_stream_name']
8
+
6
9
  class Error < StandardError; end
7
10
 
8
11
  class << self
@@ -69,7 +72,9 @@ module SignalFx
69
72
  end
70
73
 
71
74
  def populate_dimensions(context)
72
- dimensions = SignalFx::Lambda.fields.map do |key, val|
75
+ dimensions = SignalFx::Lambda.fields
76
+ .reject {|key, _| @@ephemeral_dimensions.include?(key)}
77
+ .map do |key, val|
73
78
  { :key => key, :value => val }
74
79
  end
75
80
  dimensions.push({ :key => 'metric_source', :value => SignalFx::Lambda::COMPONENT })
@@ -78,8 +83,9 @@ module SignalFx
78
83
  def init_client
79
84
  access_token = ENV['SIGNALFX_ACCESS_TOKEN']
80
85
  ingest_endpoint = ENV['SIGNALFX_METRICS_URL'] || ENV['SIGNALFX_ENDPOINT_URL'] || 'https://ingest.signalfx.com'
86
+ timeout = ENV['SIGNALFX_SEND_TIMEOUT'] || 1
81
87
 
82
- @client = SignalFx.new access_token, ingest_endpoint: ingest_endpoint
88
+ @client = SignalFx.new access_token, ingest_endpoint: ingest_endpoint, timeout: timeout
83
89
  end
84
90
  end
85
91
  end
@@ -12,7 +12,7 @@ module SignalFx
12
12
  attr_accessor :tracer, :reporter
13
13
 
14
14
  def wrap_function(event:, context:, &block)
15
- init_tracer(event) if !@tracer # avoid initializing except on a cold start
15
+ init_tracer(context) if !@tracer # avoid initializing except on a cold start
16
16
 
17
17
  tags = SignalFx::Lambda.fields
18
18
  tags['component'] = SignalFx::Lambda::COMPONENT
@@ -41,17 +41,17 @@ module SignalFx
41
41
  end
42
42
 
43
43
  def wrapped_handler(event:, context:)
44
- wrap_function(event, context, &@handler)
44
+ wrap_function(event: event, context: context, &@handler)
45
45
  end
46
46
 
47
47
  def register_handler(&handler)
48
48
  @handler = handler
49
49
  end
50
50
 
51
- def init_tracer(event)
51
+ def init_tracer(context)
52
52
  access_token = ENV['SIGNALFX_ACCESS_TOKEN']
53
53
  ingest_url = get_ingest_url
54
- service_name = ENV['SIGNALFX_SERVICE_NAME'] || event.function_name
54
+ service_name = ENV['SIGNALFX_SERVICE_NAME'] || context.function_name
55
55
  @span_prefix = ENV['SIGNALFX_SPAN_PREFIX'] || 'lambda_ruby_'
56
56
 
57
57
  # configure the trace reporter
@@ -1,5 +1,5 @@
1
1
  module SignalFx
2
2
  module Lambda
3
- VERSION = "0.2.2"
3
+ VERSION = "0.2.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: signalfx-lambda
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ashwin Chandrasekar
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-04-01 00:00:00.000000000 Z
11
+ date: 2019-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jaeger-client
@@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
119
  - !ruby/object:Gem::Version
120
120
  version: '0'
121
121
  requirements: []
122
- rubygems_version: 3.0.2
122
+ rubygems_version: 3.0.3
123
123
  signing_key:
124
124
  specification_version: 4
125
125
  summary: Lambda handler wrapper