module OpenTelemetry
Overview
TODO Write documentation for OpenTelemetry
Defined in:
exporter.cropentelemetry.cr:11
opentelemetry.cr:169
proto/common.pb.cr
proto/resource.pb.cr
proto/trace.pb.cr
proto/trace_service.pb.cr
Constant Summary
-
VERSION =
"0.3.4"
Class Method Summary
-
.configure(&)
Global OpenTelemetry configuration, intended to be called when your application starts.
-
.trace(name : String, &)
The primary interface for OpenTelemetry tracing, called whenever you want to either create a new trace or add nested spans to an existing trace.
Class Method Detail
def self.configure(&)
#
Global OpenTelemetry configuration, intended to be called when your
application starts. See OpenTelemetry::Configuration
for more details.
OpenTelemetry.configure do |c|
c.exporter = OpenTelemetry::HTTPExporter.new(
# Send data to Honeycomb
endpoint: URI.parse("https://api.honeycomb.io")
headers: HTTP::Headers {
"x-honeycomb-team" => ENV["HONEYCOMB_API_KEY"],
"x-honeycomb-dataset" => ENV["HONEYCOMB_DATASET"],
}
)
end
def self.trace(name : String, &)
#
The primary interface for OpenTelemetry tracing, called whenever you want to either create a new trace or add nested spans to an existing trace.
def query(sql : String, args : Array)
OpenTelemetry.trace "db.query" do |span|
span["query.sql"] = sql
span["query.args"] = args.to_s
result = run_query(sql, args)
span["query.result_count"] = result.size
result
end
end