Skip to content

Commit

Permalink
Merge branch 'main' into add_shoryuken_instrumentation
Browse files Browse the repository at this point in the history
  • Loading branch information
mcinbell authored Oct 12, 2023
2 parents f5e7938 + 20e1cd0 commit d5cd236
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 11 deletions.
16 changes: 16 additions & 0 deletions instrumentation/dalli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,22 @@ OpenTelemetry::SDK.configure do |c|
end
```

### Configuration options

```ruby
OpenTelemetry::SDK.configure do |c|
c.use 'OpenTelemetry::Instrumentation::Dalli', {
# You may optionally set a value for 'peer.service', which
# will be included on all spans from this instrumentation:
peer_service: '',

# The obfuscation of query in the db.statement attribute is enabled by default.
# To disable, set db_statement to :include; to omit the query completely, set db_statement to :omit
db_statement: :include,
}
end
```

## How can I get involved?

The `opentelemetry-instrumentation-dalli` gem source is [on github][repo-github], along with related gems including `opentelemetry-api` and `opentelemetry-sdk`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Instrumentation < OpenTelemetry::Instrumentation::Base
end

option :peer_service, default: nil, validate: :string
option :db_statement, default: :include, validate: %I[omit obfuscate include]
option :db_statement, default: :obfuscate, validate: %I[omit obfuscate include]

private

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

describe 'tracing' do
before do
instrumentation.install
instrumentation.install(db_statement: :include)
end

it 'accepts peer service name from config' do
Expand Down
6 changes: 3 additions & 3 deletions instrumentation/mysql2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ end
```ruby
OpenTelemetry::SDK.configure do |c|
c.use 'OpenTelemetry::Instrumentation::Mysql2', {
# The obfuscation of SQL in the db.statement attribute is disabled by default.
# To enable, set db_statement to :obfuscate.
db_statement: :obfuscate,
# The obfuscation of SQL in the db.statement attribute is enabled by default.
# To disable, set db_statement to :include; to omit the query completely, set db_statement to :omit
db_statement: :include,
}
end
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Instrumentation < OpenTelemetry::Instrumentation::Base
end

option :peer_service, default: nil, validate: :string
option :db_statement, default: :include, validate: %I[omit include obfuscate]
option :db_statement, default: :obfuscate, validate: %I[omit include obfuscate]
option :span_name, default: :statement_type, validate: %I[statement_type db_name db_operation_and_name]
option :obfuscation_limit, default: 2000, validate: :integer

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
let(:instrumentation) { OpenTelemetry::Instrumentation::Mysql2::Instrumentation.instance }
let(:exporter) { EXPORTER }
let(:span) { exporter.finished_spans.first }
let(:config) { {} }
let(:config) { { db_statement: :include } }

before do
exporter.reset
Expand Down
4 changes: 2 additions & 2 deletions instrumentation/pg/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ OpenTelemetry::SDK.configure do |c|
# will be included on all spans from this instrumentation:
peer_service: 'postgres:readonly',

# By default, this instrumentation includes the executed SQL as the `db.statement`
# By default, this instrumentation obfuscate/sanitize the executed SQL as the `db.statement`
# semantic attribute. Optionally, you may disable the inclusion of this attribute entirely by
# setting this option to :omit or sanitize the attribute by setting to :obfuscate
# setting this option to :omit or disbale sanitization the attribute by setting to :include
db_statement: :include,
}
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Instrumentation < OpenTelemetry::Instrumentation::Base
end

option :peer_service, default: nil, validate: :string
option :db_statement, default: :include, validate: %I[omit include obfuscate]
option :db_statement, default: :obfuscate, validate: %I[omit include obfuscate]
option :obfuscation_limit, default: 2000, validate: :integer

private
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
let(:user) { ENV.fetch('TEST_POSTGRES_USER', 'postgres') }
let(:dbname) { ENV.fetch('TEST_POSTGRES_DB', 'postgres') }
let(:password) { ENV.fetch('TEST_POSTGRES_PASSWORD', 'postgres') }

let(:config) { { db_statement: :include } }
before do
instrumentation.install(config)
end
Expand Down

0 comments on commit d5cd236

Please sign in to comment.