-
Notifications
You must be signed in to change notification settings - Fork 6
Observability
Observability is the extent to which a system's current state can be inferred from the data it emits. The data emitted is commonly referred to as telemetry. We currently support traces as a telemetry signal.
A TelemetryProvider
will be used to emit telemetry data. By default, the NoOpTelemetryProvider
will not record or emit any telemetry data. We currently supports OpenTelemetry (OTel) as a provider.
If a provider isn't supported, you can implement your own provider by inheriting the following base classes and implemented the interfaces defined:
OTelProvider allows to emit telemetry data based on OpenTelemetry.
To use this provider, install and require the opentelemetry-sdk gem. Then, pass in an instance of a Hearth::Telemetry::OTelProvider
as the :telemetry_provider
configuration on the Client.
require 'opentelemetry-sdk'
# sets up the OpenTelemetry SDK with their config defaults
OpenTelemetry::SDK.configure
otel_provider = Hearth::Telemetry::OTelProvider.new
client = Service::Client.new(telemetry_provider: otel_provider)
Here is an example of exporting telemetry via console:
require 'opentelemetry-sdk'
ENV['OTEL_TRACES_EXPORTER'] ||= 'console'
# configures the OpenTelemetry SDK with defaults
OpenTelemetry::SDK.configure
otel_provider = Hearth::Telemetry::OTelProvider.new
client = Service::Client.new(telemetry_provider: otel_provider)
client.some_operation
# => exported spans
OpenTelemetry supports many ways to export your telemetry data. See here for more details.