Skip to content

Commit 8d82760

Browse files
Otel proto (#1605)
* update git branch from fork to opentelemetry-rust for otel-proto crate * update Cargo.lock * skip StringValueStrindex in any_value as it is under development
1 parent f761b2d commit 8d82760

4 files changed

Lines changed: 30 additions & 11 deletions

File tree

Cargo.lock

Lines changed: 10 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ tokio-util = { version = "0.7" }
9797
# ] }
9898

9999
# add custom branch with fix until it gets merged
100-
opentelemetry-proto = { git = "https://github.com/parmesant/opentelemetry-rust/", rev = "45fb828769e6ade96d56ca1f5fa14cf0986a5341", features = [
100+
opentelemetry-proto = { git = "https://github.com/open-telemetry/opentelemetry-rust/", branch = "main", features = [
101101
"gen-tonic",
102102
"with-serde",
103103
"logs",

src/otel/otel_utils.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ pub fn collect_json_from_value(key: &String, value: OtelValue) -> Map<String, Va
6666
Value::String(String::from_utf8_lossy(&bytes_val).to_string()),
6767
);
6868
}
69+
OtelValue::StringValueStrindex(str_index) => {
70+
tracing::warn!(
71+
"StringValueStrindex is not supported in key-value lists, index: {str_index}"
72+
);
73+
}
6974
}
7075

7176
value_json
@@ -102,6 +107,11 @@ fn collect_json_from_array_value(array_value: &ArrayValue) -> Value {
102107
let nested_json = collect_json_from_key_value_list(kv_list.clone());
103108
json_array.push(Value::Object(nested_json));
104109
}
110+
OtelValue::StringValueStrindex(str_index) => {
111+
tracing::warn!(
112+
"StringValueStrindex is not supported in array values, index: {str_index}"
113+
);
114+
}
105115
}
106116
}
107117
}

src/otel/traces.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ mod tests {
463463
),
464464
),
465465
}),
466+
key_strindex: 0,
466467
},
467468
KeyValue {
468469
key: "http.method".to_string(),
@@ -473,6 +474,7 @@ mod tests {
473474
),
474475
),
475476
}),
477+
key_strindex: 0,
476478
},
477479
]
478480
}
@@ -871,12 +873,13 @@ mod tests {
871873
let traces_data = TracesData {
872874
resource_spans: vec![ResourceSpans {
873875
resource: Some(Resource {
874-
attributes: vec![KeyValue {
875-
key: "deployment.environment".to_string(),
876-
value: Some(AnyValue {
877-
value: Some(opentelemetry_proto::tonic::common::v1::any_value::Value::StringValue("production".to_string())),
878-
}),
879-
}],
876+
attributes: vec![KeyValue {
877+
key: "deployment.environment".to_string(),
878+
value: Some(AnyValue {
879+
value: Some(opentelemetry_proto::tonic::common::v1::any_value::Value::StringValue("production".to_string())),
880+
}),
881+
key_strindex: 0,
882+
}],
880883
dropped_attributes_count: 0,
881884
entity_refs: vec![
882885
EntityRef{

0 commit comments

Comments
 (0)