Skip to content

Commit 7a031ef

Browse files
committed
remove some attributes and refactor
1 parent 1285cd1 commit 7a031ef

4 files changed

Lines changed: 6 additions & 22 deletions

File tree

libdd-data-pipeline/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
1313
pub mod agent_info;
1414
mod health_metrics;
15-
pub mod otlp;
15+
pub(crate) mod otlp;
1616
mod pausable_worker;
1717
#[allow(missing_docs)]
1818
pub mod stats_exporter;

libdd-data-pipeline/src/trace_exporter/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,6 @@ impl TraceExporter {
544544
r.language = self.metadata.language.clone();
545545
r.tracer_version = self.metadata.tracer_version.clone();
546546
r.runtime_id = self.metadata.runtime_id.clone();
547-
r.git_commit_sha = self.metadata.git_commit_sha.clone();
548547
r
549548
};
550549
let request = map_traces_to_otlp(traces, &resource_info);

libdd-trace-utils/src/otlp_encoder/mapper.rs

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -89,18 +89,6 @@ fn build_resource(resource_info: &OtlpResourceInfo) -> Resource {
8989
value: AnyValue::StringValue(resource_info.runtime_id.clone()),
9090
});
9191
}
92-
if !resource_info.git_commit_sha.is_empty() {
93-
attributes.push(KeyValue {
94-
key: "git.commit.sha".to_string(),
95-
value: AnyValue::StringValue(resource_info.git_commit_sha.clone()),
96-
});
97-
}
98-
if !resource_info.git_repository_url.is_empty() {
99-
attributes.push(KeyValue {
100-
key: "git.repository_url".to_string(),
101-
value: AnyValue::StringValue(resource_info.git_repository_url.clone()),
102-
});
103-
}
10492
Resource { attributes }
10593
}
10694

@@ -211,7 +199,7 @@ fn map_span_events<T: TraceData>(events: &[SpanEvent<T>]) -> (Vec<OtlpSpanEvent>
211199
let attributes: Vec<KeyValue> = ev
212200
.attributes
213201
.iter()
214-
.filter_map(|(k, v)| event_attr_to_key_value(k, v))
202+
.map(|(k, v)| event_attr_to_key_value(k, v))
215203
.collect();
216204
otlp_events.push(OtlpSpanEvent {
217205
time_unix_nano: ev.time_unix_nano.to_string(),
@@ -227,7 +215,7 @@ fn map_span_events<T: TraceData>(events: &[SpanEvent<T>]) -> (Vec<OtlpSpanEvent>
227215
fn event_attr_to_key_value<T: TraceData>(
228216
k: &T::Text,
229217
v: &crate::span::v04::AttributeAnyValue<T>,
230-
) -> Option<KeyValue> {
218+
) -> KeyValue {
231219
use crate::span::v04::AttributeArrayValue;
232220
let value = match v {
233221
crate::span::v04::AttributeAnyValue::SingleValue(av) => match av {
@@ -249,10 +237,10 @@ fn event_attr_to_key_value<T: TraceData>(
249237
AnyValue::ArrayValue(crate::otlp_encoder::json_types::ArrayValue { values })
250238
}
251239
};
252-
Some(KeyValue {
240+
KeyValue {
253241
key: k.borrow().to_string(),
254242
value,
255-
})
243+
}
256244
}
257245

258246
/// Maps the explicit "span.kind" meta tag (set by OTEL-instrumented tracers) to an OTLP SpanKind.

libdd-trace-utils/src/otlp_encoder/mod.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ pub use mapper::map_traces_to_otlp;
1111
/// Tracer-level attributes used to populate the OTLP Resource on export.
1212
///
1313
/// These are the fields from the tracer's configuration that map to OTLP Resource attributes
14-
/// (service.name, deployment.environment.name, service.version, telemetry.sdk.*, runtime-id,
15-
/// git.commit.sha, git.repository_url).
14+
/// (service.name, deployment.environment.name, service.version, telemetry.sdk.*, runtime-id).
1615
/// Callers should build this from their own tracer metadata struct.
1716
#[derive(Clone, Debug, Default)]
1817
#[non_exhaustive]
@@ -23,6 +22,4 @@ pub struct OtlpResourceInfo {
2322
pub language: String,
2423
pub tracer_version: String,
2524
pub runtime_id: String,
26-
pub git_commit_sha: String,
27-
pub git_repository_url: String,
2825
}

0 commit comments

Comments
 (0)