Module: Uptrace
- Extended by:
- Uptrace
- Included in:
- Uptrace
- Defined in:
- lib/uptrace.rb,
lib/uptrace/dsn.rb,
lib/uptrace/trace.rb,
lib/uptrace/client.rb,
lib/uptrace/metric.rb,
lib/uptrace/version.rb,
lib/uptrace/trace/exporter.rb
Overview
Uptrace provides Uptrace exporters for OpenTelemetry.
Defined Under Namespace
Modules: Metric, Trace Classes: Client, DSN
Constant Summary collapse
- VERSION =
'0.16.1'
Instance Attribute Summary collapse
-
#client ⇒ Object, Client
Registered client or a default no-op implementation of the client.
-
#logger ⇒ Object
Returns the value of attribute logger.
Instance Method Summary collapse
-
#configure_opentelemetry(c, dsn: '') ⇒ Object
ConfigureOpentelemetry configures OpenTelemetry to export data to Uptrace.
- #trace_url(span = nil) ⇒ String
Instance Attribute Details
#client ⇒ Object, Client
Returns registered client or a default no-op implementation of the client.
16 17 18 |
# File 'lib/uptrace.rb', line 16 def client @client ||= Client.new end |
#logger ⇒ Object
Returns the value of attribute logger.
10 11 12 |
# File 'lib/uptrace.rb', line 10 def logger @logger end |
Instance Method Details
#configure_opentelemetry(c, dsn: '') ⇒ Object
ConfigureOpentelemetry configures OpenTelemetry to export data to Uptrace. By default it:
- creates tracer provider;
- registers Uptrace span exporter;
- sets tracecontext + baggage composite context propagator.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/uptrace.rb', line 33 def configure_opentelemetry(c, dsn: '') @client = Client.new(dsn: dsn) unless dsn.empty? c.add_span_processor(client.span_processor) unless client.disabled? if OpenTelemetry.propagation.nil? c.injectors = [ OpenTelemetry::Trace::Propagation::TraceContext.text_map_injector, OpenTelemetry::Baggage::Propagation.text_map_injector ] c.extractors = [ OpenTelemetry::Trace::Propagation::TraceContext.text_map_extractor, OpenTelemetry::Baggage::Propagation.text_map_extractor ] end end |
#trace_url(span = nil) ⇒ String
22 23 24 |
# File 'lib/uptrace.rb', line 22 def trace_url(span = nil) client.trace_url(span) end |