Skip to content

Commit 6e4746f

Browse files
committed
Stop using store
1 parent fbfa046 commit 6e4746f

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

ddtelemetry/src/worker/mod.rs

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ struct TelemetryWorkerData {
120120
dependencies: store::Store<Dependency>,
121121
configurations: store::Store<data::Configuration>,
122122
integrations: store::Store<data::Integration>,
123-
endpoints: store::Store<data::Endpoint>,
123+
endpoints: Vec<data::Endpoint>,
124124
logs: store::QueueHashMap<LogIdentifier, Log>,
125125
metric_contexts: MetricContexts,
126126
metric_buckets: MetricBuckets,
@@ -217,8 +217,6 @@ pub struct TelemetryWorkerStats {
217217
pub configurations_unflushed: u32,
218218
pub integrations_stored: u32,
219219
pub integrations_unflushed: u32,
220-
pub endpoints_stored: u32,
221-
pub endpoints_unflushed: u32,
222220
pub logs: u32,
223221
pub metric_contexts: u32,
224222
pub metric_buckets: MetricBucketStats,
@@ -235,8 +233,6 @@ impl Add for TelemetryWorkerStats {
235233
configurations_unflushed: self.configurations_unflushed + rhs.configurations_unflushed,
236234
integrations_stored: self.integrations_stored + rhs.integrations_stored,
237235
integrations_unflushed: self.integrations_unflushed + rhs.integrations_unflushed,
238-
endpoints_stored: self.endpoints_stored + rhs.endpoints_stored,
239-
endpoints_unflushed: self.endpoints_unflushed + rhs.endpoints_unflushed,
240236
logs: self.logs + rhs.logs,
241237
metric_contexts: self.metric_contexts + rhs.metric_contexts,
242238
metric_buckets: MetricBucketStats {
@@ -416,7 +412,7 @@ impl TelemetryWorker {
416412
AddDependency(dep) => self.data.dependencies.insert(dep),
417413
AddIntegration(integration) => self.data.integrations.insert(integration),
418414
AddConfig(cfg) => self.data.configurations.insert(cfg),
419-
AddEndpoint(endpoint) => self.data.endpoints.insert(endpoint),
415+
AddEndpoint(endpoint) => self.data.endpoints.push(endpoint),
420416
AddLog((identifier, log)) => {
421417
let (l, new) = self.data.logs.get_mut_or_insert(identifier, log);
422418
if !new {
@@ -469,7 +465,6 @@ impl TelemetryWorker {
469465
self.data.dependencies.unflush_stored();
470466
self.data.integrations.unflush_stored();
471467
self.data.configurations.unflush_stored();
472-
self.data.endpoints.unflush_stored();
473468

474469
let app_started = data::Payload::AppStarted(self.build_app_started());
475470
match self.send_payload(&app_started).await {
@@ -562,19 +557,19 @@ impl TelemetryWorker {
562557
},
563558
))
564559
}
565-
if self.data.endpoints.flush_not_empty() {
560+
if !self.data.endpoints.is_empty() {
566561
payloads.push(data::Payload::AppEndpoints(
567562
data::AppEndpoints {
568563
is_first: true,
569564
endpoints: self
570565
.data
571566
.endpoints
572-
.unflushed()
567+
.iter()
573568
.map(|e| e.to_json_value().unwrap_or_default())
574569
.filter(|e| e.is_object())
575570
.collect(),
576571
},
577-
))
572+
));
578573
}
579574
payloads
580575
}
@@ -678,7 +673,7 @@ impl TelemetryWorker {
678673
.data
679674
.configurations
680675
.removed_flushed(p.configuration.len()),
681-
AppEndpoints(p) => self.data.endpoints.removed_flushed(p.endpoints.len()),
676+
AppEndpoints(p) => self.data.endpoints.clear(),
682677
MessageBatch(batch) => {
683678
for p in batch {
684679
self.payload_sent_success(p);
@@ -828,8 +823,6 @@ impl TelemetryWorker {
828823
configurations_unflushed: self.data.configurations.len_unflushed() as u32,
829824
integrations_stored: self.data.integrations.len_stored() as u32,
830825
integrations_unflushed: self.data.integrations.len_unflushed() as u32,
831-
endpoints_stored: self.data.endpoints.len_stored() as u32,
832-
endpoints_unflushed: self.data.endpoints.len_unflushed() as u32,
833826
logs: self.data.logs.len() as u32,
834827
metric_contexts: self.data.metric_contexts.lock().len() as u32,
835828
metric_buckets: self.data.metric_buckets.stats(),
@@ -1043,7 +1036,7 @@ pub struct TelemetryWorkerBuilder {
10431036
pub dependencies: store::Store<data::Dependency>,
10441037
pub integrations: store::Store<data::Integration>,
10451038
pub configurations: store::Store<data::Configuration>,
1046-
pub endpoints: store::Store<data::Endpoint>,
1039+
pub endpoints: Vec<data::Endpoint>,
10471040
pub native_deps: bool,
10481041
pub rust_shared_lib_deps: bool,
10491042
pub config: Config,
@@ -1094,7 +1087,7 @@ impl TelemetryWorkerBuilder {
10941087
dependencies: store::Store::new(MAX_ITEMS),
10951088
integrations: store::Store::new(MAX_ITEMS),
10961089
configurations: store::Store::new(MAX_ITEMS),
1097-
endpoints: store::Store::new(MAX_ITEMS),
1090+
endpoints: Vec::new(),
10981091
native_deps: true,
10991092
rust_shared_lib_deps: false,
11001093
config: Config::default(),

0 commit comments

Comments
 (0)