Skip to content

Commit 239e000

Browse files
committed
naming issues
1 parent 94cb3df commit 239e000

File tree

6 files changed

+19
-16
lines changed

6 files changed

+19
-16
lines changed

relay-cardinality/benches/redis_impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ struct NoopReporter;
4343
impl<'a> Reporter<'a> for NoopReporter {
4444
fn reject(&mut self, _limit_id: &'a CardinalityLimit, _entry_id: EntryId) {}
4545

46-
fn cardinality(&mut self, _limit: &'a CardinalityLimit, _report: CardinalityReport) {}
46+
fn report_cardinality(&mut self, _limit: &'a CardinalityLimit, _report: CardinalityReport) {}
4747
}
4848

4949
#[derive(Debug)]

relay-cardinality/src/limiter.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ pub trait Reporter<'a> {
5959
///
6060
/// For example, with a name scoped limit can be called once for every
6161
/// metric name matching the limit.
62-
fn cardinality(&mut self, limit: &'a CardinalityLimit, report: CardinalityReport);
62+
fn report_cardinality(&mut self, limit: &'a CardinalityLimit, report: CardinalityReport);
6363
}
6464

6565
/// Limiter responsible to enforce limits.
@@ -204,7 +204,7 @@ impl<'a> Reporter<'a> for DefaultReporter<'a> {
204204
}
205205

206206
#[inline(always)]
207-
fn cardinality(&mut self, limit: &'a CardinalityLimit, report: CardinalityReport) {
207+
fn report_cardinality(&mut self, limit: &'a CardinalityLimit, report: CardinalityReport) {
208208
if !limit.report {
209209
return;
210210
}
@@ -624,7 +624,7 @@ mod tests {
624624
I: IntoIterator<Item = Entry<'b>>,
625625
T: Reporter<'a>,
626626
{
627-
reporter.cardinality(
627+
reporter.report_cardinality(
628628
&limits[0],
629629
CardinalityReport {
630630
organization_id: Some(scoping.organization_id),
@@ -634,7 +634,7 @@ mod tests {
634634
},
635635
);
636636

637-
reporter.cardinality(
637+
reporter.report_cardinality(
638638
&limits[0],
639639
CardinalityReport {
640640
organization_id: Some(scoping.organization_id),
@@ -644,7 +644,7 @@ mod tests {
644644
},
645645
);
646646

647-
reporter.cardinality(
647+
reporter.report_cardinality(
648648
&limits[2],
649649
CardinalityReport {
650650
organization_id: Some(scoping.organization_id),

relay-cardinality/src/redis/limiter.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ impl Limiter for RedisSetLimiter {
163163
})?;
164164

165165
for result in results {
166-
reporter.cardinality(state.cardinality_limit(), result.to_report());
166+
reporter.report_cardinality(state.cardinality_limit(), result.to_report());
167167

168168
// This always acquires a write lock, but we only hit this
169169
// if we previously didn't satisfy the request from the cache,
@@ -306,7 +306,7 @@ mod tests {
306306
self.entries.insert(entry_id);
307307
}
308308

309-
fn cardinality(&mut self, limit: &'a CardinalityLimit, report: CardinalityReport) {
309+
fn report_cardinality(&mut self, limit: &'a CardinalityLimit, report: CardinalityReport) {
310310
let reports = self.reports.entry(limit.clone()).or_default();
311311
reports.push(report);
312312
reports.sort();

relay-server/src/metric_stats.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl MetricStats {
5858
}
5959

6060
/// Tracks the metric volume and outcome for the bucket.
61-
pub fn track(&self, scoping: Scoping, bucket: Bucket, outcome: Outcome) {
61+
pub fn track_metric(&self, scoping: Scoping, bucket: Bucket, outcome: Outcome) {
6262
if !self.is_enabled(scoping) {
6363
return;
6464
}
@@ -78,7 +78,7 @@ impl MetricStats {
7878
}
7979

8080
/// Tracks the cardinality of a metric.
81-
pub fn cardinality(
81+
pub fn track_cardinality(
8282
&self,
8383
scoping: Scoping,
8484
limit: &CardinalityLimit,
@@ -239,10 +239,10 @@ mod tests {
239239
let scoping = scoping();
240240
let mut bucket = Bucket::parse(b"rt@millisecond:57|d", UnixTimestamp::now()).unwrap();
241241

242-
ms.track(scoping, bucket.clone(), Outcome::Accepted);
242+
ms.track_metric(scoping, bucket.clone(), Outcome::Accepted);
243243

244244
bucket.metadata.merges = bucket.metadata.merges.saturating_add(41);
245-
ms.track(
245+
ms.track_metric(
246246
scoping,
247247
bucket,
248248
Outcome::RateLimited(Some(ReasonCode::new("foobar"))),
@@ -300,7 +300,7 @@ mod tests {
300300

301301
let scoping = scoping();
302302
let bucket = Bucket::parse(b"rt@millisecond:57|d", UnixTimestamp::now()).unwrap();
303-
ms.track(scoping, bucket, Outcome::Accepted);
303+
ms.track_metric(scoping, bucket, Outcome::Accepted);
304304

305305
drop(ms);
306306

@@ -314,7 +314,7 @@ mod tests {
314314
let scoping = scoping();
315315
let bucket =
316316
Bucket::parse(b"transactions/rt@millisecond:57|d", UnixTimestamp::now()).unwrap();
317-
ms.track(scoping, bucket, Outcome::Accepted);
317+
ms.track_metric(scoping, bucket, Outcome::Accepted);
318318

319319
drop(ms);
320320

relay-server/src/services/processor.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -2186,7 +2186,9 @@ impl EnvelopeProcessorService {
21862186

21872187
for (limit, reports) in limits.cardinality_reports() {
21882188
for report in reports {
2189-
self.inner.metric_stats.cardinality(scoping, limit, report);
2189+
self.inner
2190+
.metric_stats
2191+
.track_cardinality(scoping, limit, report);
21902192
}
21912193
}
21922194

relay-server/src/services/store.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,8 @@ impl StoreService {
402402
// This logic will be improved iterated on and change once we move serialization logic
403403
// back into the processor service.
404404
if has_success {
405-
self.metric_stats.track(scoping, bucket, Outcome::Accepted);
405+
self.metric_stats
406+
.track_metric(scoping, bucket, Outcome::Accepted);
406407
}
407408
}
408409

0 commit comments

Comments
 (0)