highlight_io 0.1.4 → 0.2.1

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: '097aa8d0420fe1617bba3f9bc5358b4f4a4b33fc86c9100add607f0000a21a31'
4
- data.tar.gz: 9c2a3730d42efa5fe5fe7b2406d6e74b660cde344a72842845834f998ccdfc6d
3
+ metadata.gz: ce73dd45dc718a3763e06ad6168954ff402294f28ad7b99a3ced2234b8d878d0
4
+ data.tar.gz: 9c37d1382204c7e542a525a88e6ec02953bac04e11b11771532f8e3039339a9e
5
5
  SHA512:
6
- metadata.gz: 8d8a6b916b6ae7dee9a47c86e8ffba1da90c60b2ccdf12ca44b768f7e6022189377688ec24fa7efdef5defe78b3ee706dff681e447a41e0b082f7c2f182d5b0d
7
- data.tar.gz: '00832a7b4bdad74f86c8d488705eb5f979c2bd05d94ca963afed72fd5d86377e8890630ecb137f5605f3bf16a0b0c7090280ece588378ba0022bff8adc5e2944'
6
+ metadata.gz: ffd101b0284c9854b1d54b3f95f852d440609ab709faebd650cd1cafd67031fe97f0230b939b21981fc6a6c1f58a5e830daf214aa7ff71d374566a64767dc43d
7
+ data.tar.gz: c8437f01919ad43ad20f35a5c3a0f59470baf7acca5708834652dbba88d8008794e4c50768777b2f46b287e496c24c83141a1ad48f870b94e836c554b855a9be
data/CHANGELOG.md CHANGED
@@ -6,3 +6,12 @@
6
6
 
7
7
  - Tune settings of opentelemetry SDK to reduce memory usage.
8
8
  - Enable GZIP compression of exported data.
9
+
10
+ ## 0.2.0
11
+
12
+ - Support setting `environment` attribute to SDK initialization.
13
+ - `otlp_endpoint` updated to keyword parameter when initializing.
14
+
15
+ ## 0.2.1
16
+
17
+ - Ensure `message` on logs is always a string.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- highlight_io (0.1.4)
4
+ highlight_io (0.2.1)
5
5
  grpc (~> 1.52)
6
6
  opentelemetry-exporter-otlp (~> 0.24.0)
7
7
  opentelemetry-instrumentation-all (~> 0.32.0)
@@ -12,10 +12,10 @@ GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
14
  ast (2.4.2)
15
- google-protobuf (3.23.4-x86_64-linux)
15
+ google-protobuf (3.23.4)
16
16
  googleapis-common-protos-types (1.8.0)
17
17
  google-protobuf (~> 3.18)
18
- grpc (1.57.0-x86_64-linux)
18
+ grpc (1.57.0)
19
19
  google-protobuf (~> 3.23)
20
20
  googleapis-common-protos-types (~> 1.0)
21
21
  json (2.6.3)
@@ -231,7 +231,7 @@ GEM
231
231
  unicode-display_width (2.4.2)
232
232
 
233
233
  PLATFORMS
234
- x86_64-linux
234
+ ruby
235
235
 
236
236
  DEPENDENCIES
237
237
  highlight_io!
@@ -240,4 +240,4 @@ DEPENDENCIES
240
240
  rubocop
241
241
 
242
242
  BUNDLED WITH
243
- 2.4.19
243
+ 2.4.22
@@ -1,3 +1,3 @@
1
1
  module Highlight
2
- VERSION = '0.1.4'.freeze
2
+ VERSION = '0.2.1'.freeze
3
3
  end
data/lib/highlight.rb CHANGED
@@ -22,7 +22,7 @@ module Highlight
22
22
  @@instance
23
23
  end
24
24
 
25
- def initialize(project_id, otlp_endpoint = OTLP_HTTP)
25
+ def initialize(project_id, environment: '', otlp_endpoint: OTLP_HTTP)
26
26
  @@instance = self # rubocop:disable Style/ClassVars
27
27
 
28
28
  @project_id = project_id
@@ -34,6 +34,11 @@ module Highlight
34
34
  endpoint: "#{@otlp_endpoint}/v1/traces", compression: 'gzip'
35
35
  ), schedule_delay: 1000, max_export_batch_size: 128, max_queue_size: 1024
36
36
  ))
37
+
38
+ c.resource = OpenTelemetry::SDK::Resources::Resource.create(
39
+ OpenTelemetry::SemanticConventions::Resource::DEPLOYMENT_ENVIRONMENT => environment
40
+ )
41
+
37
42
  yield c if block_given?
38
43
  end
39
44
 
@@ -65,6 +70,7 @@ module Highlight
65
70
  span.record_exception(e, attributes: attrs)
66
71
  end
67
72
 
73
+ # rubocop:disable Metrics/AbcSize
68
74
  def record_log(session_id, request_id, level, message, attrs = {})
69
75
  caller_info = caller[0].split(':', 3)
70
76
  function = caller_info[2]
@@ -81,13 +87,14 @@ module Highlight
81
87
  span.status = OpenTelemetry::Trace::Status.error(message) if [Logger::ERROR, Logger::FATAL].include?(level)
82
88
  span.add_event(LOG_EVENT, attributes: {
83
89
  LOG_SEVERITY_ATTRIBUTE => H.log_level_string(level),
84
- LOG_MESSAGE_ATTRIBUTE => message,
90
+ LOG_MESSAGE_ATTRIBUTE => message.to_s,
85
91
  CODE_FILEPATH => caller_info[0],
86
92
  CODE_LINENO => caller_info[1],
87
93
  CODE_FUNCTION => function
88
94
  }.merge(attrs))
89
95
  end
90
96
  end
97
+ # rubocop:enable Metrics/AbcSize
91
98
 
92
99
  HighlightHeaders = Struct.new('HighlightHeaders', :session_id, :request_id)
93
100
  def self.parse_headers(headers)
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.1.4
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Highlight
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-09-20 00:00:00.000000000 Z
11
+ date: 2024-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: grpc