pub struct OtlpBuilder { /* private fields */ }
Expand description
A builder for Otlp
.
Use crate::new
to start a builder and OtlpBuilder::spawn
to complete it, passing the resulting Otlp
to emit::Setup::emit_to
.
Signals can be configured on the builder through OtlpBuilder::logs
, OtlpBuilder::traces
, and OtlpBuilder::metrics
.
See the crate root documentation for more details.
Implementations§
Source§impl OtlpBuilder
impl OtlpBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
Start a builder for an Otlp
emitter.
Signals can be configured on the builder through OtlpBuilder::logs
, OtlpBuilder::traces
, and OtlpBuilder::metrics
.
Once the builder is configured, call OtlpBuilder::spawn
to complete it, passing the resulting Otlp
to emit::Setup::emit_to
.
See the crate root documentation for more details.
Sourcepub fn logs(self, builder: OtlpLogsBuilder) -> Self
pub fn logs(self, builder: OtlpLogsBuilder) -> Self
Configure the logs signal.
Sourcepub fn traces(self, builder: OtlpTracesBuilder) -> Self
pub fn traces(self, builder: OtlpTracesBuilder) -> Self
Configure the traces signal.
Sourcepub fn metrics(self, builder: OtlpMetricsBuilder) -> Self
pub fn metrics(self, builder: OtlpMetricsBuilder) -> Self
Configure the metrics signal.
Sourcepub fn resource(self, attributes: impl Props) -> Self
pub fn resource(self, attributes: impl Props) -> Self
Configure the resource.
Some OTLP receivers accept data without a resource but the OpenTelemetry specification itself mandates it.
Sourcepub fn spawn(self) -> Otlp
pub fn spawn(self) -> Otlp
Try spawn an Otlp
instance which can be used to send diagnostic events via OTLP.
If any configured values are invalid, such as malformed URIs, this method won’t fail or panic. It will discard any events emitted to it. In these cases it will log to emit::runtime::internal
and increment the configuration_failed
metric on Otlp::metric_source
. See the Troubleshooting section of the crate root docs for more details.