opentelemetry-instrumentation-trilogy 0.56.3 → 0.58.0

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: e7aa67e08b66f73cd642d5dcaa13122c6c9639b50c35eb224a0978c73c9be1e7
4
- data.tar.gz: 014a7d026c44f924a08e81d0c25d42132a114199efafa929aa1172786953fae7
3
+ metadata.gz: 9f429627ce071719d113b276014d9a29a1fb62ac80f6642bb5539b4af00492fb
4
+ data.tar.gz: 991fc47cc5ad5035472afd2e63979c88439a1cf8ef267d4b49284bc91f05fa3a
5
5
  SHA512:
6
- metadata.gz: 7e4b68e200cae859e0117b0ee57e13c79946c52b0231e2a1a3476d43ddc1c6dda637c6af6556e805e2f66e378e92bb8a352c84ca586e6bc24939e32ca3740ae0
7
- data.tar.gz: 48a2bc454a232c530d72221ae134b71a3874ee83cd078ce35dd45c3fd9c16f52f76112e555e671333eb9e60a7a3dc4853c7b1bfae26fecefaa705bc1bf45e29c
6
+ metadata.gz: 73586de29d6e371b1b6e7ccad39c02a98f2f5a25874a051e4b1a746656d600b19ccf72cd7162463a5b990e72b036a5a359574e9470afaf6a88996eed4f5bad7c
7
+ data.tar.gz: 6128893e616a10574686b3c7968bbf7f0659fcfdd5ce89564c0fc2c47b2d33d71c1c92f2a83e23e0888833a0d5a92e09ca69ea585a6c8acd81269049ecd40f87
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Release History: opentelemetry-instrumentation-trilogy
2
2
 
3
+ ### v0.58.0 / 2024-01-06
4
+
5
+ * BREAKING CHANGE: Change db.mysql.instance.address to db.instance.id
6
+
7
+ * ADDED: Change db.mysql.instance.address to db.instance.id
8
+ * FIXED: Trilogy only set db.instance.id attribute if there is a value
9
+
10
+ ### v0.57.0 / 2023-10-27
11
+
12
+ * ADDED: Instrument connect and ping
13
+
3
14
  ### v0.56.3 / 2023-08-03
4
15
 
5
16
  * FIXED: Remove inline linter rules
data/README.md CHANGED
@@ -51,6 +51,19 @@ OpenTelemetry::Instrumentation::Trilogy.with_attributes('pizzatoppings' => 'mush
51
51
  end
52
52
  ```
53
53
 
54
+ ## Semantic Conventions
55
+
56
+ This instrumentation generally uses [Database semantic conventions](https://opentelemetry.io/docs/specs/semconv/database/database-spans/).
57
+
58
+ | Attribute Name | Type | Notes |
59
+ | - | - | - |
60
+ | `db.instance.id` | String | The name of the DB host executing the query e.g. `SELECT @@hostname` |
61
+ | `db.name` | String | The name of the database from connection_options |
62
+ | `db.statement` | String | SQL statement being executed |
63
+ | `db.user` | String | The username from connection_options |
64
+ | `db.system` | String | `mysql` |
65
+ | `net.peer.name` | String | The name of the remote host from connection_options |
66
+
54
67
  ## How can I get involved?
55
68
 
56
69
  The `opentelemetry-instrumentation-trilogy` gem source is [on github][repo-github], along with related gems including `opentelemetry-api` and `opentelemetry-sdk`.
@@ -48,6 +48,28 @@ module OpenTelemetry
48
48
 
49
49
  FULL_SQL_REGEXP = Regexp.union(MYSQL_COMPONENTS.map { |component| COMPONENTS_REGEX_MAP[component] })
50
50
 
51
+ def initialize(options = {})
52
+ @connection_options = options # This is normally done by Trilogy#initialize
53
+
54
+ tracer.in_span(
55
+ 'connect',
56
+ attributes: client_attributes.merge!(OpenTelemetry::Instrumentation::Trilogy.attributes),
57
+ kind: :client
58
+ ) do
59
+ super
60
+ end
61
+ end
62
+
63
+ def ping(...)
64
+ tracer.in_span(
65
+ 'ping',
66
+ attributes: client_attributes.merge!(OpenTelemetry::Instrumentation::Trilogy.attributes),
67
+ kind: :client
68
+ ) do
69
+ super
70
+ end
71
+ end
72
+
51
73
  def query(sql)
52
74
  tracer.in_span(
53
75
  database_span_name(sql),
@@ -60,22 +82,24 @@ module OpenTelemetry
60
82
 
61
83
  private
62
84
 
63
- def client_attributes(sql)
85
+ def client_attributes(sql = nil)
64
86
  attributes = {
65
87
  ::OpenTelemetry::SemanticConventions::Trace::DB_SYSTEM => 'mysql',
66
- ::OpenTelemetry::SemanticConventions::Trace::NET_PEER_NAME => connection_options.fetch(:host, 'unknown sock')
88
+ ::OpenTelemetry::SemanticConventions::Trace::NET_PEER_NAME => connection_options&.fetch(:host, 'unknown sock') || 'unknown sock'
67
89
  }
68
90
 
69
91
  attributes[::OpenTelemetry::SemanticConventions::Trace::DB_NAME] = database_name if database_name
70
92
  attributes[::OpenTelemetry::SemanticConventions::Trace::DB_USER] = database_user if database_user
71
93
  attributes[::OpenTelemetry::SemanticConventions::Trace::PEER_SERVICE] = config[:peer_service] unless config[:peer_service].nil?
72
- attributes['db.mysql.instance.address'] = @connected_host if defined?(@connected_host)
73
-
74
- case config[:db_statement]
75
- when :obfuscate
76
- attributes[::OpenTelemetry::SemanticConventions::Trace::DB_STATEMENT] = obfuscate_sql(sql)
77
- when :include
78
- attributes[::OpenTelemetry::SemanticConventions::Trace::DB_STATEMENT] = sql
94
+ attributes['db.instance.id'] = @connected_host unless @connected_host.nil?
95
+
96
+ if sql
97
+ case config[:db_statement]
98
+ when :obfuscate
99
+ attributes[::OpenTelemetry::SemanticConventions::Trace::DB_STATEMENT] = obfuscate_sql(sql)
100
+ when :include
101
+ attributes[::OpenTelemetry::SemanticConventions::Trace::DB_STATEMENT] = sql
102
+ end
79
103
  end
80
104
 
81
105
  attributes
@@ -7,7 +7,7 @@
7
7
  module OpenTelemetry
8
8
  module Instrumentation
9
9
  module Trilogy
10
- VERSION = '0.56.3'
10
+ VERSION = '0.58.0'
11
11
  end
12
12
  end
13
13
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opentelemetry-instrumentation-trilogy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.56.3
4
+ version: 0.58.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenTelemetry Authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-03 00:00:00.000000000 Z
11
+ date: 2024-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opentelemetry-api
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 2.2.0
61
+ version: '2.5'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 2.2.0
68
+ version: '2.5'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bundler
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -184,14 +184,28 @@ dependencies:
184
184
  requirements:
185
185
  - - "~>"
186
186
  - !ruby/object:Gem::Version
187
- version: 1.55.1
187
+ version: 1.59.0
188
188
  type: :development
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
192
  - - "~>"
193
193
  - !ruby/object:Gem::Version
194
- version: 1.55.1
194
+ version: 1.59.0
195
+ - !ruby/object:Gem::Dependency
196
+ name: rubocop-performance
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - "~>"
200
+ - !ruby/object:Gem::Version
201
+ version: 1.19.1
202
+ type: :development
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - "~>"
207
+ - !ruby/object:Gem::Version
208
+ version: 1.19.1
195
209
  - !ruby/object:Gem::Dependency
196
210
  name: simplecov
197
211
  requirement: !ruby/object:Gem::Requirement
@@ -240,20 +254,6 @@ dependencies:
240
254
  - - "~>"
241
255
  - !ruby/object:Gem::Version
242
256
  version: '0.9'
243
- - !ruby/object:Gem::Dependency
244
- name: yard-doctest
245
- requirement: !ruby/object:Gem::Requirement
246
- requirements:
247
- - - "~>"
248
- - !ruby/object:Gem::Version
249
- version: 0.1.6
250
- type: :development
251
- prerelease: false
252
- version_requirements: !ruby/object:Gem::Requirement
253
- requirements:
254
- - - "~>"
255
- - !ruby/object:Gem::Version
256
- version: 0.1.6
257
257
  description: Adds auto instrumentation that includes SQL metadata
258
258
  email:
259
259
  - cncf-opentelemetry-contributors@lists.cncf.io
@@ -275,10 +275,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby-contrib
275
275
  licenses:
276
276
  - Apache-2.0
277
277
  metadata:
278
- changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-trilogy/0.56.3/file/CHANGELOG.md
278
+ changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-trilogy/0.58.0/file/CHANGELOG.md
279
279
  source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/main/instrumentation/trilogy
280
280
  bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues
281
- documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-trilogy/0.56.3
281
+ documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-trilogy/0.58.0
282
282
  post_install_message:
283
283
  rdoc_options: []
284
284
  require_paths: