prism_telemetry/
config.rs1use serde::{Deserialize, Serialize};
2use std::collections::HashMap;
3
4#[derive(Debug, Serialize, Deserialize, Clone)]
6pub struct BasicAuth {
7 pub enabled: bool,
8 pub username: String,
9 pub password: String,
10}
11
12#[derive(Debug, Serialize, Deserialize, Clone)]
14pub struct MetricsConfig {
15 pub enabled: bool,
16 pub endpoint: String,
17 pub auth: BasicAuth,
18}
19
20#[derive(Debug, Serialize, Deserialize, Clone)]
22pub struct LogsConfig {
23 pub enabled: bool,
24 pub endpoint: String,
25 pub auth: BasicAuth,
26}
27
28#[derive(Debug, Serialize, Deserialize, Clone)]
30pub struct TracesConfig {
31 pub enabled: bool,
32 pub endpoint: String,
33 pub auth: BasicAuth,
34}
35
36#[derive(Debug, Serialize, Deserialize, Clone)]
38pub struct ProfilesConfig {
39 pub enabled: bool,
40 pub endpoint: String,
41 pub auth: BasicAuth,
42}
43
44#[derive(Debug, Serialize, Deserialize, Clone)]
46pub struct TelemetryLabels {
47 pub labels: HashMap<String, String>,
48}
49
50#[derive(Debug, Serialize, Deserialize, Clone)]
52pub struct TelemetryConfig {
53 pub metrics: MetricsConfig,
54 pub logs: LogsConfig,
55 pub traces: TracesConfig,
56 pub profiles: ProfilesConfig,
57 pub global_labels: TelemetryLabels,
58}
59
60pub fn get_default_telemetry_config() -> TelemetryConfig {
61 TelemetryConfig {
62 metrics: MetricsConfig {
63 enabled: false,
64 endpoint: "".to_string(),
65 auth: BasicAuth {
66 enabled: false,
67 username: "".to_string(),
68 password: "".to_string(),
69 },
70 },
71 logs: LogsConfig {
72 enabled: false,
73 endpoint: "".to_string(),
74 auth: BasicAuth {
75 enabled: false,
76 username: "".to_string(),
77 password: "".to_string(),
78 },
79 },
80 traces: TracesConfig {
81 enabled: false,
82 endpoint: "".to_string(),
83 auth: BasicAuth {
84 enabled: false,
85 username: "".to_string(),
86 password: "".to_string(),
87 },
88 },
89 profiles: ProfilesConfig {
90 enabled: false,
91 endpoint: "".to_string(),
92 auth: BasicAuth {
93 enabled: false,
94 username: "".to_string(),
95 password: "".to_string(),
96 },
97 },
98 global_labels: TelemetryLabels {
99 labels: HashMap::new(),
100 },
101 }
102}