Skip to content
This repository has been archived by the owner on Jun 8, 2024. It is now read-only.

Commit

Permalink
tweak internal metrics a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
KodrAus committed Mar 14, 2024
1 parent 9feb8fe commit 1e4227d
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 32 deletions.
16 changes: 8 additions & 8 deletions batcher/src/internal_metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::sync::atomic::{AtomicUsize, Ordering};
#[derive(Default)]
pub(crate) struct InternalMetrics {
pub(crate) queue_overflow: Counter,
pub(crate) queue_batch: Counter,
pub(crate) queue_batch_processed: Counter,
pub(crate) queue_batch_failed: Counter,
pub(crate) queue_batch_panicked: Counter,
pub(crate) queue_batch_retry: Counter,
Expand Down Expand Up @@ -34,35 +34,35 @@ impl InternalMetrics {
pub fn sample(&self) -> impl Iterator<Item = emit::metrics::Metric<'static>> + 'static {
let InternalMetrics {
queue_overflow,
queue_batch,
queue_batch_processed,
queue_batch_failed,
queue_batch_panicked,
queue_batch_retry,
} = self;

[
emit::metrics::Metric::new(
"queue_overflow",
stringify!(queue_overflow),
emit::well_known::METRIC_AGG_COUNT,
queue_overflow.sample(),
),
emit::metrics::Metric::new(
"queue_batch",
stringify!(queue_batch_processed),
emit::well_known::METRIC_AGG_COUNT,
queue_batch.sample(),
queue_batch_processed.sample(),
),
emit::metrics::Metric::new(
"queue_batch_failed",
stringify!(queue_batch_failed),
emit::well_known::METRIC_AGG_COUNT,
queue_batch_failed.sample(),
),
emit::metrics::Metric::new(
"queue_batch_panicked",
stringify!(queue_batch_panicked),
emit::well_known::METRIC_AGG_COUNT,
queue_batch_panicked.sample(),
),
emit::metrics::Metric::new(
"queue_batch_retry",
stringify!(queue_batch_retry),
emit::well_known::METRIC_AGG_COUNT,
queue_batch_retry.sample(),
),
Expand Down
2 changes: 1 addition & 1 deletion batcher/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ impl<T: Channel> Receiver<T> {
{
Ok(on_batch) => match CatchUnwind(AssertUnwindSafe(on_batch)).await {
Ok(Ok(())) => {
self.shared.metrics.queue_batch.increment();
self.shared.metrics.queue_batch_processed.increment();
}
Ok(Err(BatchError { retryable })) => {
self.shared.metrics.queue_batch_failed.increment();
Expand Down
14 changes: 1 addition & 13 deletions core/src/path.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use core::fmt;

use crate::{
str::{Str, ToStr},
str::Str,
value::{FromValue, ToValue, Value},
};

Expand All @@ -20,18 +20,6 @@ impl<'a> From<Str<'a>> for Path<'a> {
}
}

impl<'a> From<Path<'a>> for Str<'a> {
fn from(value: Path<'a>) -> Self {
value.0
}
}

impl<'a> ToStr for Path<'a> {
fn to_str(&self) -> Str {
self.0.by_ref()
}
}

impl<'a> ToValue for Path<'a> {
fn to_value(&self) -> Value {
self.0.to_value()
Expand Down
14 changes: 7 additions & 7 deletions targets/file/src/internal_metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,37 +46,37 @@ impl InternalMetrics {

[
emit::metrics::Metric::new(
"file_set_read_failed",
stringify!(file_set_read_failed),
emit::well_known::METRIC_AGG_COUNT,
file_set_read_failed.sample(),
),
emit::metrics::Metric::new(
"file_open_failed",
stringify!(file_open_failed),
emit::well_known::METRIC_AGG_COUNT,
file_open_failed.sample(),
),
emit::metrics::Metric::new(
"file_create",
stringify!(file_create),
emit::well_known::METRIC_AGG_COUNT,
file_create.sample(),
),
emit::metrics::Metric::new(
"file_create_failed",
stringify!(file_create_failed),
emit::well_known::METRIC_AGG_COUNT,
file_create_failed.sample(),
),
emit::metrics::Metric::new(
"file_write_failed",
stringify!(file_write_failed),
emit::well_known::METRIC_AGG_COUNT,
file_write_failed.sample(),
),
emit::metrics::Metric::new(
"file_delete",
stringify!(file_delete),
emit::well_known::METRIC_AGG_COUNT,
file_delete.sample(),
),
emit::metrics::Metric::new(
"file_delete_failed",
stringify!(file_delete_failed),
emit::well_known::METRIC_AGG_COUNT,
file_delete_failed.sample(),
),
Expand Down
6 changes: 3 additions & 3 deletions targets/otlp/src/internal_metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ impl Counter {
impl InternalMetrics {
pub fn sample(&self) -> impl Iterator<Item = emit::metrics::Metric<'static>> + 'static {
let InternalMetrics {
otlp_event_discarded: otlp_event_discard,
otlp_event_discarded,
} = self;

[emit::metrics::Metric::new(
"otlp_event_discard",
stringify!(otlp_event_discarded),
emit::well_known::METRIC_AGG_COUNT,
otlp_event_discard.sample(),
otlp_event_discarded.sample(),
)]
.into_iter()
}
Expand Down

0 comments on commit 1e4227d

Please sign in to comment.