Skip to content

Commit

Permalink
chore: bump semantic convention 1.30.0 (#2572)
Browse files Browse the repository at this point in the history
  • Loading branch information
lalitb authored Jan 28, 2025
1 parent 3ec4c18 commit 45f4d7c
Show file tree
Hide file tree
Showing 7 changed files with 1,388 additions and 331 deletions.
10 changes: 6 additions & 4 deletions opentelemetry-appender-log/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ use opentelemetry::{
InstrumentationScope, Key,
};
#[cfg(feature = "experimental_metadata_attributes")]
use opentelemetry_semantic_conventions::attribute::{CODE_FILEPATH, CODE_LINENO, CODE_NAMESPACE};
use opentelemetry_semantic_conventions::attribute::{
CODE_FILEPATH, CODE_LINE_NUMBER, CODE_NAMESPACE,
};

pub struct OpenTelemetryLogBridge<P, L>
where
Expand Down Expand Up @@ -158,7 +160,7 @@ where
}

if let Some(line_no) = record.line() {
log_record.add_attribute(Key::new(CODE_LINENO), AnyValue::from(line_no));
log_record.add_attribute(Key::new(CODE_LINE_NUMBER), AnyValue::from(line_no));
}

if let Some(module) = record.module_path() {
Expand Down Expand Up @@ -1171,7 +1173,7 @@ mod tests {
#[test]
fn logbridge_code_attributes() {
use opentelemetry_semantic_conventions::attribute::{
CODE_FILEPATH, CODE_LINENO, CODE_NAMESPACE,
CODE_FILEPATH, CODE_LINE_NUMBER, CODE_NAMESPACE,
};

let exporter = InMemoryLogExporter::default();
Expand Down Expand Up @@ -1212,7 +1214,7 @@ mod tests {
Some(AnyValue::String(StringValue::from("service"))),
get(CODE_NAMESPACE)
);
assert_eq!(Some(AnyValue::Int(101)), get(CODE_LINENO));
assert_eq!(Some(AnyValue::Int(101)), get(CODE_LINE_NUMBER));
}

#[test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
CRATE_DIR="${SCRIPT_DIR}/../"

# freeze the spec version and generator version to make generation reproducible
SPEC_VERSION=1.29.0
WEAVER_VERSION=v0.11.0
SPEC_VERSION=1.30.0
WEAVER_VERSION=v0.12.0

cd "$CRATE_DIR"

Expand Down Expand Up @@ -48,7 +48,14 @@ expression='
s/\[([a-zA-Z0-9\.\s]+,[a-zA-Z0-9\.\s]+)\]/\\[\1\\]/g
s/\\\[([^\]]+)\]\(([^)]+)\)/[\1](\2)/g
'

# TODO - remove this with semconv 1.31.0. Refer: https://github.com/open-telemetry/semantic-conventions/pull/1827
# Fix broken and malformed K8s JobSpec link
link_fix_expression='s/\\\[K8s JobSpec\\\]\(https:\/\/kubernetes\.io\/docs\/reference\/generated\/kubernetes-api\/v1\.30\/#jobspec-v1-batch\./[K8s JobSpec](https:\/\/kubernetes\.io\/docs\/reference\/generated\/kubernetes-api\/v1\.30\/#jobspec-v1-batch)./g'

"${SED[@]}" -E "${expression}" src/metric.rs
"${SED[@]}" -E "${expression}" src/attribute.rs
"${SED[@]}" -E "${link_fix_expression}" src/metric.rs


cargo fmt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ comment_formats:
default_comment_format: rust

params:
schema_url: "https://opentelemetry.io/schemas/1.29.0"
schema_url: "https://opentelemetry.io/schemas/1.30.0"
exclude_root_namespace: []
excluded_attributes: ["messaging.client_id"]

Expand Down
Loading

0 comments on commit 45f4d7c

Please sign in to comment.