sftrace-agent 0.1.1 → 0.1.2
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 +4 -4
- data/lib/sftrace/agent.rb +52 -22
- data/lib/sftrace/agent/version.rb +1 -1
- data/sftrace-agent.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ccbd4586ca78a5351e5af9500f5a675e6c22f42f05f853ab7dbd3149103c971e
|
4
|
+
data.tar.gz: a5c1b3950348cedb9eb0041827381895abb4fd28fa5a73c6760fc5d2791cde45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b737638874179bff24bb0fbaa3239d46b3b7d4b4456f6cb8b214b9d7cb0984eda791c7afce5b811779d8269976698b6665a327376e8a083a1bd637efff2004dc
|
7
|
+
data.tar.gz: 71a475e5d22a0beb80815d944e46c39c8c2f9e3a64d38f29131b15ce035cedf6909a4d889a760cc31250edc7bf7de98b7052fd6229c56370dbce3bb90df72805
|
data/lib/sftrace/agent.rb
CHANGED
@@ -7,26 +7,57 @@ module Sftrace
|
|
7
7
|
|
8
8
|
class Error < StandardError; end
|
9
9
|
|
10
|
-
def self.set_sftrace_config(
|
10
|
+
def self.set_sftrace_config(serviceName)
|
11
11
|
|
12
|
-
sftrace_config_file =
|
12
|
+
sftrace_config_file = "/opt/sfagent/config.yaml"
|
13
13
|
|
14
14
|
if (File.exist?(sftrace_config_file))
|
15
|
+
|
15
16
|
sftrace_array = YAML.load_file(sftrace_config_file)
|
17
|
+
|
18
|
+
if ((sftrace_array["key"] != nil) &&
|
19
|
+
(sftrace_array["tags"] != nil) &&
|
20
|
+
(sftrace_array["tags"]["appName"] != nil) &&
|
21
|
+
(sftrace_array["tags"]["projectName"] != nil)
|
22
|
+
)
|
23
|
+
|
24
|
+
decoded_key = Base64.decode64("U25hcHB5RmxvdzEyMzQ1Ng==")
|
25
|
+
decoded_profile_key = Base64.decode64(sftrace_array["key"])
|
26
|
+
|
27
|
+
decipher = OpenSSL::Cipher::AES.new(128, :CBC)
|
28
|
+
decipher.decrypt
|
29
|
+
decipher.key = decoded_key
|
30
|
+
decipher.iv = decoded_profile_key[0, 16]
|
31
|
+
plain = decipher.update(decoded_profile_key[16..-1]) + decipher.final
|
32
|
+
plain_json = JSON.parse(plain)
|
33
|
+
|
34
|
+
global_labels = "_tag_projectName=" + sftrace_array["tags"]["projectName"] +
|
35
|
+
",_tag_appName=" + sftrace_array["tags"]["appName"] +
|
36
|
+
",_tag_profileId=" + plain_json["profile_id"]
|
37
|
+
|
38
|
+
ENV['ELASTIC_APM_VERIFY_SERVER_CERT'] = "false"
|
39
|
+
ENV['ELASTIC_APM_CENTRAL_CONFIG'] = "false"
|
40
|
+
ENV['ELASTIC_APM_SPAN_FRAMES_MIN_DURATION'] = "1s"
|
41
|
+
ENV['ELASTIC_APM_STACK_TRACE_LIMIT'] = "2"
|
42
|
+
|
43
|
+
ENV['ELASTIC_APM_SERVICE_NAME'] = serviceName
|
44
|
+
ENV['ELASTIC_APM_SERVER_URL'] = plain_json["trace_server_url"]
|
45
|
+
ENV['ELASTIC_APM_GLOBAL_LABELS'] = global_labels
|
46
|
+
|
47
|
+
puts "[SFTRACE] ELASTIC_APM_SERVICE_NAME : " + ENV['ELASTIC_APM_SERVICE_NAME']
|
48
|
+
puts "[SFTRACE] ELASTIC_APM_SERVER_URL : " + ENV['ELASTIC_APM_SERVER_URL']
|
49
|
+
puts "[SFTRACE] ELASTIC_APM_GLOBAL_LABELS : " + ENV['ELASTIC_APM_GLOBAL_LABELS']
|
50
|
+
|
51
|
+
else
|
52
|
+
puts "[SFTRACE] Add all the required details in sftrace config.yaml file."
|
53
|
+
end
|
54
|
+
|
16
55
|
else
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
if ((sftrace_array["key"] != nil) &&
|
22
|
-
(sftrace_array["tags"] != nil) &&
|
23
|
-
(sftrace_array["tags"]["serviceName"] != nil) &&
|
24
|
-
(sftrace_array["tags"]["appName"] != nil) &&
|
25
|
-
(sftrace_array["tags"]["projectName"] != nil)
|
26
|
-
)
|
27
|
-
|
56
|
+
|
57
|
+
puts "[SFTRACE] Please provide a sftrace config.yaml file or else will read from env. variables."
|
58
|
+
|
28
59
|
decoded_key = Base64.decode64("U25hcHB5RmxvdzEyMzQ1Ng==")
|
29
|
-
decoded_profile_key = Base64.decode64(
|
60
|
+
decoded_profile_key = Base64.decode64(ENV['SFTRACE_PROFILE_KEY'])
|
30
61
|
|
31
62
|
decipher = OpenSSL::Cipher::AES.new(128, :CBC)
|
32
63
|
decipher.decrypt
|
@@ -35,25 +66,24 @@ module Sftrace
|
|
35
66
|
plain = decipher.update(decoded_profile_key[16..-1]) + decipher.final
|
36
67
|
plain_json = JSON.parse(plain)
|
37
68
|
|
38
|
-
global_labels = "_tag_projectName=" +
|
39
|
-
",_tag_appName=" +
|
69
|
+
global_labels = "_tag_projectName=" + ENV['SFTRACE_PROJECT_NAME'] +
|
70
|
+
",_tag_appName=" + ENV['SFTRACE_APP_NAME'] +
|
40
71
|
",_tag_profileId=" + plain_json["profile_id"]
|
41
|
-
|
72
|
+
|
42
73
|
ENV['ELASTIC_APM_VERIFY_SERVER_CERT'] = "false"
|
43
74
|
ENV['ELASTIC_APM_CENTRAL_CONFIG'] = "false"
|
44
75
|
ENV['ELASTIC_APM_SPAN_FRAMES_MIN_DURATION'] = "1s"
|
45
76
|
ENV['ELASTIC_APM_STACK_TRACE_LIMIT'] = "2"
|
46
77
|
|
47
|
-
ENV['ELASTIC_APM_SERVICE_NAME'] =
|
78
|
+
ENV['ELASTIC_APM_SERVICE_NAME'] = ENV['SFTRACE_SERVICE_NAME']
|
48
79
|
ENV['ELASTIC_APM_SERVER_URL'] = plain_json["trace_server_url"]
|
49
80
|
ENV['ELASTIC_APM_GLOBAL_LABELS'] = global_labels
|
50
|
-
|
81
|
+
|
51
82
|
puts "[SFTRACE] ELASTIC_APM_SERVICE_NAME : " + ENV['ELASTIC_APM_SERVICE_NAME']
|
52
83
|
puts "[SFTRACE] ELASTIC_APM_SERVER_URL : " + ENV['ELASTIC_APM_SERVER_URL']
|
53
84
|
puts "[SFTRACE] ELASTIC_APM_GLOBAL_LABELS : " + ENV['ELASTIC_APM_GLOBAL_LABELS']
|
54
|
-
|
55
|
-
|
56
|
-
puts "[SFTRACE] Add all the required details in sftrace config.yaml file."
|
85
|
+
|
86
|
+
return
|
57
87
|
end
|
58
88
|
|
59
89
|
end
|
data/sftrace-agent.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
11
|
|
12
12
|
spec.summary = "SnappyFlow tracing allows you to monitor software services and applications in real time."
|
13
13
|
spec.description = "Sftracing enables you to analyze performance throughout your microservices architecture all in one view. This is accomplished by tracing all of the requests - from the initial web request to your front-end service - to queries made to your back-end services. This makes finding possible bottlenecks throughout your application much easier and faster."
|
14
|
-
spec.homepage = "https://www.snappyflow.io/#/resources/sftracing/
|
14
|
+
spec.homepage = "https://www.snappyflow.io/#/resources/sftracing/ruby"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
17
17
|
spec.required_ruby_version = ">= 2.4.0"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sftrace-agent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SnappyFlow
|
@@ -45,7 +45,7 @@ files:
|
|
45
45
|
- lib/sftrace/agent.rb
|
46
46
|
- lib/sftrace/agent/version.rb
|
47
47
|
- sftrace-agent.gemspec
|
48
|
-
homepage: https://www.snappyflow.io/#/resources/sftracing/
|
48
|
+
homepage: https://www.snappyflow.io/#/resources/sftracing/ruby
|
49
49
|
licenses:
|
50
50
|
- MIT
|
51
51
|
metadata: {}
|