aspecto-opentelemetry 0.1.7 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0943b7b3f5688ebe24ae7f8bb45836d082697786ba1ea649e0ed947836f13d2
|
4
|
+
data.tar.gz: f9572d70ddeb8419648e78a2edf3b90094e2bb6658701556b01ed5a353b18f3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2181743694a6cefbde9138ddbf3dfbcb57a0b95787cf2cbda35f418d05bf6755a40f495bba32a22a0f5184fa83ef3789a63617b1d6eaadf0dcff36623c0a99ec
|
7
|
+
data.tar.gz: 9c6d4cfe66c894c6c9a82c04080d8e9653502c9bf97b82149a30522f82c1e5f5f7b2621257cbf7481baa19d776e499663df17d28bb8007940582da0bb716d909
|
data/README.md
CHANGED
@@ -19,8 +19,6 @@ Or, if you use [bundler](https://bundler.io), include aspecto-opentelemetry in y
|
|
19
19
|
|
20
20
|
### Rails Applications
|
21
21
|
|
22
|
-
#### Configuration in Code
|
23
|
-
|
24
22
|
Add this code to a new file `aspecto.rb` under `config/initializers/`:
|
25
23
|
|
26
24
|
```rb
|
@@ -34,26 +32,8 @@ Aspecto::OpenTelemetry::configure do |c|
|
|
34
32
|
end
|
35
33
|
```
|
36
34
|
|
37
|
-
#### Configuration via Environment Variables
|
38
|
-
|
39
|
-
In your Gemfile:
|
40
|
-
|
41
|
-
```
|
42
|
-
gem 'aspecto-opentelemetry', require: 'aspecto/auto_instrument'
|
43
|
-
```
|
44
|
-
|
45
|
-
And set environment variables:
|
46
|
-
|
47
|
-
```
|
48
|
-
OTEL_SERVICE_NAME=<YOUR_SERVICE_NAME>
|
49
|
-
ASPECTO_AUTH=<YOUR_ASPECTO_TOKEN>
|
50
|
-
# ASPECTO_SAMPLING_RATIO=1.0 # [optional]: defaults to 1.0, use aspecto app to configure remotely
|
51
|
-
```
|
52
|
-
|
53
35
|
### Ruby Applications
|
54
36
|
|
55
|
-
#### Configuration in Code
|
56
|
-
|
57
37
|
Add this code after your require other gems:
|
58
38
|
|
59
39
|
```rb
|
@@ -67,23 +47,6 @@ Aspecto::OpenTelemetry::configure do |c|
|
|
67
47
|
end
|
68
48
|
```
|
69
49
|
|
70
|
-
#### Configuration via Environment Variables
|
71
|
-
|
72
|
-
Add this require statement after your require other gems:
|
73
|
-
|
74
|
-
```rb
|
75
|
-
require 'aspecto/auto_instrument'
|
76
|
-
```
|
77
|
-
|
78
|
-
And set environment variables:
|
79
|
-
|
80
|
-
```
|
81
|
-
OTEL_SERVICE_NAME=<YOUR_SERVICE_NAME>
|
82
|
-
ASPECTO_AUTH=<YOUR_ASPECTO_TOKEN>
|
83
|
-
# ASPECTO_ENV=<CURRENT_ENVIRONMENT> # [optional]: automatically detected for rails and sinatra
|
84
|
-
# ASPECTO_SAMPLING_RATIO=1.0 # [optional]: defaults to 1.0, use aspecto app to configure remotely
|
85
|
-
```
|
86
|
-
|
87
50
|
### Shutdown
|
88
51
|
|
89
52
|
Call this function when your application shuts down
|
data/RELEASE.md
ADDED
@@ -16,6 +16,8 @@ module Aspecto
|
|
16
16
|
def initialize(aspecto_auth, service_name, env, fallback_sampler)
|
17
17
|
@service_name = service_name
|
18
18
|
@env = env
|
19
|
+
@error_reported = false
|
20
|
+
@got_remote_config = false
|
19
21
|
@fallback_sampler = fallback_sampler
|
20
22
|
aspecto_config_host = ENV.fetch("ASPECTO_CONFIG_HOST", "https://config.aspecto.io")
|
21
23
|
@aspecto_config_url = URI("#{aspecto_config_host}/config/#{aspecto_auth}")
|
@@ -27,7 +29,10 @@ module Aspecto
|
|
27
29
|
update_config
|
28
30
|
end
|
29
31
|
|
30
|
-
::OpenTelemetry.logger.info "[Aspecto]
|
32
|
+
::OpenTelemetry.logger.info "[Aspecto] initialized remote config polling"
|
33
|
+
rescue StandardError => e
|
34
|
+
::OpenTelemetry.logger.error "[Aspecto] failed to initialize remote config polling"
|
35
|
+
::OpenTelemetry.logger.error e
|
31
36
|
end
|
32
37
|
|
33
38
|
def shutdown
|
@@ -50,7 +55,7 @@ module Aspecto
|
|
50
55
|
@http_client.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
51
56
|
end
|
52
57
|
|
53
|
-
def update_config
|
58
|
+
def update_config
|
54
59
|
::OpenTelemetry::Common::Utilities.untraced do
|
55
60
|
request = Net::HTTP::Get.new(@aspecto_config_url.path)
|
56
61
|
request["If-None-Match"] = @latest_config_etag unless @latest_config_etag.nil?
|
@@ -60,7 +65,7 @@ module Aspecto
|
|
60
65
|
return if response_code == 304
|
61
66
|
|
62
67
|
if response_code >= 400
|
63
|
-
|
68
|
+
log_config_error "failed to get remote config with http response #{response_code}."
|
64
69
|
return
|
65
70
|
end
|
66
71
|
|
@@ -68,13 +73,14 @@ module Aspecto
|
|
68
73
|
handle_new_config JSON.parse(response.body) if response_code < 300
|
69
74
|
end
|
70
75
|
rescue StandardError => e
|
71
|
-
|
72
|
-
::OpenTelemetry.logger.debug e
|
76
|
+
log_config_error "updating remote config failed with exception.", e
|
73
77
|
end
|
74
78
|
|
75
79
|
def handle_new_config(config)
|
76
|
-
::OpenTelemetry.logger.info("[Aspecto] successfully received remote configuration")
|
77
80
|
update_sampler config["samplingRules"]
|
81
|
+
@error_reported = false
|
82
|
+
@got_remote_config = true
|
83
|
+
::OpenTelemetry.logger.info("[Aspecto] successfully updated remote configuration")
|
78
84
|
end
|
79
85
|
|
80
86
|
def update_sampler(sampler_config)
|
@@ -84,6 +90,16 @@ module Aspecto
|
|
84
90
|
# updating the sampler should be thread safe as it's an atomic setter on a global value
|
85
91
|
::OpenTelemetry.tracer_provider.sampler = message_process_sampler
|
86
92
|
end
|
93
|
+
|
94
|
+
def log_config_error(msg, err = nil)
|
95
|
+
return if @error_reported # report every issue only once
|
96
|
+
|
97
|
+
retry_msg = "will try again until success every #{@remote_config_poll_frequency}."
|
98
|
+
previous_config_msg = @got_remote_config ? "using previous remote config" : "no previous config is avialable"
|
99
|
+
::OpenTelemetry.logger.info("[Aspecto]: #{msg} #{retry_msg} #{previous_config_msg}")
|
100
|
+
::OpenTelemetry.logger.info(err) if err
|
101
|
+
@error_reported = true
|
102
|
+
end
|
87
103
|
end
|
88
104
|
end
|
89
105
|
end
|
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.
|
4
|
+
version: 0.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aspecto
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aspecto-opentelemetry-instrumentation-aws_sdk
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.4.5
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.4.5
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: opentelemetry-exporter-otlp
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -190,6 +190,7 @@ files:
|
|
190
190
|
- Gemfile
|
191
191
|
- LICENSE
|
192
192
|
- README.md
|
193
|
+
- RELEASE.md
|
193
194
|
- Rakefile
|
194
195
|
- lib/aspecto/auto_instrument.rb
|
195
196
|
- lib/aspecto/opentelemetry.rb
|