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

fix(new_relic sink): Multiple fixes related to metrics #18151

Merged
merged 26 commits into from
Sep 12, 2023
Merged
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
05025b1
Convert tags into attributes.
asllop Sep 15, 2022
4cdef4e
Merge branch 'vectordotdev:master' into master
asllop Sep 15, 2022
087d4bf
Decompose metric into parts to reuse tags instead of cloning.
asllop Sep 16, 2022
2dd2668
Remove unnecessary blocks.
asllop Sep 16, 2022
6020efb
Set metric type.
asllop Sep 22, 2022
9e7d57c
Fix field name typo.
asllop Sep 22, 2022
567f236
Remove unnecessary brackets.
asllop Sep 23, 2022
c3b4784
Merge branch 'master' into master
asllop Sep 23, 2022
b755769
Cargo fmt.
asllop Oct 20, 2022
67943c9
Merge branch 'master' of https://github.com/asllop/vector
asllop Oct 20, 2022
48f16d8
Update src/sinks/new_relic/model.rs
asllop Nov 3, 2022
af14a7d
Update src/sinks/new_relic/model.rs
asllop Nov 3, 2022
137943c
Fix typo.
asllop Nov 3, 2022
2a2282c
Add tests for newly supported metrics.
asllop Nov 3, 2022
b72faed
Simplify metric type cases.
asllop Nov 3, 2022
84a8d61
Merge branch 'vectordotdev:master' into master
asllop Nov 4, 2022
41b41ab
Cargo fmt.
asllop Dec 12, 2022
f247c95
Merge remote-tracking branch 'origin/master' into asllop/master
jszwedko Aug 3, 2023
62addd3
Update to handle new tag model
jszwedko Aug 3, 2023
1f2bc83
PR feedback
jszwedko Aug 4, 2023
f256b33
refactor
dsmith3197 Aug 11, 2023
0ecfa81
add dropped event metrics
dsmith3197 Aug 22, 2023
c3769db
track unsupported metric types as well
dsmith3197 Aug 22, 2023
494b12e
merge master
dsmith3197 Aug 22, 2023
c11c958
feedback
dsmith3197 Sep 11, 2023
4e4943f
more feedback
dsmith3197 Sep 11, 2023
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
Prev Previous commit
Next Next commit
Cargo fmt.
  • Loading branch information
asllop committed Dec 12, 2022
commit 41b41ab95caaa36368aadb8e5f994c865f0b7be0
24 changes: 14 additions & 10 deletions src/sinks/new_relic/model.rs
Original file line number Diff line number Diff line change
@@ -44,10 +44,11 @@ impl TryFrom<Vec<Event>> for MetricsApiModel {
// Generate Value::Object() from BTreeMap<String, String>
let (series, data, _) = metric.into_parts();
let attr = series.tags.map(|tags| {
Value::from(tags
.into_iter()
.map(|(key, value)| (key, Value::from(value)))
.collect::<BTreeMap<_, _>>())
Value::from(
tags.into_iter()
.map(|(key, value)| (key, Value::from(value)))
.collect::<BTreeMap<_, _>>(),
)
});

// We only handle gauge and counter metrics
@@ -64,17 +65,20 @@ impl TryFrom<Vec<Event>> for MetricsApiModel {
);
metric_data.insert(
"timestamp".to_owned(),
Value::from(data
.time
.timestamp
.unwrap_or_else(|| DateTime::<Utc>::from(SystemTime::now()))
.timestamp()),
Value::from(
data.time
.timestamp
.unwrap_or_else(|| DateTime::<Utc>::from(SystemTime::now()))
.timestamp(),
),
);
if let Some(attr) = attr {
metric_data.insert("attributes".to_owned(), attr);
}
// Set type and type related attributes
if let (MetricValue::Counter { .. }, MetricKind::Incremental) = (data.value, data.kind) {
if let (MetricValue::Counter { .. }, MetricKind::Incremental) =
(data.value, data.kind)
{
if let Some(interval_ms) = data.time.interval_ms {
metric_data.insert(
"interval.ms".to_owned(),
2 changes: 1 addition & 1 deletion src/sinks/new_relic/tests.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{collections::HashMap, convert::TryFrom, time::SystemTime, num::NonZeroU32};
use std::{collections::HashMap, convert::TryFrom, num::NonZeroU32, time::SystemTime};

use chrono::{DateTime, Utc};
use futures::{future::ready, stream};