aspecto-opentelemetry 0.1.7.rc0 → 0.1.7

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: 96878fe3288dcffacdf45867d12864608617b5b18a5b108b6a3a765f6fba667d
4
- data.tar.gz: 20cacce2828f81bc7a2d828d041dcb14eb05b085a2b888cd3b8b6a04d2eb5463
3
+ metadata.gz: 170a65edd49c074b4b4f4b6c387fca2fd09783966e134b595b7d8bc2f05d79f0
4
+ data.tar.gz: dafa464e48a08da3aaf868059843852db9974d7d8eda765356d2c91f631c081b
5
5
  SHA512:
6
- metadata.gz: 01045ec39c7a9375f4fb0c7503ca48ac3b6110005e53b747986af05633aa1b57a8568ddecad9a129b68d832255fa787354536ea1be14577fd394dca48cdcc99e
7
- data.tar.gz: 670c6c00d5bfcceccb1784ed960fbf9c0a6103a6b308a7271eaefd2a5dba73e0cec00f0504ea003868e5c3e83b399dd52b6ac01f944f5f47dff7b919bb27f890
6
+ metadata.gz: f4730136d9f1f4e1ca13003cbe9ce0eb4f70b66802526c119b99343697e115c3bd7d1fee92005bf03e0010260d35c0a9e07bbdd9fc7a43a1126904a619f48023
7
+ data.tar.gz: f11b3ff7ab8da4f02b343d49bf8bf49ee79c341dd6170680e64a4d6346e2be57d530e911ed5a2f3ab1b656b8cf06246ed1586d99373a83984f5a0577ade17278
data/README.md CHANGED
@@ -99,20 +99,18 @@ The only required config options are [`aspecto_auth`](https://app.aspecto.io/app
99
99
 
100
100
  ### Configuration Options
101
101
 
102
- | Option Name | Environment Variable | Type | Default | Description |
103
- | ------------------------------------ | ----------------------------------------- | ----------- | --------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
104
- | `aspecto_auth` | `ASPECTO_AUTH` | UUID string | - | Aspecto's [API key for authentication](https://app.aspecto.io/app/integration/api-key) |
105
- | `service_name` | `OTEL_SERVICE_NAME` | string | - | name of the service which is sending telemetry |
106
- | `env` | `ASPECTO_ENV` | string | extracted from rails or sinatra if used | deployment environment: `production` / `staging` / `development`, etc. |
107
- | `log_level` | `OTEL_LOG_LEVEL` | string | `ERROR` | `ERROR` / `WARN` / `INFO`, etc. |
108
- | `sampling_ratio` | `ASPECTO_SAMPLING_RATIO` | float | 1.0 | How many of the traces starting in this service should be sampled. set to number in range [0.0, 1.0] where 0.0 is no sampling, and 1.0 is sample all |
109
- | `otel_exporter_otlp_traces_endpoint` | `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` | URL | "https://otelcol.aspecto.io/v1/trace" | Url |
110
- | `require_config_for_traces` | `ASPECTO_REQUIRE_CONFIG_FOR_TRACES` | boolean | False | When `True`, the SDK will not trace anything until remote sampling configuration arrives (few hundreds ms). Can be used to enforce sampling configuration is always applied, with the cost of losing traces generated during service startup. |
111
- | `extract_b3_context` | `ASPECTO_EXTRACT_B3_CONTEXT` | boolean | False | set to `True` when the service receives requests from another instrumented component that propagate context via B3 protocol multi or single header. for example: envoy proxy, ambassador and istio |
112
- | `inject_b3_context_single_header` | `ASPECTO_INJECT_B3_CONTEXT_SINGLE_HEADER` | boolean | False | should be `True` when the service send traffic to another instrumented component that propagate context via B3 **single header** protocol |
113
- | `inject_b3_context_multi_header` | `ASPECTO_INJECT_B3_CONTEXT_MULTI_HEADER` | boolean | False | should be `True` when the service send traffic to another instrumented component that propagate context via B3 **multi header** protocol. for example: envoy proxy, istio |
114
-
115
- | |
102
+ | Option Name | Environment Variable | Type | Default | Description |
103
+ | --- | --- | --- | --- | --- |
104
+ | `aspecto_auth` | `ASPECTO_AUTH` | UUID string | - | Aspecto's [API key](https://app.aspecto.io/app/integration/api-key) for authentication |
105
+ | `service_name` | `OTEL_SERVICE_NAME` | string | - | Name of the service which is sending telemetry|
106
+ | `env` | `ASPECTO_ENV` | string | Extracted from Rails or Sinatra if used | Deployment environment: `production` / `staging` / `development`, etc. |
107
+ | `log_level` | `OTEL_LOG_LEVEL` | string | `ERROR` | `ERROR` / `WARN` / `INFO`, etc. |
108
+ | `sampling_ratio` | `ASPECTO_SAMPLING_RATIO` | float | 1.0| How many of the traces starting in this service should be sampled. set to number in range [0.0, 1.0] where 0.0 is no sampling, and 1.0 is sample all |
109
+ | `otel_exporter_otlp_traces_endpoint` | `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` | URL | `https://otelcol.aspecto.io/v1/trace` | Url |
110
+ | `require_config_for_traces` | `ASPECTO_REQUIRE_CONFIG_FOR_TRACES` | boolean | `false` | When `true`, the SDK will not trace anything until remote sampling configuration arrives (few hundreds ms). Can be used to enforce sampling configuration is always applied, with the cost of losing traces generated during service startup. |
111
+ | `extract_b3_context` | `ASPECTO_EXTRACT_B3_CONTEXT` | boolean | `false` | Set to `true` when the service receives requests from another instrumented component that propagate context via B3 protocol multi or single header. For example: Envoy Proxy, Ambassador and Istio |
112
+ | `inject_b3_context_single_header` | `ASPECTO_INJECT_B3_CONTEXT_SINGLE_HEADER` | boolean | `false` | Set to `true` when the service send traffic to another instrumented component that propagate context via B3 **single header** protocol |
113
+ | `inject_b3_context_multi_header` | `ASPECTO_INJECT_B3_CONTEXT_MULTI_HEADER` | boolean | `false` | Set to `true` when the service send traffic to another instrumented component that propagate context via B3 **multi header** protocol. For example: Envoy Proxy, Istio |
116
114
 
117
115
  ## Contributing
118
116
 
@@ -46,11 +46,9 @@ module Aspecto
46
46
 
47
47
  def self.bool_env_variable(env_variable_name, default_value)
48
48
  env_value = ENV[env_variable_name]
49
- if env_value.nil?
50
- default_value
51
- else
52
- TRUTHY_VALUES.include?(env_value.strip)
53
- end
49
+ return default_value if env_value.nil?
50
+
51
+ TRUTHY_VALUES.include?(env_value.strip)
54
52
  end
55
53
  end
56
54
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Aspecto
4
4
  module OpenTelemetry
5
- VERSION = "0.1.7.rc0"
5
+ VERSION = "0.1.7"
6
6
  end
7
7
  end
@@ -4,13 +4,13 @@ require_relative "opentelemetry/version"
4
4
  require_relative "opentelemetry/configurator"
5
5
  require_relative "opentelemetry/propagator/aspecto"
6
6
  require_relative "opentelemetry/resource/detectors/aspecto"
7
- require_relative "opentelemetry/resource/detectors/deployment"
8
7
  require_relative "opentelemetry/config/remote_config"
9
8
 
10
9
  require "opentelemetry/sdk"
11
10
  require "opentelemetry/exporter/otlp"
12
11
  require "opentelemetry/instrumentation/all"
13
12
  require "opentelemetry-instrumentation-aws_sdk"
13
+ require "opentelemetry-resource-detector-deployment"
14
14
 
15
15
  module Aspecto
16
16
  # Aspecto OpenTelemetry Distro
@@ -28,7 +28,7 @@ module Aspecto
28
28
  ::OpenTelemetry::SDK.configure do |c|
29
29
  c.logger = Logger.new($stdout, level: configurator.log_level)
30
30
  c.resource = Aspecto::OpenTelemetry::Resource::Detectors::Aspecto.detect
31
- c.resource = Aspecto::OpenTelemetry::Resource::Detectors::Deployment.detect
31
+ c.resource = ::OpenTelemetry::Resource::Detector::Deployment.detect
32
32
  c.resource = configurator.config_override_resource # must be last
33
33
  c.use_all "OpenTelemetry::Instrumentation::ActionPack" => { enable_recognize_route: true },
34
34
  "OpenTelemetry::Instrumentation::AwsSdk" => {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aspecto-opentelemetry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7.rc0
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aspecto
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-12-29 00:00:00.000000000 Z
11
+ date: 2022-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aspecto-opentelemetry-instrumentation-aws_sdk
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
68
  version: 0.19.2
69
+ - !ruby/object:Gem::Dependency
70
+ name: opentelemetry-resource-detector-deployment
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '='
74
+ - !ruby/object:Gem::Version
75
+ version: 0.0.1
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '='
81
+ - !ruby/object:Gem::Version
82
+ version: 0.0.1
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: opentelemetry-sdk
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -183,7 +197,6 @@ files:
183
197
  - lib/aspecto/opentelemetry/configurator.rb
184
198
  - lib/aspecto/opentelemetry/propagator/aspecto.rb
185
199
  - lib/aspecto/opentelemetry/resource/detectors/aspecto.rb
186
- - lib/aspecto/opentelemetry/resource/detectors/deployment.rb
187
200
  - lib/aspecto/opentelemetry/sampler/condition.rb
188
201
  - lib/aspecto/opentelemetry/sampler/message_process_sampler.rb
189
202
  - lib/aspecto/opentelemetry/sampler/operator.rb
@@ -208,9 +221,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
208
221
  version: 2.5.0
209
222
  required_rubygems_version: !ruby/object:Gem::Requirement
210
223
  requirements:
211
- - - ">"
224
+ - - ">="
212
225
  - !ruby/object:Gem::Version
213
- version: 1.3.1
226
+ version: '0'
214
227
  requirements: []
215
228
  rubygems_version: 3.1.6
216
229
  signing_key:
@@ -1,49 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Aspecto
4
- module OpenTelemetry
5
- module Resource
6
- module Detectors
7
- # Deployment contains detect class method for determining deployment resource attributes
8
- module Deployment
9
- extend self
10
-
11
- def detect
12
- resource_attributes = {}
13
- deployment_environment = rails_env || sinatra_env || rack_env
14
- resource_attributes[::OpenTelemetry::SemanticConventions::Resource::DEPLOYMENT_ENVIRONMENT] = deployment_environment if deployment_environment
15
- ::OpenTelemetry::SDK::Resources::Resource.create(resource_attributes)
16
- end
17
-
18
- private
19
-
20
- def rails_env
21
- # rails extract env like this:
22
- # https://github.com/rails/rails/blob/5647a9c1ced68d20338552d47a3b755e10a271c4/railties/lib/rails.rb#L74
23
- # ActiveSupport::EnvironmentInquirer.new(ENV["RAILS_ENV"].presence || ENV["RACK_ENV"].presence || "development")
24
- ::Rails.env.to_s if defined?(::Rails.env)
25
- end
26
-
27
- def rack_env
28
- ENV["RACK_ENV"]
29
- end
30
-
31
- def sinatra_env
32
- # https://github.com/sinatra/sinatra/blob/e69b6b9dee7165d3a583fc8a6af10ceee1ea687d/lib/sinatra/base.rb#L1801
33
- # cases:
34
- #
35
- # 1. if sinatra is "require"d before the detector, then we return the value from the library
36
- # this case will return the default "development" fallback if not env variable is set which is good.
37
- #
38
- # 2. if sinatra is "require"d after the detector, then:
39
- # 2.1 if user is setting environment via 'APP_ENV' or 'RACK_ENV' then those value will be picked up and reported
40
- # 2.2 else, the sinatra environment will fallback to "development", but detector will return nil for it.
41
- # this issue is not covered, as when detector initialize the immutable resource, it has no way
42
- # of knowing if "sinatra" will be required later or not.
43
- (::Sinatra::Base.environment.to_s if defined?(::Sinatra::Base.environment)) || ENV["APP_ENV"]
44
- end
45
- end
46
- end
47
- end
48
- end
49
- end