opentelemetry-instrumentation-pg 0.18.1 → 0.19.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: ce186d43d289c64ce441d6e299d4b4b4916650ce63b0a8791dab6538e4b28ff6
4
- data.tar.gz: fa68247b40312aa9341841aa7bfa8a311e967de7efeab5a9fdda80c81646ab55
3
+ metadata.gz: 92d131df358f791a704781a41f2b4dccf138d92129ba6835179d33c01fb72c5a
4
+ data.tar.gz: 47bfd3067f55772f6f616c25d9d733b88734183248ddb6afa6cbfe462aa89560
5
5
  SHA512:
6
- metadata.gz: 72180d064f5a606dc8649bf4229ec7a714de3c0369f50f03f34ab404410dd227ff51298846b6d891d00dece30c4036c1fd7354501152f9401ccb896b5e8b721d
7
- data.tar.gz: b3ae7bc6bc75b182835d4f5d2823485da0237dd248761ee36e4cf2283c226c381753ad3cb50776adbc8bf634674451f34acc50fbaead7ee47441df94bb0d4a04
6
+ metadata.gz: e00cf026c0ad5bde5beb1881ea80311209b9eb44e763d59e453335a798681e71895beb197061ac60989e55f4404f1366cf2bc4d21105af47726782a56c34b32b
7
+ data.tar.gz: 2ea850c452a38d8fe4051f867a23d33f620a81e7e60ffbe26175fec9e5006a1993cd4b016a761fe98e5c98203cbd3aeaec2a316ba24695636c3433687721591d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Release History: opentelemetry-instrumentation-pg
2
2
 
3
+ ### v0.19.0 / 2021-08-12
4
+
5
+ * ADDED: Add db_statement toggle for postgres
6
+ * DOCS: Update docs to rely more on environment variable configuration
7
+
3
8
  ### v0.18.1 / 2021-06-23
4
9
 
5
10
  * (No significant changes)
data/README.md CHANGED
@@ -35,19 +35,14 @@ end
35
35
  ```ruby
36
36
  OpenTelemetry::SDK.configure do |c|
37
37
  c.use 'OpenTelemetry::Instrumentation::PG', {
38
- # The obfuscation of SQL in the db.statement attribute is disabled by default.
39
- # To enable, set enable_sql_obfuscation to true.
40
- enable_sql_obfuscation: false,
41
-
42
38
  # You may optionally set a value for 'peer.service', which
43
39
  # will be included on all spans from this instrumentation:
44
40
  peer_service: 'postgres:readonly',
45
41
 
46
42
  # By default, this instrumentation includes the executed SQL as the `db.statement`
47
- # semantic attribute (possibly sanitized, according to the value of `enable_sql_obfuscation`).
48
- # Optionally, you may disable the inclusion of this attribute entirely by
49
- # setting this option to false.
50
- enable_statement_attribute: true,
43
+ # semantic attribute. Optionally, you may disable the inclusion of this attribute entirely by
44
+ # setting this option to :omit or sanitize the attribute by setting to :obfuscate
45
+ db_statement: :include,
51
46
  }
52
47
  end
53
48
  ```
@@ -11,7 +11,23 @@ module OpenTelemetry
11
11
  class Instrumentation < OpenTelemetry::Instrumentation::Base
12
12
  MINIMUM_VERSION = Gem::Version.new('1.1.0')
13
13
 
14
- install do |_config|
14
+ install do |config|
15
+ if config[:enable_sql_obfuscation]
16
+ config[:db_statement] = :obfuscate
17
+ OpenTelemetry.logger.warn(
18
+ 'Instrumentation pg configuration option enable_sql_obfuscation has been deprecated,' \
19
+ 'use db_statement option instead'
20
+ )
21
+ end
22
+
23
+ unless config[:enable_statement_attribute]
24
+ config[:db_statement] = :omit
25
+ OpenTelemetry.logger.warn(
26
+ 'Instrumentation pg configuration option enable_statement_attribute has been deprecated,' \
27
+ 'use db_statement option instead'
28
+ )
29
+ end
30
+
15
31
  require_dependencies
16
32
  patch_client
17
33
  end
@@ -27,6 +43,7 @@ module OpenTelemetry
27
43
  option :peer_service, default: nil, validate: :string
28
44
  option :enable_sql_obfuscation, default: false, validate: :boolean
29
45
  option :enable_statement_attribute, default: true, validate: :boolean
46
+ option :db_statement, default: :include, validate: ->(opt) { %I[omit include obfuscate].include?(opt) }
30
47
 
31
48
  private
32
49
 
@@ -84,7 +84,7 @@ module OpenTelemetry
84
84
  end
85
85
 
86
86
  attrs = { 'db.operation' => validated_operation(operation), 'db.postgresql.prepared_statement_name' => statement_name }
87
- attrs['db.statement'] = sql if config[:enable_statement_attribute]
87
+ attrs['db.statement'] = sql unless config[:db_statement] == :omit
88
88
  attrs.reject! { |_, v| v.nil? }
89
89
 
90
90
  [span_name(operation), client_attributes.merge(attrs)]
@@ -104,7 +104,7 @@ module OpenTelemetry
104
104
  end
105
105
 
106
106
  def obfuscate_sql(sql)
107
- return sql unless config[:enable_sql_obfuscation]
107
+ return sql unless config[:db_statement] == :obfuscate
108
108
 
109
109
  # Borrowed from opentelemetry-instrumentation-mysql2
110
110
  return 'SQL query too large to remove sensitive data ...' if sql.size > 2000
@@ -7,7 +7,7 @@
7
7
  module OpenTelemetry
8
8
  module Instrumentation
9
9
  module PG
10
- VERSION = '0.18.1'
10
+ VERSION = '0.19.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-pg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.1
4
+ version: 0.19.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: 2021-06-24 00:00:00.000000000 Z
11
+ date: 2021-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opentelemetry-api
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.0.0.rc2
19
+ version: 1.0.0.rc3
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.0.0.rc2
26
+ version: 1.0.0.rc3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: opentelemetry-instrumentation-base
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.18.1
33
+ version: 0.18.2
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.18.1
40
+ version: 0.18.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: appraisal
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -108,6 +108,34 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: 1.1.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: pry
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: pry-byebug
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
111
139
  - !ruby/object:Gem::Dependency
112
140
  name: rubocop
113
141
  requirement: !ruby/object:Gem::Requirement
@@ -187,10 +215,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby
187
215
  licenses:
188
216
  - Apache-2.0
189
217
  metadata:
190
- changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-pg/v0.18.1/file.CHANGELOG.html
218
+ changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-pg/v0.19.0/file.CHANGELOG.html
191
219
  source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/instrumentation/pg
192
220
  bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
193
- documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-pg/v0.18.1
221
+ documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-pg/v0.19.0
194
222
  post_install_message:
195
223
  rdoc_options: []
196
224
  require_paths: