|
1 | 1 | // Copyright 2021-Present Datadog, Inc. https://www.datadoghq.com/ |
2 | 2 | // SPDX-License-Identifier: Apache-2.0 |
3 | 3 |
|
4 | | -use crate::service::{ |
5 | | - remote_configs::RemoteConfigsGuard, telemetry::AppInstance, InstanceId, QueueId, |
6 | | -}; |
| 4 | +use crate::service::{remote_configs::RemoteConfigsGuard, InstanceId, QueueId}; |
7 | 5 | use datadog_live_debugger::sender::{generate_tags, PayloadSender}; |
8 | 6 | use ddcommon::{tag::Tag, MutexExt}; |
9 | | -use futures::future::{self, join_all, Shared}; |
10 | | -use manual_future::ManualFuture; |
11 | 7 | use simd_json::prelude::ArrayTrait; |
12 | 8 | use std::collections::HashMap; |
13 | 9 | use std::fmt::Display; |
14 | 10 | use std::sync::{Arc, Mutex, MutexGuard}; |
15 | 11 | use tracing::{debug, info}; |
16 | 12 |
|
17 | | -type AppMap = HashMap<(String, String), Shared<ManualFuture<Option<AppInstance>>>>; |
18 | | - |
19 | 13 | /// `RuntimeInfo` is a struct that contains information about a runtime. |
20 | 14 | /// It contains a map of apps and a map of app or actions. |
21 | 15 | #[derive(Clone, Default)] |
22 | 16 | pub(crate) struct RuntimeInfo { |
23 | | - pub(crate) apps: Arc<Mutex<AppMap>>, |
24 | 17 | applications: Arc<Mutex<HashMap<QueueId, ActiveApplication>>>, |
25 | 18 | pub(crate) instance_id: InstanceId, |
26 | 19 | } |
@@ -53,42 +46,12 @@ impl RuntimeInfo { |
53 | 46 | self.instance_id.runtime_id, self.instance_id.session_id |
54 | 47 | ); |
55 | 48 |
|
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 | | - |
75 | 49 | debug!( |
76 | 50 | "Successfully shut down runtime_id {} for session {}", |
77 | 51 | self.instance_id.runtime_id, self.instance_id.session_id |
78 | 52 | ); |
79 | 53 | } |
80 | 54 |
|
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 | | - |
92 | 55 | /// Locks the applications map and returns a mutable reference to it. |
93 | 56 | /// |
94 | 57 | /// # Returns |
|
0 commit comments