epsagon 0.0.1 → 0.0.2

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: 87955008fa3a72eef9788a33b27ea5b1b803f05f5b4576980cbfcde82f418b8f
4
- data.tar.gz: 8f55c3de860ad268786aac29fc6d132d60aaf3314858de5b7a396700a8e6b57c
3
+ metadata.gz: cb98b789dd4555d9f05f499d54eeeb40910d00e197d957e954ebf0390215955c
4
+ data.tar.gz: 0d17be938d96aa2b24a45b895fd1f00d663c193ffd9d43da4700ea048692d6a2
5
5
  SHA512:
6
- metadata.gz: c75902bf40adc989654cafad809e2cfac0a9dbba506981a3f52be29868fad8ba77691580bbae616fe793a3fb47e0ef4070d822cb659ae186ba1af86016ecd0a8
7
- data.tar.gz: 7eaf1f961154c97d106bf0ec95d763bbdb049783bbcafb08abe2ff9f685a4ab17f77282b483e42d2a06bf07ef588ab9d346b66a074355141a1f13f5a6f104190
6
+ metadata.gz: 62f724706b2b36cb7fdcdf3afa14d3b3103d394ef09daace93307e58241578c459c2b8c6c71493ff00b75c1136dce861148dad4e2c36030c861c0e9a52230aa2
7
+ data.tar.gz: b744cbda8a2636f934ee7b51c0eb2547fd0bbc39c17a222a898e3f874310d398977105fc447830343791019f6d5a0292a3ff2f0598450de4f93d3ff08953f908
data/lib/epsagon.rb CHANGED
@@ -14,52 +14,54 @@ Bundler.require
14
14
 
15
15
  # Epsagon tracing main entry point
16
16
  module Epsagon
17
- module_function
18
-
19
- def init(**args)
20
- defaults = {
17
+ @@epsagon_config = {
21
18
  metadata_only: ENV['EPSAGON_METADATA']&.to_s&.downcase != 'false',
22
19
  debug: ENV['EPSAGON_DEBUG']&.to_s&.downcase == 'true',
23
20
  token: ENV['EPSAGON_TOKEN'],
24
21
  app_name: ENV['EPSAGON_APP_NAME'],
25
22
  backend: ENV['EPSAGON_BACKEND'] || 'localhost:55681/v1/trace'
26
23
  }
27
- @@epsagon_config = defaults.merge(args)
28
- end
29
24
 
30
- def metadata_only?
31
- ENV['EPSAGON_METADATA']&.to_s&.downcase != 'false'
32
- end
25
+ module_function
33
26
 
34
- def debug?
35
- ENV['EPSAGON_DEBUG']&.to_s&.downcase == 'true'
27
+ def init(**args)
28
+ @@epsagon_config.merge!(args)
29
+ OpenTelemetry::SDK.configure
36
30
  end
37
31
 
38
32
  # config opentelemetry with epsaon extensions:
39
33
 
40
34
  def epsagon_confs(configurator)
41
35
  configurator.resource = OpenTelemetry::SDK::Resources::Resource.telemetry_sdk.merge(
42
- OpenTelemetry::SDK::Resources::Resource.create({ 'application' => ENV['EPSAGON_APP_NAME'] })
36
+ OpenTelemetry::SDK::Resources::Resource.create({ 'application' => @@epsagon_config[:app_name] })
43
37
  )
44
38
  configurator.use 'EpsagonSinatraInstrumentation', { epsagon: @@epsagon_config }
45
39
  configurator.use 'EpsagonNetHTTPInstrumentation', { epsagon: @@epsagon_config }
46
40
  configurator.use 'EpsagonFaradayInstrumentation', { epsagon: @@epsagon_config }
47
- # if ENV['EPSAGON_BACKEND']
48
- configurator.add_span_processor OpenTelemetry::SDK::Trace::Export::BatchSpanProcessor.new(
49
- exporter: OpenTelemetry::Exporter::OTLP::Exporter.new(headers: {
41
+
42
+ if @@epsagon_config[:debug]
43
+ configurator.add_span_processor OpenTelemetry::SDK::Trace::Export::SimpleSpanProcessor.new(
44
+ OpenTelemetry::Exporter::OTLP::Exporter.new(headers: {
50
45
  'x-epsagon-token' => @@epsagon_config[:token]
51
46
  },
52
47
  endpoint: @@epsagon_config[:backend],
53
48
  insecure: @@epsagon_config[:insecure] || false)
54
- )
55
- return unless debug?
49
+ )
56
50
 
57
- configurator.add_span_processor OpenTelemetry::SDK::Trace::Export::SimpleSpanProcessor.new(
58
- OpenTelemetry::SDK::Trace::Export::ConsoleSpanExporter.new
59
- )
51
+ configurator.add_span_processor OpenTelemetry::SDK::Trace::Export::SimpleSpanProcessor.new(
52
+ OpenTelemetry::SDK::Trace::Export::ConsoleSpanExporter.new
53
+ )
54
+ else
55
+ configurator.add_span_processor OpenTelemetry::SDK::Trace::Export::BatchSpanProcessor.new(
56
+ exporter: OpenTelemetry::Exporter::OTLP::Exporter.new(headers: {
57
+ 'x-epsagon-token' => @@epsagon_config[:token]
58
+ },
59
+ endpoint: @@epsagon_config[:backend],
60
+ insecure: @@epsagon_config[:insecure] || false)
61
+ )
62
+ end
60
63
  end
61
64
 
62
- OpenTelemetry::SDK.configure
63
65
  end
64
66
 
65
67
  # monkey patch to include epsagon confs
@@ -68,7 +68,7 @@ module EpsagonNetHTTPExtension
68
68
  end
69
69
 
70
70
  def tracer
71
- EpsagonSinatraInstrumentation.instance.tracer
71
+ EpsagonNetHTTPInstrumentation.instance.tracer
72
72
  end
73
73
  end
74
74
 
metadata CHANGED
@@ -1,17 +1,21 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: epsagon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
- - Assaf Paneth
7
+ - Epsagon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-24 00:00:00.000000000 Z
11
+ date: 2021-04-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: Epsagon for ruby
14
- email: assaf.paneth@gmail.com
13
+ description: 'Epsagon provides tracing to Ruby applications for the collection of
14
+ distributed tracing and performance metrics to simplify complex architectures, eliminate
15
+ manual work, visualize and correlate data to identify and fix problems fast.
16
+
17
+ '
18
+ email: info@epsagon.com
15
19
  executables: []
16
20
  extensions: []
17
21
  extra_rdoc_files: []
@@ -23,7 +27,7 @@ files:
23
27
  - lib/instrumentation/net_http.rb
24
28
  - lib/instrumentation/sinatra.rb
25
29
  - lib/util.rb
26
- homepage: https://rubygems.org/gems/epsagon
30
+ homepage: https://github.com/epsagon/epsagon-ruby
27
31
  licenses:
28
32
  - MIT
29
33
  metadata: {}
@@ -33,9 +37,9 @@ require_paths:
33
37
  - lib
34
38
  required_ruby_version: !ruby/object:Gem::Requirement
35
39
  requirements:
36
- - - "~>"
40
+ - - ">="
37
41
  - !ruby/object:Gem::Version
38
- version: '2.7'
42
+ version: 2.0.0
39
43
  required_rubygems_version: !ruby/object:Gem::Requirement
40
44
  requirements:
41
45
  - - ">="
@@ -45,5 +49,6 @@ requirements: []
45
49
  rubygems_version: 3.1.4
46
50
  signing_key:
47
51
  specification_version: 4
48
- summary: Epsagon for ruby
52
+ summary: Epsagon provides tracing to Ruby applications for the collection of distributed
53
+ tracing and performance metrics.
49
54
  test_files: []