pub struct TelemetryBuilder { /* private fields */ }Expand description
Configures Telemetry. By default: OTLP over HTTP from the OTEL_*
variables, Rig’s spans at info, no logs unless RUST_LOG is set.
Implementations§
Source§impl TelemetryBuilder
impl TelemetryBuilder
Sourcepub async fn aws_cloudwatch(self) -> Result<Self, InitError>
Available on crate feature aws only.
pub async fn aws_cloudwatch(self) -> Result<Self, InitError>
aws only.Export to Amazon CloudWatch’s OTLP endpoints in the configured region, signed with SigV4 from the standard AWS credential chain. Call it from inside a tokio runtime.
For AgentCore Observability, also set OTEL_RESOURCE_ATTRIBUTES to
service.name=…,aws.log.group.names=/aws/bedrock-agentcore/runtimes/RUNTIME_ID,
as AWS documents.
Source§impl TelemetryBuilder
impl TelemetryBuilder
Sourcepub fn service_name(self, name: impl Into<String>) -> Self
pub fn service_name(self, name: impl Into<String>) -> Self
The service.name the telemetry is attributed to. Defaults to
OTEL_SERVICE_NAME, as OpenTelemetry does.
Sourcepub fn span_exporter(self, exporter: impl SpanExporter + 'static) -> Self
pub fn span_exporter(self, exporter: impl SpanExporter + 'static) -> Self
Export spans with exporter instead of OTLP (an in-memory one in
tests, a vendor’s own).
Sourcepub fn metric_exporter(
self,
exporter: impl PushMetricExporter + 'static,
) -> Self
pub fn metric_exporter( self, exporter: impl PushMetricExporter + 'static, ) -> Self
Export metrics with exporter instead of OTLP.
Sourcepub fn filter(self, directive: impl Into<String>) -> Self
pub fn filter(self, directive: impl Into<String>) -> Self
Which spans to export, as an EnvFilter directive. Defaults to
info, where Rig’s run, model and tool spans are.
Sourcepub fn logs(self, logs: bool) -> Self
pub fn logs(self, logs: bool) -> Self
Whether to also log to stderr, at RUST_LOG (default warn).
Defaults to whether RUST_LOG is set.
Sourcepub fn metrics_semconv(self, semconv: GenAiSemconv) -> Self
pub fn metrics_semconv(self, semconv: GenAiSemconv) -> Self
Which GenAI metric names to record. Overrides the
OTEL_SEMCONV_STABILITY_OPT_IN variable when given. Without it, the
variable decides, and with neither set the legacy names are recorded,
as before. See GenAiSemconv.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for TelemetryBuilder
impl !Send for TelemetryBuilder
impl !Sync for TelemetryBuilder
impl !UnwindSafe for TelemetryBuilder
impl Forget for TelemetryBuilder
impl Freeze for TelemetryBuilderwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
*const dyn FnOnce(TracerProviderBuilder) -> TracerProviderBuilder is !null: Freeze,
PhantomData<dyn FnOnce(TracerProviderBuilder) -> TracerProviderBuilder>: Freeze,
*const dyn FnOnce(MeterProviderBuilder) -> MeterProviderBuilder is !null: Freeze,
PhantomData<dyn FnOnce(MeterProviderBuilder) -> MeterProviderBuilder>: Freeze,
impl Move for TelemetryBuilder
impl Unpin for TelemetryBuilderwhere
*const u8 is !null: Unpin,
Box<dyn FnOnce(TracerProviderBuilder) -> TracerProviderBuilder>: Unpin,
Box<dyn FnOnce(MeterProviderBuilder) -> MeterProviderBuilder>: Unpin,
impl UnsafeUnpin for TelemetryBuilderwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const dyn FnOnce(TracerProviderBuilder) -> TracerProviderBuilder is !null: UnsafeUnpin,
PhantomData<dyn FnOnce(TracerProviderBuilder) -> TracerProviderBuilder>: UnsafeUnpin,
*const dyn FnOnce(MeterProviderBuilder) -> MeterProviderBuilder is !null: UnsafeUnpin,
PhantomData<dyn FnOnce(MeterProviderBuilder) -> MeterProviderBuilder>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more