Skip to content

Commit 2671326

Browse files
committed
feat(sidecar): remove unused AppInstance and EnqueuedTelemetryData and refacto telemetry
Signed-off-by: Alexandre Rulleau <[email protected]>
1 parent 2e92f4c commit 2671326

File tree

7 files changed

+347
-584
lines changed

7 files changed

+347
-584
lines changed

datadog-sidecar/src/service/runtime_info.rs

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,19 @@
11
// Copyright 2021-Present Datadog, Inc. https://www.datadoghq.com/
22
// SPDX-License-Identifier: Apache-2.0
33

4-
use crate::service::{
5-
remote_configs::RemoteConfigsGuard, telemetry::AppInstance, InstanceId, QueueId,
6-
};
4+
use crate::service::{remote_configs::RemoteConfigsGuard, InstanceId, QueueId};
75
use datadog_live_debugger::sender::{generate_tags, PayloadSender};
86
use ddcommon::{tag::Tag, MutexExt};
9-
use futures::future::{self, join_all, Shared};
10-
use manual_future::ManualFuture;
117
use simd_json::prelude::ArrayTrait;
128
use std::collections::HashMap;
139
use std::fmt::Display;
1410
use std::sync::{Arc, Mutex, MutexGuard};
1511
use tracing::{debug, info};
1612

17-
type AppMap = HashMap<(String, String), Shared<ManualFuture<Option<AppInstance>>>>;
18-
1913
/// `RuntimeInfo` is a struct that contains information about a runtime.
2014
/// It contains a map of apps and a map of app or actions.
2115
#[derive(Clone, Default)]
2216
pub(crate) struct RuntimeInfo {
23-
pub(crate) apps: Arc<Mutex<AppMap>>,
2417
applications: Arc<Mutex<HashMap<QueueId, ActiveApplication>>>,
2518
pub(crate) instance_id: InstanceId,
2619
}
@@ -53,42 +46,12 @@ impl RuntimeInfo {
5346
self.instance_id.runtime_id, self.instance_id.session_id
5447
);
5548

56-
let instance_futures: Vec<_> = self
57-
.lock_apps()
58-
.drain()
59-
.map(|(_, instance)| instance)
60-
.collect();
61-
let instances: Vec<_> = join_all(instance_futures).await;
62-
let instances_shutting_down: Vec<_> = instances
63-
.into_iter()
64-
.map(|instance| {
65-
tokio::spawn(async move {
66-
if let Some(instance) = instance {
67-
drop(instance.telemetry); // start shutdown
68-
instance.telemetry_worker_shutdown.await;
69-
}
70-
})
71-
})
72-
.collect();
73-
future::join_all(instances_shutting_down).await;
74-
7549
debug!(
7650
"Successfully shut down runtime_id {} for session {}",
7751
self.instance_id.runtime_id, self.instance_id.session_id
7852
);
7953
}
8054

81-
// TODO: APMSP-1076 Investigate if we can encapsulate the stats computation functionality so we
82-
// don't have to expose apps publicly.
83-
/// Locks the apps map and returns a mutable reference to it.
84-
///
85-
/// # Returns
86-
///
87-
/// * `<MutexGuard<AppMap>>` - A mutable reference to the apps map.
88-
pub(crate) fn lock_apps(&self) -> MutexGuard<AppMap> {
89-
self.apps.lock_or_panic()
90-
}
91-
9255
/// Locks the applications map and returns a mutable reference to it.
9356
///
9457
/// # Returns

datadog-sidecar/src/service/sidecar_interface.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
#![allow(clippy::too_many_arguments)]
55

66
use crate::service::{
7-
InstanceId, QueueId, RequestIdentification, RequestIdentifier,
8-
SerializedTracerHeaderTags, SessionConfig, SidecarAction,
7+
InstanceId, QueueId, RequestIdentification, RequestIdentifier, SerializedTracerHeaderTags,
8+
SessionConfig, SidecarAction,
99
};
1010
use anyhow::Result;
1111
use datadog_ipc::platform::ShmHandle;

0 commit comments

Comments
 (0)