Module: OpenTelemetry::Instrumentation::PG
- Extended by:
- PG
- Included in:
- PG
- Defined in:
- lib/opentelemetry/instrumentation/pg.rb,
lib/opentelemetry/instrumentation/pg/version.rb,
lib/opentelemetry/instrumentation/pg/constants.rb,
lib/opentelemetry/instrumentation/pg/lru_cache.rb,
lib/opentelemetry/instrumentation/pg/instrumentation.rb,
lib/opentelemetry/instrumentation/pg/patches/connection.rb
Overview
Contains the OpenTelemetry instrumentation for the Pg gem
Defined Under Namespace
Modules: Constants, Patches Classes: Instrumentation, LruCache
Constant Summary collapse
- VERSION =
'0.29.0'
Instance Method Summary collapse
-
#attributes(context = nil) ⇒ Object
Returns the attributes hash representing the postgres client context found in the optional context or the current context if none is provided.
-
#with_attributes(attributes_hash) {|Hash, Context| ... } ⇒ Object
Activates/deactivates the merged attributes hash within the current Context, which makes the "current attributes hash" available implicitly.
Instance Method Details
#attributes(context = nil) ⇒ Object
Returns the attributes hash representing the postgres client context found in the optional context or the current context if none is provided.
25 26 27 28 |
# File 'lib/opentelemetry/instrumentation/pg.rb', line 25 def attributes(context = nil) context ||= Context.current context.value(CURRENT_ATTRIBUTES_KEY) || {} end |
#with_attributes(attributes_hash) {|Hash, Context| ... } ⇒ Object
Activates/deactivates the merged attributes hash within the current Context, which makes the "current attributes hash" available implicitly.
On exit, the attributes hash that was active before calling this method will be reactivated.
39 40 41 42 |
# File 'lib/opentelemetry/instrumentation/pg.rb', line 39 def with_attributes(attributes_hash) attributes_hash = attributes.merge(attributes_hash) Context.with_value(CURRENT_ATTRIBUTES_KEY, attributes_hash) { |c, h| yield h, c } end |