Skip to main content

build_resource

Function build_resource 

Source
pub fn build_resource(
    service_name: &str,
    service_version: Option<&str>,
    deployment_environment: Option<&str>,
) -> Resource
Expand description

Build a Resource enriched with semantic-convention attributes.

Auto-detects host.name and process.pid. Optionally sets service.version and deployment.environment when provided.

§Example

let resource = otel_bootstrap::build_resource(
    "my-service",
    Some("1.0.0"),
    Some("production"),
);
// `resource` can be passed to SdkTracerProvider::builder().with_resource(resource)