Skip to main content

Crate opentelemetry_detector_ecs

Crate opentelemetry_detector_ecs 

Source
Expand description

An OpenTelemetry resource detector for Amazon ECS.

EcsResourceDetector reads the ECS task metadata endpoint and reports the cloud, container, task, and log attributes named by the semantic conventions for ECS. Anywhere else it reports nothing, so a program that also runs outside ECS can register it unconditionally:

use opentelemetry_detector_ecs::EcsResourceDetector;
use opentelemetry_sdk::Resource;

let resource = Resource::builder()
    .with_detector(Box::new(EcsResourceDetector))
    .build();

Every key it reports is a public constant in attributes.

On ECS Anywhere it also reports the Systems Manager managed instance the task runs on, which costs three API calls and the permissions to make them. See EcsResourceDetector for what those are. The anywhere cargo feature, on by default, carries that lookup; turning it off drops the lookup and the AWS SDK dependencies behind it.

Detection blocks for up to two seconds while it queries the metadata endpoint, and five more on ECS Anywhere. It reports whatever it has gathered so far if the endpoint or the APIs answer slowly, partially, or not at all.

Modules§

attributes
Every resource attribute key the detector reports.

Structs§

EcsResourceDetector
Describes the Amazon ECS task the current process belongs to.