Skip to main content

libdd_data_pipeline/agent_info/
schema.rs

1// Copyright 2024-Present Datadog, Inc. https://www.datadoghq.com/
2// SPDX-License-Identifier: Apache-2.0
3//! This module provides struct representing the info endpoint response
4use serde::{Deserialize, Serialize};
5use std::collections::HashMap;
6
7/// Wrapper for an agent info response storing the state hash from the agent
8#[derive(Clone, Deserialize, Default, Debug, PartialEq)]
9pub struct AgentInfo {
10    /// Hash of the info
11    pub state_hash: String,
12    /// Info response from the agent
13    pub info: AgentInfoStruct,
14}
15
16/// Schema of an agent info response
17#[allow(missing_docs)]
18#[derive(Clone, Serialize, Deserialize, Default, Debug, PartialEq)]
19pub struct AgentInfoStruct {
20    /// Version of the agent
21    pub version: Option<String>,
22    /// Commit of the version of the agent
23    pub git_commit: Option<String>,
24    /// List of available endpoints
25    pub endpoints: Option<Vec<String>>,
26    /// List of feature flags
27    pub feature_flags: Option<Vec<String>>,
28    pub client_drop_p0s: Option<bool>,
29    pub span_meta_structs: Option<bool>,
30    pub long_running_spans: Option<bool>,
31    pub evp_proxy_allowed_headers: Option<Vec<String>>,
32    /// Configuration of the agent
33    pub config: Option<Config>,
34    /// List of keys mapped to peer tags
35    pub peer_tags: Option<Vec<String>>,
36    /// List of span kinds eligible for stats computation
37    pub span_kinds_stats_computed: Option<Vec<String>>,
38}
39
40#[allow(missing_docs)]
41#[derive(Clone, Serialize, Deserialize, Default, Debug, PartialEq)]
42pub struct Config {
43    pub default_env: Option<String>,
44    pub target_tps: Option<f64>,
45    pub max_eps: Option<f64>,
46    pub receiver_port: Option<i32>,
47    pub receiver_socket: Option<String>,
48    pub connection_limit: Option<i32>,
49    pub receiver_timeout: Option<i32>,
50    pub max_request_bytes: Option<i64>,
51    pub statsd_port: Option<i32>,
52    pub max_memory: Option<f64>,
53    pub max_cpu: Option<f64>,
54    pub analyzed_spans_by_service: Option<HashMap<String, HashMap<String, f64>>>,
55}
56
57#[allow(missing_docs)]
58#[derive(Clone, Deserialize, Default, Debug, PartialEq)]
59pub struct ObfuscationConfig {
60    pub elastic_search: bool,
61    pub mongo: bool,
62    pub sql_exec_plan: bool,
63    pub sql_exec_plan_normalize: bool,
64    pub http: HttpObfuscationConfig,
65    pub remove_stack_traces: bool,
66    pub redis: RedisObfuscationConfig,
67    pub memcached: MemcachedObfuscationConfig,
68}
69
70#[allow(missing_docs)]
71#[derive(Clone, Deserialize, Default, Debug, PartialEq)]
72pub struct HttpObfuscationConfig {
73    pub remove_query_string: bool,
74    pub remove_path_digits: bool,
75}
76
77#[allow(missing_docs)]
78#[derive(Clone, Deserialize, Default, Debug, PartialEq)]
79pub struct RedisObfuscationConfig {
80    pub enabled: bool,
81    pub remove_all_args: bool,
82}
83
84#[allow(missing_docs)]
85#[derive(Clone, Deserialize, Default, Debug, PartialEq)]
86pub struct MemcachedObfuscationConfig {
87    pub enabled: bool,
88    pub keep_command: bool,
89}