aspecto-opentelemetry 0.1.8 → 0.1.9
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: 005e783e20aa54623dca0a11daae40ef3e3d8a6d9b83a13b6fd44f11a0a7f00b
|
4
|
+
data.tar.gz: 9edaffde8afa0cbfb8f3547aec3fd4ab3fc236395e70e6ecb1e60b83f5d563b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a220142b3826b3cf0d95e73c559e0ac5ce0e29828f98883fd6e7f8e7a9c4a486bfe6620a49f73cbc938d23c3b0c48f8782147a69779256719520532112ef1b6d
|
7
|
+
data.tar.gz: fd9e2c8b3513d25599411f2718ff1f3aa79b75425fd9d81f75f32e1ceb7b69c4228dfc46abc1f0dc64a7f020c2916ed47f1bc29d11539cabf87e91945ce38851
|
@@ -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.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aspecto
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-01-
|
11
|
+
date: 2022-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aspecto-opentelemetry-instrumentation-aws_sdk
|