highlight_io 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/Gemfile.lock +5 -4
- data/highlight.gemspec +1 -1
- data/lib/highlight/version.rb +1 -1
- data/lib/highlight.rb +30 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ac88fa49d586b18a7e1be34e4f2bbda4cdd574fcbeb83ffc97b75c0101d5b43
|
4
|
+
data.tar.gz: 59840de16d8b5d3839c18aac425b7ea47aa76942a3ff4e539e8e2af623f1797b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 834eeda394658f10de79c9102cb18415a0b2918030957a105cc6ba7505fe2e20d8ad63d28c4ca6ebe6dce7091207060343661c305a67844fc41c2cdc0e00446b
|
7
|
+
data.tar.gz: 5723050e4cc62d07d4c53dfb6a1d34fb3771c622833643a0cacc7a5a5f6987ae432de560f16bb000e81631a8c8fdbad296cd79972811162a60dd303b2b1ad5ed
|
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
highlight_io (0.3.
|
5
|
-
grpc (~> 1.
|
4
|
+
highlight_io (0.3.1)
|
5
|
+
grpc (~> 1.65)
|
6
6
|
opentelemetry-exporter-otlp (~> 0.28.1)
|
7
7
|
opentelemetry-instrumentation-all (~> 0.62.1)
|
8
8
|
opentelemetry-sdk (~> 1.5.0)
|
@@ -12,8 +12,8 @@ GEM
|
|
12
12
|
remote: https://rubygems.org/
|
13
13
|
specs:
|
14
14
|
ast (2.4.2)
|
15
|
-
google-protobuf (3.25.
|
16
|
-
google-protobuf (3.25.
|
15
|
+
google-protobuf (3.25.3-arm64-darwin)
|
16
|
+
google-protobuf (3.25.3-x86_64-linux)
|
17
17
|
googleapis-common-protos-types (1.15.0)
|
18
18
|
google-protobuf (>= 3.18, < 5.a)
|
19
19
|
grpc (1.65.2-arm64-darwin)
|
@@ -254,6 +254,7 @@ GEM
|
|
254
254
|
|
255
255
|
PLATFORMS
|
256
256
|
arm64-darwin-22
|
257
|
+
arm64-darwin-23
|
257
258
|
x86_64-linux
|
258
259
|
|
259
260
|
DEPENDENCIES
|
data/highlight.gemspec
CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
23
|
spec.require_paths = ['lib']
|
24
24
|
|
25
|
-
spec.add_runtime_dependency 'grpc', '~> 1.
|
25
|
+
spec.add_runtime_dependency 'grpc', '~> 1.65'
|
26
26
|
spec.add_runtime_dependency 'opentelemetry-exporter-otlp', '~> 0.28.1'
|
27
27
|
spec.add_runtime_dependency 'opentelemetry-instrumentation-all', '~> 0.62.1'
|
28
28
|
spec.add_runtime_dependency 'opentelemetry-sdk', '~> 1.5.0'
|
data/lib/highlight/version.rb
CHANGED
data/lib/highlight.rb
CHANGED
@@ -26,6 +26,18 @@ module Highlight
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
+
def self.log(level, message, attrs = {})
|
30
|
+
H.instance.record_log(nil, nil, level, message, attrs)
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.exception(error, attrs = {})
|
34
|
+
H.instance.record_exception(error, attrs)
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.traceparent_meta
|
38
|
+
Helpers.traceparent_meta
|
39
|
+
end
|
40
|
+
|
29
41
|
class H
|
30
42
|
HIGHLIGHT_REQUEST_HEADER = 'X-Highlight-Request'.freeze
|
31
43
|
OTLP_HTTP = 'https://otel.highlight.io:4318'.freeze
|
@@ -130,6 +142,7 @@ module Highlight
|
|
130
142
|
function.delete_prefix!('in `')
|
131
143
|
function.delete_suffix!('"')
|
132
144
|
end
|
145
|
+
|
133
146
|
@tracer.in_span('highlight.log', attributes: {
|
134
147
|
HIGHLIGHT_SESSION_ATTRIBUTE => session_id,
|
135
148
|
HIGHLIGHT_TRACE_ATTRIBUTE => request_id
|
@@ -255,4 +268,21 @@ module Highlight
|
|
255
268
|
end
|
256
269
|
end
|
257
270
|
end
|
271
|
+
|
272
|
+
module Helpers
|
273
|
+
if defined?(ActionView)
|
274
|
+
include ActionView::Helpers
|
275
|
+
extend ActionView::Helpers::TagHelper
|
276
|
+
end
|
277
|
+
|
278
|
+
def self.traceparent_meta
|
279
|
+
current_trace = OpenTelemetry::Trace.current_span
|
280
|
+
trace_id = current_trace&.context&.trace_id
|
281
|
+
span_id = current_trace&.context&.span_id
|
282
|
+
hex_trace_id = trace_id&.unpack1('H*') || '00000000000000000000000000000000'
|
283
|
+
hex_span_id = span_id&.unpack1('H*') || '0000000000000000'
|
284
|
+
|
285
|
+
tag(:meta, name: 'traceparent', content: "00-#{hex_trace_id}-#{hex_span_id}-01")
|
286
|
+
end
|
287
|
+
end
|
258
288
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: highlight_io
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Highlight
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: grpc
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.65'
|
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: '1.
|
26
|
+
version: '1.65'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: opentelemetry-exporter-otlp
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|