-
Notifications
You must be signed in to change notification settings - Fork 219
Switch to new metric names in logs and OTLP export #1653
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
bd576f4
2b8df35
3f60655
58d4c38
f5b5176
fb4ca11
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ use std::thread::{self, JoinHandle}; | |
use std::time::Duration; | ||
|
||
use dashmap::DashMap; | ||
use defs::PROCESS_MEMORY_USAGE; | ||
use metrics::{Key, Metadata, Recorder}; | ||
use sysinfo::{MemoryRefreshKind, ProcessRefreshKind, ProcessesToUpdate, System, get_current_pid}; | ||
|
||
|
@@ -98,7 +99,7 @@ fn poll_process_metrics(sys: &mut System) { | |
if let Some(process) = sys.process(pid) { | ||
// update the metrics only when there is some change, otherwise it will be too spammy. | ||
if last_mem != process.memory() { | ||
metrics::gauge!("process.memory_usage").set(process.memory() as f64); | ||
metrics::gauge!(PROCESS_MEMORY_USAGE).set(process.memory() as f64); | ||
metrics::gauge!("system.available_memory").set(sys.available_memory() as f64); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not also for system memory now? |
||
} | ||
} | ||
|
@@ -412,13 +413,14 @@ mod tests { | |
mod test_otlp_metrics { | ||
use super::*; | ||
use crate::metrics::data::Metric; | ||
use crate::metrics::defs::{ATTR_HTTP_STATUS, ATTR_S3_REQUEST, S3_REQUEST_FAILURE}; | ||
use crate::metrics::defs::{ATTR_HTTP_STATUS, ATTR_S3_REQUEST, S3_REQUEST_ERRORS}; | ||
use crate::metrics_otel::{OtlpConfig, OtlpMetricsExporter}; | ||
use metrics::{Key, Unit}; | ||
use opentelemetry::metrics::MeterProvider as _; | ||
use opentelemetry_sdk::metrics::data::{AggregatedMetrics, MetricData, ResourceMetrics}; | ||
use opentelemetry_sdk::metrics::in_memory_exporter::InMemoryMetricExporter; | ||
use opentelemetry_sdk::metrics::{PeriodicReader, SdkMeterProvider}; | ||
use std::sync::Arc; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: No newline |
||
struct TestContext { | ||
exporter: InMemoryMetricExporter, | ||
provider: SdkMeterProvider, | ||
|
@@ -522,15 +524,15 @@ mod test_otlp_metrics { | |
let ctx = TestContext::new(); | ||
|
||
let key = Key::from_parts( | ||
"s3.request_failure", | ||
S3_REQUEST_ERRORS, | ||
vec![ | ||
metrics::Label::new(ATTR_S3_REQUEST, "GetObject"), | ||
metrics::Label::new(ATTR_HTTP_STATUS, "403"), | ||
metrics::Label::new("some-attribute", "some-value"), | ||
], | ||
); | ||
|
||
let config = defs::lookup_config(S3_REQUEST_FAILURE); | ||
let config = defs::lookup_config(S3_REQUEST_ERRORS); | ||
let counter = Metric::counter_otlp(&ctx.otlp_exporter, &key, &config); | ||
counter.as_counter().increment(1); | ||
|
||
|
@@ -542,7 +544,7 @@ mod test_otlp_metrics { | |
let scope_metrics: Vec<_> = resource_metrics.scope_metrics().collect(); | ||
let metric = scope_metrics[0] | ||
.metrics() | ||
.find(|m| m.name() == "s3.request_failure") | ||
.find(|m| m.name() == S3_REQUEST_ERRORS) | ||
.unwrap(); | ||
|
||
match metric.data() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already said that logged metrics aren't stable in docs, but I think it would be worth adding a note to the changelog to cover how we expect the metrics to change. (Any log line format change, metric name changes, etc..)