Skip to content

Commit 3e12c94

Browse files
perf: Do not allocate for scope attributes that collide with reserved ones (#3548)
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com> Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
1 parent 874633d commit 3e12c94

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

  • opentelemetry-prometheus/src

opentelemetry-prometheus/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,10 @@ fn get_scope_labels(scope: &InstrumentationScope) -> Vec<LabelPair> {
422422

423423
let mut attr_labels = BTreeMap::<String, Vec<String>>::new();
424424
for kv in scope.attributes() {
425+
if matches!(kv.key.as_str(), "name" | "version" | "schema_url") {
426+
continue;
427+
}
428+
425429
let label_name = utils::sanitize_prom_kv(&format!("{SCOPE_ATTRIBUTE_PREFIX}{}", kv.key));
426430
if RESERVED_SCOPE_LABELS.contains(&label_name.as_str()) {
427431
continue;

0 commit comments

Comments
 (0)