1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2019-Present Datadog, Inc.
use serde::de::{Error, MapAccess, Visitor};
use serde::{Deserialize, Deserializer, Serialize};
use serde_with::skip_serializing_none;
use std::fmt::{self, Formatter};
/// Attributes for an aggregated connection.
#[non_exhaustive]
#[skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize)]
pub struct SingleAggregatedConnectionResponseDataAttributes {
/// The total number of bytes sent by the client over the given period.
#[serde(rename = "bytes_sent_by_client")]
pub bytes_sent_by_client: Option<i64>,
/// The total number of bytes sent by the server over the given period.
#[serde(rename = "bytes_sent_by_server")]
pub bytes_sent_by_server: Option<i64>,
/// The key, value pairs for each group by.
#[serde(rename = "group_bys")]
pub group_bys: Option<std::collections::BTreeMap<String, Vec<String>>>,
/// The total number of packets sent by the client over the given period.
#[serde(rename = "packets_sent_by_client")]
pub packets_sent_by_client: Option<i64>,
/// The total number of packets sent by the server over the given period.
#[serde(rename = "packets_sent_by_server")]
pub packets_sent_by_server: Option<i64>,
/// Measured as TCP smoothed round trip time in microseconds (the time between a TCP frame being sent and acknowledged).
#[serde(rename = "rtt_micro_seconds")]
pub rtt_micro_seconds: Option<i64>,
/// The number of TCP connections in a closed state. Measured in connections per second from the client.
#[serde(rename = "tcp_closed_connections")]
pub tcp_closed_connections: Option<i64>,
/// The number of TCP segments acknowledged with the ECN Congestion Experienced (CE) mark, indicating that an upstream router marked packets as experiencing congestion.
#[serde(rename = "tcp_delivered_ce")]
pub tcp_delivered_ce: Option<i64>,
/// The number of TCP connections in an established state. Measured in connections per second from the client.
#[serde(rename = "tcp_established_connections")]
pub tcp_established_connections: Option<i64>,
/// The number of TCP zero-window probes sent. These probes are sent when the receiver advertises a zero receive window, indicating it cannot accept more data.
#[serde(rename = "tcp_probe0_count")]
pub tcp_probe0_count: Option<i64>,
/// The number of TCP packets received out of order. This indicates network-level packet reordering, which can degrade TCP performance by triggering spurious retransmissions and reducing throughput.
#[serde(rename = "tcp_rcv_ooo_pack")]
pub tcp_rcv_ooo_pack: Option<i64>,
/// The number of TCP fast recovery events. Fast recovery retransmits lost segments detected through duplicate ACKs or selective acknowledgment (SACK) without waiting for a retransmission timeout.
#[serde(rename = "tcp_recovery_count")]
pub tcp_recovery_count: Option<i64>,
/// The number of TCP connections that were refused by the server. Typically this indicates an attempt to connect to an IP/port that is not receiving connections, or a firewall/security misconfiguration.
#[serde(rename = "tcp_refusals")]
pub tcp_refusals: Option<i64>,
/// The number of times reordering of sent packets was detected. Reordering detection adjusts the duplicate ACK threshold, preventing spurious retransmissions caused by out-of-order delivery.
#[serde(rename = "tcp_reord_seen")]
pub tcp_reord_seen: Option<i64>,
/// The number of TCP connections that were reset by the server.
#[serde(rename = "tcp_resets")]
pub tcp_resets: Option<i64>,
/// TCP Retransmits represent detected failures that are retransmitted to ensure delivery. Measured in count of retransmits from the client.
#[serde(rename = "tcp_retransmits")]
pub tcp_retransmits: Option<i64>,
/// The number of TCP retransmission timeouts (RTOs). An RTO occurs when an ACK is not received within the estimated round-trip time, forcing the sender to retransmit and halve its congestion window.
#[serde(rename = "tcp_rto_count")]
pub tcp_rto_count: Option<i64>,
/// The number of TCP connections that timed out from the perspective of the operating system. This can indicate general connectivity and latency issues.
#[serde(rename = "tcp_timeouts")]
pub tcp_timeouts: Option<i64>,
#[serde(flatten)]
pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
#[serde(skip)]
#[serde(default)]
pub(crate) _unparsed: bool,
}
impl SingleAggregatedConnectionResponseDataAttributes {
pub fn new() -> SingleAggregatedConnectionResponseDataAttributes {
SingleAggregatedConnectionResponseDataAttributes {
bytes_sent_by_client: None,
bytes_sent_by_server: None,
group_bys: None,
packets_sent_by_client: None,
packets_sent_by_server: None,
rtt_micro_seconds: None,
tcp_closed_connections: None,
tcp_delivered_ce: None,
tcp_established_connections: None,
tcp_probe0_count: None,
tcp_rcv_ooo_pack: None,
tcp_recovery_count: None,
tcp_refusals: None,
tcp_reord_seen: None,
tcp_resets: None,
tcp_retransmits: None,
tcp_rto_count: None,
tcp_timeouts: None,
additional_properties: std::collections::BTreeMap::new(),
_unparsed: false,
}
}
pub fn bytes_sent_by_client(mut self, value: i64) -> Self {
self.bytes_sent_by_client = Some(value);
self
}
pub fn bytes_sent_by_server(mut self, value: i64) -> Self {
self.bytes_sent_by_server = Some(value);
self
}
pub fn group_bys(mut self, value: std::collections::BTreeMap<String, Vec<String>>) -> Self {
self.group_bys = Some(value);
self
}
pub fn packets_sent_by_client(mut self, value: i64) -> Self {
self.packets_sent_by_client = Some(value);
self
}
pub fn packets_sent_by_server(mut self, value: i64) -> Self {
self.packets_sent_by_server = Some(value);
self
}
pub fn rtt_micro_seconds(mut self, value: i64) -> Self {
self.rtt_micro_seconds = Some(value);
self
}
pub fn tcp_closed_connections(mut self, value: i64) -> Self {
self.tcp_closed_connections = Some(value);
self
}
pub fn tcp_delivered_ce(mut self, value: i64) -> Self {
self.tcp_delivered_ce = Some(value);
self
}
pub fn tcp_established_connections(mut self, value: i64) -> Self {
self.tcp_established_connections = Some(value);
self
}
pub fn tcp_probe0_count(mut self, value: i64) -> Self {
self.tcp_probe0_count = Some(value);
self
}
pub fn tcp_rcv_ooo_pack(mut self, value: i64) -> Self {
self.tcp_rcv_ooo_pack = Some(value);
self
}
pub fn tcp_recovery_count(mut self, value: i64) -> Self {
self.tcp_recovery_count = Some(value);
self
}
pub fn tcp_refusals(mut self, value: i64) -> Self {
self.tcp_refusals = Some(value);
self
}
pub fn tcp_reord_seen(mut self, value: i64) -> Self {
self.tcp_reord_seen = Some(value);
self
}
pub fn tcp_resets(mut self, value: i64) -> Self {
self.tcp_resets = Some(value);
self
}
pub fn tcp_retransmits(mut self, value: i64) -> Self {
self.tcp_retransmits = Some(value);
self
}
pub fn tcp_rto_count(mut self, value: i64) -> Self {
self.tcp_rto_count = Some(value);
self
}
pub fn tcp_timeouts(mut self, value: i64) -> Self {
self.tcp_timeouts = Some(value);
self
}
pub fn additional_properties(
mut self,
value: std::collections::BTreeMap<String, serde_json::Value>,
) -> Self {
self.additional_properties = value;
self
}
}
impl Default for SingleAggregatedConnectionResponseDataAttributes {
fn default() -> Self {
Self::new()
}
}
impl<'de> Deserialize<'de> for SingleAggregatedConnectionResponseDataAttributes {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: Deserializer<'de>,
{
struct SingleAggregatedConnectionResponseDataAttributesVisitor;
impl<'a> Visitor<'a> for SingleAggregatedConnectionResponseDataAttributesVisitor {
type Value = SingleAggregatedConnectionResponseDataAttributes;
fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
f.write_str("a mapping")
}
fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
where
M: MapAccess<'a>,
{
let mut bytes_sent_by_client: Option<i64> = None;
let mut bytes_sent_by_server: Option<i64> = None;
let mut group_bys: Option<std::collections::BTreeMap<String, Vec<String>>> = None;
let mut packets_sent_by_client: Option<i64> = None;
let mut packets_sent_by_server: Option<i64> = None;
let mut rtt_micro_seconds: Option<i64> = None;
let mut tcp_closed_connections: Option<i64> = None;
let mut tcp_delivered_ce: Option<i64> = None;
let mut tcp_established_connections: Option<i64> = None;
let mut tcp_probe0_count: Option<i64> = None;
let mut tcp_rcv_ooo_pack: Option<i64> = None;
let mut tcp_recovery_count: Option<i64> = None;
let mut tcp_refusals: Option<i64> = None;
let mut tcp_reord_seen: Option<i64> = None;
let mut tcp_resets: Option<i64> = None;
let mut tcp_retransmits: Option<i64> = None;
let mut tcp_rto_count: Option<i64> = None;
let mut tcp_timeouts: Option<i64> = None;
let mut additional_properties: std::collections::BTreeMap<
String,
serde_json::Value,
> = std::collections::BTreeMap::new();
let mut _unparsed = false;
while let Some((k, v)) = map.next_entry::<String, serde_json::Value>()? {
match k.as_str() {
"bytes_sent_by_client" => {
if v.is_null() {
continue;
}
bytes_sent_by_client =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"bytes_sent_by_server" => {
if v.is_null() {
continue;
}
bytes_sent_by_server =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"group_bys" => {
if v.is_null() {
continue;
}
group_bys = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"packets_sent_by_client" => {
if v.is_null() {
continue;
}
packets_sent_by_client =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"packets_sent_by_server" => {
if v.is_null() {
continue;
}
packets_sent_by_server =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"rtt_micro_seconds" => {
if v.is_null() {
continue;
}
rtt_micro_seconds =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"tcp_closed_connections" => {
if v.is_null() {
continue;
}
tcp_closed_connections =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"tcp_delivered_ce" => {
if v.is_null() {
continue;
}
tcp_delivered_ce =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"tcp_established_connections" => {
if v.is_null() {
continue;
}
tcp_established_connections =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"tcp_probe0_count" => {
if v.is_null() {
continue;
}
tcp_probe0_count =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"tcp_rcv_ooo_pack" => {
if v.is_null() {
continue;
}
tcp_rcv_ooo_pack =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"tcp_recovery_count" => {
if v.is_null() {
continue;
}
tcp_recovery_count =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"tcp_refusals" => {
if v.is_null() {
continue;
}
tcp_refusals =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"tcp_reord_seen" => {
if v.is_null() {
continue;
}
tcp_reord_seen =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"tcp_resets" => {
if v.is_null() {
continue;
}
tcp_resets = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"tcp_retransmits" => {
if v.is_null() {
continue;
}
tcp_retransmits =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"tcp_rto_count" => {
if v.is_null() {
continue;
}
tcp_rto_count =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"tcp_timeouts" => {
if v.is_null() {
continue;
}
tcp_timeouts =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
&_ => {
if let Ok(value) = serde_json::from_value(v.clone()) {
additional_properties.insert(k, value);
}
}
}
}
let content = SingleAggregatedConnectionResponseDataAttributes {
bytes_sent_by_client,
bytes_sent_by_server,
group_bys,
packets_sent_by_client,
packets_sent_by_server,
rtt_micro_seconds,
tcp_closed_connections,
tcp_delivered_ce,
tcp_established_connections,
tcp_probe0_count,
tcp_rcv_ooo_pack,
tcp_recovery_count,
tcp_refusals,
tcp_reord_seen,
tcp_resets,
tcp_retransmits,
tcp_rto_count,
tcp_timeouts,
additional_properties,
_unparsed,
};
Ok(content)
}
}
deserializer.deserialize_any(SingleAggregatedConnectionResponseDataAttributesVisitor)
}
}