use std::{collections::BTreeMap, time::Duration};
#[derive(Debug, Clone, PartialEq, Eq, Default)]
pub struct ProfilingConfig {
pub enabled: bool,
pub pyroscope: Option<PyroscopeConfig>,
}
impl ProfilingConfig {
pub fn pyroscope(config: PyroscopeConfig) -> Self {
Self {
enabled: true,
pyroscope: Some(config),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct PyroscopeConfig {
pub endpoint: String,
pub service_name: String,
pub sample_rate: u32,
pub tags: BTreeMap<String, String>,
pub shutdown_timeout: Duration,
}
impl Default for PyroscopeConfig {
fn default() -> Self {
Self {
endpoint: "http://127.0.0.1:4040".to_string(),
service_name: "rs-zero-service".to_string(),
sample_rate: 100,
tags: BTreeMap::new(),
shutdown_timeout: Duration::from_secs(5),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct PyroscopeAgentConfig {
pub endpoint: String,
pub service_name: String,
pub sample_rate: u32,
pub tags: BTreeMap<String, String>,
pub shutdown_timeout: Duration,
}