Skip to content

Commit

Permalink
deleted_pending_pings_after_quota_hit -> deleted_pings_after_quota_hit
Browse files Browse the repository at this point in the history
  • Loading branch information
brizental committed Aug 3, 2020
1 parent 5e55a0b commit 980b308
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion glean-core/metrics.yaml
Expand Up @@ -410,7 +410,7 @@ glean.upload:
no_lint:
- COMMON_PREFIX

deleted_pending_pings_after_quota_hit:
deleted_pings_after_quota_hit:
type: counter
description: >
The number of pings deleted after the quota
Expand Down
6 changes: 3 additions & 3 deletions glean-core/src/internal_metrics.rs
Expand Up @@ -52,7 +52,7 @@ pub struct UploadMetrics {
pub ping_upload_failure: LabeledMetric<CounterMetric>,
pub discarded_exceeding_pings_size: MemoryDistributionMetric,
pub pending_pings_directory_size: MemoryDistributionMetric,
pub deleted_pending_pings_after_quota_hit: CounterMetric,
pub deleted_pings_after_quota_hit: CounterMetric,
}

impl UploadMetrics {
Expand Down Expand Up @@ -100,8 +100,8 @@ impl UploadMetrics {
MemoryUnit::Kilobyte,
),

deleted_pending_pings_after_quota_hit: CounterMetric::new(CommonMetricData {
name: "deleted_pending_pings_after_quota_hit".into(),
deleted_pings_after_quota_hit: CounterMetric::new(CommonMetricData {
name: "deleted_pings_after_quota_hit".into(),
category: "glean.upload".into(),
send_in_pings: vec!["metrics".into()],
lifetime: Lifetime::Ping,
Expand Down
6 changes: 5 additions & 1 deletion glean-core/src/upload/mod.rs
Expand Up @@ -316,14 +316,18 @@ impl PingUploadManager {
for (metadata, (document_id, path, body, headers)) in pending_pings {
pending_pings_directory_size += metadata.len() as usize;
if pending_pings_directory_size > quota {
log::warn!(
"Pending pings directory has reached the size quota of {} bytes, outstanding pings will be deleted.",
PENDING_PINGS_DIRECTORY_QUOTA
);
enqueueing = false;
}

if enqueueing {
self.enqueue_ping(glean, &document_id, &path, &body, headers);
} else if self.directory_manager.delete_file(&document_id) {
self.upload_metrics
.deleted_pending_pings_after_quota_hit
.deleted_pings_after_quota_hit
.add(glean, 1);
}
}
Expand Down

0 comments on commit 980b308

Please sign in to comment.