async_profiler_agent/metadata/
mod.rs

1// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2// SPDX-License-Identifier: Apache-2.0
3
4pub use std::time::Duration;
5
6#[derive(Debug, Clone, PartialEq, Eq)]
7#[non_exhaustive]
8pub enum AgentMetadata {
9    Ec2AgentMetadata {
10        aws_account_id: String,
11        aws_region_id: String,
12        ec2_instance_id: String,
13    },
14    FargateAgentMetadata {
15        aws_account_id: String,
16        aws_region_id: String,
17        ecs_task_arn: String,
18        ecs_cluster_arn: String,
19    },
20    Other,
21}
22
23#[derive(Debug, Clone, PartialEq, Eq)]
24pub struct ReportMetadata<'a> {
25    pub instance: &'a AgentMetadata,
26    pub start: Duration,
27    pub end: Duration,
28    pub reporting_interval: Duration,
29}
30
31#[cfg(feature = "aws-metadata")]
32pub mod aws;
33
34/// [private] dummy metadata to make testing easier
35#[cfg(test)]
36pub(crate) const DUMMY_METADATA: ReportMetadata<'static> = ReportMetadata {
37    instance: &AgentMetadata::Other,
38    start: Duration::from_secs(1),
39    end: Duration::from_secs(2),
40    reporting_interval: Duration::from_secs(1),
41};