ConfigBuilder

Struct ConfigBuilder 

Source
pub struct ConfigBuilder { /* private fields */ }

Implementations§

Source§

impl ConfigBuilder

Source

pub fn build(&self) -> Config

Finalizes the builder and returns the configuration

Source

pub fn set_service(&mut self, service: String) -> &mut Self

Sets the service name for your application

Default: unnamed-rust-service

Env variable: DD_SERVICE

Source

pub fn set_env(&mut self, env: String) -> &mut Self

Set the application’s environment, for example: prod, staging.

Default: (none)

Env variable: DD_ENV

Source

pub fn set_version(&mut self, version: String) -> &mut Self

Set the application’s version, for example: 1.2.3 or 6c44da20.

Default: (none)

Env variable: DD_VERSION

Source

pub fn set_global_tags(&mut self, tags: Vec<(String, String)>) -> &mut Self

A list of default tags to be added to every span, in (key, value) format. Example: [(layer, api), (team, intake)].

Default: (none)

Env variable: DD_TAGS

Source

pub fn add_global_tag(&mut self, tag: (String, String)) -> &mut Self

Add a tag to be added to every span, in (key, value) format. Example: (layer, api).

Source

pub fn set_telemetry_enabled(&mut self, enabled: bool) -> &mut Self

Enable or disable telemetry data collection and sending.

Default: true

Env variable: DD_INSTRUMENTATION_TELEMETRY_ENABLED

Source

pub fn set_telemetry_log_collection_enabled( &mut self, enabled: bool, ) -> &mut Self

Enable or disable log collection for telemetry.

Default: true

Env variable: DD_TELEMETRY_LOG_COLLECTION_ENABLED

Source

pub fn set_telemetry_heartbeat_interval(&mut self, seconds: f64) -> &mut Self

Interval in seconds for sending telemetry heartbeat messages.

Default: 60.0

Env variable: DD_TELEMETRY_HEARTBEAT_INTERVAL

Source

pub fn set_agent_host(&mut self, host: String) -> &mut Self

Sets the hostname of the Datadog Agent.

Default: localhost

Env variable: DD_AGENT_HOST

Source

pub fn set_trace_agent_port(&mut self, port: u32) -> &mut Self

Sets the port of the Datadog Agent for trace collection.

Default: 8126

Env variable: DD_TRACE_AGENT_PORT

Source

pub fn set_trace_agent_url(&mut self, url: String) -> &mut Self

Sets the URL of the Datadog Agent. This takes precedence over DD_AGENT_HOST and DD_TRACE_AGENT_PORT.

Default: http://localhost:8126

Env variable: DD_TRACE_AGENT_URL

Source

pub fn set_dogstatsd_agent_host(&mut self, host: String) -> &mut Self

Sets the hostname for DogStatsD metric collection.

Default: localhost

Env variable: DD_DOGSTATSD_HOST

Source

pub fn set_dogstatsd_agent_port(&mut self, port: u32) -> &mut Self

Sets the port for DogStatsD metric collection.

Default: 8125

Env variable: DD_DOGSTATSD_PORT

Source

pub fn set_trace_partial_flush_enabled(&mut self, enabled: bool) -> &mut Self

Enable partial flushing of traces.

Default: false

Env variable: DD_TRACE_PARTIAL_FLUSH_ENABLED

Source

pub fn set_trace_partial_flush_min_spans( &mut self, min_spans: usize, ) -> &mut Self

Minimum number of spans in a trace before partial flush is triggered.

Default: 300

Env variable: DD_TRACE_PARTIAL_FLUSH_MIN_SPANS

Source

pub fn set_trace_sampling_rules( &mut self, rules: Vec<SamplingRuleConfig>, ) -> &mut Self

A JSON array of objects to apply for trace sampling. Each rule must have a sample_rate between 0.0 and 1.0 (inclusive).

Default: []

Env variable: DD_TRACE_SAMPLING_RULES

Source

pub fn set_trace_rate_limit(&mut self, rate_limit: i32) -> &mut Self

Maximum number of traces to sample per second. Only applied if trace_sampling_rules are matched

Default: 100

Env variable: DD_TRACE_RATE_LIMIT

Source

pub fn set_trace_propagation_style( &mut self, styles: Vec<TracePropagationStyle>, ) -> &mut Self

A list of propagation styles to use for both extraction and injection. Supported values are datadog and tracecontext.

Default: [Datadog, TraceContext]

Env variable: DD_TRACE_PROPAGATION_STYLE

Source

pub fn set_trace_propagation_style_extract( &mut self, styles: Vec<TracePropagationStyle>, ) -> &mut Self

A list of propagation styles to use for extraction. When set, this overrides DD_TRACE_PROPAGATION_STYLE for extraction.

Default: (none)

Env variable: DD_TRACE_PROPAGATION_STYLE_EXTRACT

Source

pub fn set_trace_propagation_style_inject( &mut self, styles: Vec<TracePropagationStyle>, ) -> &mut Self

A list of propagation styles to use for injection. When set, this overrides DD_TRACE_PROPAGATION_STYLE for injection.

Default: (none)

Env variable: DD_TRACE_PROPAGATION_STYLE_INJECT

Source

pub fn set_trace_propagation_extract_first(&mut self, first: bool) -> &mut Self

When set to true, stops extracting after the first successful trace context extraction.

Default: false

Env variable: DD_TRACE_PROPAGATION_EXTRACT_FIRST

Source

pub fn set_enabled(&mut self, enabled: bool) -> &mut Self

Set to false to disable tracing.

Default: true

Env variable: DD_TRACE_ENABLED

Source

pub fn set_log_level_filter(&mut self, filter: LevelFilter) -> &mut Self

Sets the internal log level for the tracer.

Default: Error

Env variable: DD_LOG_LEVEL

Source

pub fn set_trace_stats_computation_enabled( &mut self, trace_stats_computation_enabled: bool, ) -> &mut Self

Enable computation of trace statistics.

Default: true

Env variable: DD_TRACE_STATS_COMPUTATION_ENABLED

Source

pub fn set_remote_config_enabled(&mut self, enabled: bool) -> &mut Self

Enable or disable remote configuration.

Default: true

Env variable: DD_REMOTE_CONFIGURATION_ENABLED

Source

pub fn set_remote_config_poll_interval(&mut self, seconds: f64) -> &mut Self

Interval in seconds for polling remote configuration updates.

Default: 5.0

Env variable: DD_REMOTE_CONFIG_POLL_INTERVAL_SECONDS

Source

pub fn set_datadog_tags_max_length(&mut self, length: usize) -> &mut Self

Maximum length of the x-datadog-tags header in bytes.

Default: 512

Env variable: DD_TRACE_X_DATADOG_TAGS_MAX_LENGTH

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more