Skip to content
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

ref(metrics): Add custom and more builtin units [INGEST-939] #1217

Merged
merged 8 commits into from
Apr 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@
- Remove unused item types. ([#1211](https://github.com/getsentry/relay/pull/1211))
- Pin click dependency in requirements-dev.txt. ([#1214](https://github.com/getsentry/relay/pull/1214))
- Use fully qualified metric resource identifiers (MRI) for metrics ingestion. For example, the sessions duration is now called `d:sessions/duration@s`. ([#1215](https://github.com/getsentry/relay/pull/1215))
- Introduce metric units for rates and information, add support for custom user-declared units, and rename duration units to self-explanatory identifiers such as `second`. ([#1217](https://github.com/getsentry/relay/pull/1217))

## 22.3.0

8 changes: 4 additions & 4 deletions relay-metrics/src/aggregation.rs
Original file line number Diff line number Diff line change
@@ -616,7 +616,7 @@ pub struct ParseBucketError(#[cause] serde_json::Error);
/// "timestamp": 1615889440,
/// "name": "endpoint.response_time",
/// "type": "d",
/// "unit": "ms",
/// "unit": "millisecond",
/// "value": [36, 49, 57, 68],
/// "tags": {
/// "route": "user_index"
@@ -1365,7 +1365,7 @@ mod tests {

use super::*;

use crate::{DurationPrecision, MetricUnit};
use crate::{DurationUnit, MetricUnit};

struct BucketCountInquiry;

@@ -1520,7 +1520,7 @@ mod tests {
let json = r#"[
{
"name": "endpoint.response_time",
"unit": "ms",
"unit": "millisecond",
"value": [36, 49, 57, 68],
"type": "d",
"timestamp": 1615889440,
@@ -1877,7 +1877,7 @@ mod tests {
let metric1 = some_metric();

let mut metric2 = metric1.clone();
metric2.unit = MetricUnit::Duration(DurationPrecision::Second);
metric2.unit = MetricUnit::Duration(DurationUnit::Second);

// It's OK to have same metric with different units:
aggregator.insert(project_key, metric1).unwrap();
44 changes: 16 additions & 28 deletions relay-metrics/src/lib.rs
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
//! looks like this:
//!
//! ```text
//! endpoint.response_time@ms:57|d|#route:user_index
//! endpoint.response_time@millisecond:57|d|#route:user_index
//! endpoint.hits:1|c|#route:user_index
//! ```
//!
@@ -26,7 +26,7 @@
//! ```text
//! {}
//! {"type": "metrics", "timestamp": 1615889440, ...}
//! endpoint.response_time@ms:57|d|#route:user_index
//! endpoint.response_time@millisecond:57|d|#route:user_index
//! ...
//! ```
//!
@@ -48,7 +48,7 @@
//! [
//! {
//! "name": "endpoint.response_time",
//! "unit": "ms",
//! "unit": "millisecond",
//! "value": [36, 49, 57, 68],
//! "type": "d",
//! "timestamp": 1615889440,
@@ -71,34 +71,22 @@
//! # Ingestion
//!
//! Processing Relays write aggregate buckets into the ingestion Kafka stream. The schema is similar
//! to the aggregation payload, with the addition of scoping information:
//! to the aggregation payload, with the addition of scoping information. Each bucket is sent in a
//! separate message:
//!
//! ```json
//! [
//! {
//! "org_id": 1,
//! "project_id": 42,
//! "name": "endpoint.response_time",
//! "unit": "ms",
//! "value": [36, 49, 57, 68],
//! "type": "d",
//! "timestamp": 1615889440,
//! "tags": {
//! "route": "user_index"
//! }
//! },
//! {
//! "org_id": 1,
//! "project_id": 42,
//! "name": "endpoint.hits",
//! "value": 4,
//! "type": "c",
//! "timestamp": 1615889440,
//! "tags": {
//! "route": "user_index"
//! }
//! {
//! "org_id": 1,
//! "project_id": 42,
//! "name": "endpoint.response_time",
//! "unit": "millisecond",
//! "value": [36, 49, 57, 68],
//! "type": "d",
//! "timestamp": 1615889440,
//! "tags": {
//! "route": "user_index"
//! }
//! ]
//! }
//! ```
#![warn(missing_docs)]
#![doc(
Loading