Skip to content

Commit

Permalink
chore: PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
wikiwong committed Aug 14, 2023
1 parent 3540045 commit d9c3312
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 50 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,11 @@ jobs:
profile: minimal
toolchain: stable
override: true

- name: Install Protoc
uses: arduino/setup-protoc@v2
with:
version: "3.12.4"

- name: Run cargo test
uses: actions-rs/cargo@v1
Expand Down
6 changes: 4 additions & 2 deletions rust/src/adapter/datadog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ use url::Url;

use crate::{Event, Log, Metric, TraceEvent};

pub use super::{
use super::{
datadog_formatter::{DatadogFormatter, Span, Trace},
Adapter, AdapterHandle, AdapterMetadata,
Adapter, AdapterHandle,
};

pub use super::AdapterMetadata;

#[derive(Debug, Clone)]
pub enum DatadogTraceType {
Web,
Expand Down
2 changes: 1 addition & 1 deletion rust/src/adapter/datadog_formatter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl Span {

pub fn add_allocation(&mut self, amount: u32) {
self.meta
.insert("allocations".to_string(), amount.to_string());
.insert("allocation".to_string(), amount.to_string());
}

pub fn add_tag(&mut self, tag: String) {
Expand Down
29 changes: 14 additions & 15 deletions rust/src/adapter/honeycomb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@ use std::time::Duration;
use crate::{Event, TraceEvent};
use anyhow::Result;

use super::{
otel_formatter::{opentelemetry, OtelFormatter},
Adapter, AdapterHandle,
};

pub use super::{
otel_formatter::{opentelemetry, Attribute, OtelFormatter, Value},
Adapter, AdapterHandle, AdapterMetadata,
otel_formatter::{Attribute, Value},
AdapterMetadata,
};

/// Config options for HoneycombAdapter
Expand Down Expand Up @@ -89,19 +94,13 @@ impl HoneycombAdapter {
}
}
Event::Alloc(a) => {
let mut span = OtelFormatter::new_span(
trace_id,
parent_id,
"allocation".to_string(),
a.ts,
a.ts,
);
OtelFormatter::add_attribute_i64_to_span(
&mut span,
"amount".to_string(),
a.amount.into(),
);
spans.push(span);
if let Some(span) = spans.last_mut() {
OtelFormatter::add_attribute_i64_to_span(
span,
"allocation".to_string(),
a.amount.into(),
);
}
}
_ => {}
}
Expand Down
29 changes: 14 additions & 15 deletions rust/src/adapter/lightstep.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@ use std::time::Duration;
use crate::{Event, TraceEvent};
use anyhow::Result;

use super::{
otel_formatter::{opentelemetry, OtelFormatter},
Adapter, AdapterHandle,
};

pub use super::{
otel_formatter::{opentelemetry, Attribute, OtelFormatter, Value},
Adapter, AdapterHandle, AdapterMetadata,
otel_formatter::{Attribute, Value},
AdapterMetadata,
};

/// Config options for LightstepAdapter
Expand Down Expand Up @@ -89,19 +94,13 @@ impl LightstepAdapter {
}
}
Event::Alloc(a) => {
let mut span = OtelFormatter::new_span(
trace_id,
parent_id,
"allocation".to_string(),
a.ts,
a.ts,
);
OtelFormatter::add_attribute_i64_to_span(
&mut span,
"amount".to_string(),
a.amount.into(),
);
spans.push(span);
if let Some(span) = spans.last_mut() {
OtelFormatter::add_attribute_i64_to_span(
span,
"allocation".to_string(),
a.amount.into(),
);
}
}
_ => {}
}
Expand Down
20 changes: 7 additions & 13 deletions rust/src/adapter/otelstdout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,13 @@ impl OtelStdoutAdapter {
}
}
Event::Alloc(a) => {
let mut span = OtelFormatter::new_span(
trace_id,
parent_id,
"allocation".to_string(),
a.ts,
a.ts,
);
OtelFormatter::add_attribute_i64_to_span(
&mut span,
"amount".to_string(),
a.amount.into(),
);
spans.push(span);
if let Some(span) = spans.last_mut() {
OtelFormatter::add_attribute_i64_to_span(
span,
"allocation".to_string(),
a.amount.into(),
);
}
}
_ => {}
}
Expand Down
6 changes: 3 additions & 3 deletions rust/src/adapter/zipkin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ impl ZipkinAdapter {
}
}
Event::Alloc(a) => {
let mut span = Span::new(trace_id, parent_id, "allocation".to_string(), a.ts, a.ts);
span.add_tag_i64("amount".to_string(), a.amount.into());
spans.push(span);
if let Some(span) = spans.last_mut() {
span.add_tag_i64("amount".to_string(), a.amount.into());
}
}
_ => {}
}
Expand Down

0 comments on commit d9c3312

Please sign in to comment.