diff --git a/CHANGELOG.md b/CHANGELOG.md index 18635a4..4a2090b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +- Upgrade `opentelemetry` dependencies to `v0.25`. + ## [0.34.0] - 2024-07-20 - Upgrade `opentelemetry` and `opentelemetry_sdk` to `v0.24`. diff --git a/Cargo.toml b/Cargo.toml index 5beec70..240a462 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,10 +45,10 @@ flate2 = "1" http = "1" once_cell = "1" futures-util = { version = "0.3", default-features = false, optional = true } -opentelemetry = "0.24" -opentelemetry_sdk = "0.24" -opentelemetry-http = "0.13" -opentelemetry-semantic-conventions = "0.16" +opentelemetry = "0.25" +opentelemetry_sdk = "0.25" +opentelemetry-http = "0.25" +opentelemetry-semantic-conventions = "0.25" reqwest = { version = "0.12", default-features = false, features = ["blocking"], optional = true } serde = { version = "1", features = ["derive"] } serde_json = "1" @@ -57,14 +57,14 @@ thiserror = "1" sysinfo = { version = "0.30", optional = true } [dev-dependencies] -async-std = { version = "1.12.0", features = ["attributes"] } +async-std = { version = "1.13.0", features = ["attributes"] } doc-comment = "0.3.3" env_logger = "0.11.3" insta = "1.39.0" log = { version = "0.4", features = ["kv", "kv_sval"] } -opentelemetry_sdk = { version = "0.24", features = ["rt-async-std", "rt-tokio", "rt-tokio-current-thread", "logs_level_enabled"] } -opentelemetry-http = { version = "0.13", features = ["reqwest"] } -opentelemetry-appender-log = { version = "0.5", features = ["with-serde"] } +opentelemetry_sdk = { version = "0.25", features = ["rt-async-std", "rt-tokio", "rt-tokio-current-thread", "logs_level_enabled"] } +opentelemetry-http = { version = "0.25", features = ["reqwest"] } +opentelemetry-appender-log = { version = "0.25", features = ["with-serde"] } rand = "0.8.5" regex = "1.10.5" reqwest = { version = "0.12", features = ["blocking"] } diff --git a/examples/attributes.rs b/examples/attributes.rs index bc0f7b9..8066315 100644 --- a/examples/attributes.rs +++ b/examples/attributes.rs @@ -79,7 +79,7 @@ fn main() { KeyValue::new(semcov::trace::SERVER_PORT, 8080), KeyValue::new(semcov::trace::NETWORK_PEER_ADDRESS, "10.1.2.4"), KeyValue::new(semcov::trace::HTTP_RESPONSE_STATUS_CODE, 200), - KeyValue::new(semcov::trace::ENDUSER_ID, "marry"), + KeyValue::new(semcov::attribute::USER_ID, "marry"), ]) .start(&client_tracer); { @@ -103,7 +103,7 @@ fn main() { KeyValue::new(semcov::trace::CLIENT_ADDRESS, "10.1.2.3"), KeyValue::new(semcov::trace::NETWORK_PEER_ADDRESS, "10.1.2.2"), KeyValue::new(semcov::trace::USER_AGENT_ORIGINAL, "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0"), - KeyValue::new(semcov::trace::ENDUSER_ID, "marry"), + KeyValue::new(semcov::attribute::USER_ID, "marry"), ]); let span = server_tracer.build_with_context(builder, &cx); { diff --git a/src/convert.rs b/src/convert.rs index 9f444f9..ed50e5a 100644 --- a/src/convert.rs +++ b/src/convert.rs @@ -37,17 +37,17 @@ pub(crate) fn time_to_string(time: SystemTime) -> String { } #[cfg(any(feature = "trace", feature = "logs"))] -pub(crate) fn attrs_to_properties<'a, T>( - attributes: &'a [T], +pub(crate) fn attrs_to_properties<'a, A, T: 'a>( + attributes: A, resource: Option<&Resource>, #[cfg(feature = "trace")] links: &[Link], ) -> Option where + A: Iterator + 'a, &'a T: Into>, { #[allow(unused_mut)] let mut properties: Properties = attributes - .iter() .map(|kv| kv.into()) .map(|kv| (kv.0, kv.1)) .chain( @@ -68,12 +68,12 @@ where } #[cfg(any(feature = "trace", feature = "logs"))] -pub(crate) fn attrs_to_map<'a, T>(attributes: &'a [T]) -> HashMap<&str, &dyn AttrValue> +pub(crate) fn attrs_to_map<'a, A, T: 'a>(attributes: A) -> HashMap<&'a str, &'a dyn AttrValue> where + A: Iterator + 'a, &'a T: Into>, { attributes - .iter() .map(|kv| kv.into()) .map(|kv| (kv.0, kv.1)) .collect() @@ -156,7 +156,7 @@ impl AttrValue for AnyValue { AnyValue::Bytes(bytes) => { let mut s = String::new(); s.push('['); - for &b in bytes { + for &b in bytes.as_ref() { s.push_str(&format!("{}", b)); s.push(','); } @@ -169,7 +169,7 @@ impl AttrValue for AnyValue { AnyValue::ListAny(list) => { let mut s = String::new(); s.push('['); - for v in list { + for v in list.as_ref() { s.push_str(v.as_str().as_ref()); s.push(','); } @@ -182,7 +182,7 @@ impl AttrValue for AnyValue { AnyValue::Map(map) => { let mut s = String::new(); s.push('{'); - for (k, v) in map { + for (k, v) in map.as_ref() { s.push_str(k.as_str()); s.push(':'); s.push_str(v.as_str().as_ref()); @@ -214,7 +214,7 @@ mod tests { fn attrs_to_properties_filters_ms() { let attrs = vec![KeyValue::new("a", "b"), KeyValue::new("_MS.a", "b")]; let resource = Resource::new([KeyValue::new("c", "d"), KeyValue::new("_MS.c", "d")]); - let props = attrs_to_properties(&attrs, Some(&resource), &[]).unwrap(); + let props = attrs_to_properties(attrs.iter(), Some(&resource), &[]).unwrap(); assert_eq!(props.len(), 2); assert_eq!(props.get(&"a".into()).unwrap().as_ref(), "b"); assert_eq!(props.get(&"c".into()).unwrap().as_ref(), "d"); @@ -224,7 +224,7 @@ mod tests { fn attrs_to_properties_encodes_links() { let attrs: Vec = Vec::new(); let links = vec![Link::new(SpanContext::empty_context(), Vec::new(), 0)]; - let props = attrs_to_properties(&attrs, None, &links).unwrap(); + let props = attrs_to_properties(attrs.iter(), None, &links).unwrap(); assert_eq!(props.len(), 1); assert_eq!( props.get(&"_MS.links".into()).unwrap().as_ref(), @@ -240,7 +240,7 @@ mod tests { for _ in 0..input_len { links.push(Link::new(SpanContext::empty_context(), Vec::new(), 0)); } - let props = attrs_to_properties(&attrs, None, &links).unwrap(); + let props = attrs_to_properties(attrs.iter(), None, &links).unwrap(); assert_eq!(props.len(), 1); let encoded_links = props.get(&"_MS.links".into()).unwrap(); let deserialized: serde_json::Value = serde_json::from_str(encoded_links.as_ref()).unwrap(); @@ -253,7 +253,7 @@ mod tests { #[test] fn attrs_map_to_properties_filters_ms() { let attrs = vec![KeyValue::new("a", "b"), KeyValue::new("_MS.a", "b")]; - let attrs_map = attrs_to_map(&attrs); + let attrs_map = attrs_to_map(attrs.iter()); assert_eq!(attrs_map.len(), 2); let props = attrs_map_to_properties(attrs_map).unwrap(); assert_eq!(props.len(), 1); @@ -264,12 +264,12 @@ mod tests { #[test_case(AnyValue::Double(1.2), "1.2" ; "double")] #[test_case(AnyValue::String("test".into()), "test" ; "string")] #[test_case(AnyValue::Boolean(true), "true" ; "boolean")] - #[test_case(AnyValue::Bytes(vec![]), "[]" ; "empty bytes")] - #[test_case(AnyValue::Bytes(vec![1, 2, 3]), "[1,2,3]" ; "bytes")] - #[test_case(AnyValue::ListAny(vec![]), "[]" ; "empty list")] - #[test_case(AnyValue::ListAny(vec![1.into(), "test".into()]), "[1,test]" ; "list")] - #[test_case(AnyValue::Map([].into()), "{}" ; "empty map")] - #[test_case(AnyValue::Map([("k1".into(), "test".into())].into()), "{k1:test}" ; "map")] + #[test_case(AnyValue::Bytes(Box::new(vec![])), "[]" ; "empty bytes")] + #[test_case(AnyValue::Bytes(Box::new(vec![1, 2, 3])), "[1,2,3]" ; "bytes")] + #[test_case(AnyValue::ListAny(Box::new(vec![])), "[]" ; "empty list")] + #[test_case(AnyValue::ListAny(Box::new(vec![1.into(), "test".into()])), "[1,test]" ; "list")] + #[test_case(AnyValue::Map(Box::new([].into())), "{}" ; "empty map")] + #[test_case(AnyValue::Map(Box::new([("k1".into(), "test".into())].into())), "{k1:test}" ; "map")] fn any_value_as_str(v: AnyValue, expected: &'static str) { assert_eq!(expected.to_string(), (&v as &dyn AttrValue).as_str()); } diff --git a/src/lib.rs b/src/lib.rs index 425c195..06d6e47 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -95,36 +95,41 @@ //! } //! ``` //! -//! ## Live Metrics -//! -//! This requires the **live-metrics** feature _and_ the `build_batch`/`install_batch` methods. -//! -//! Enable live metrics collection: . -//! -//! Metrics are based on traces. See attribute mapping below for how traces are mapped to requests, -//! dependencies and exceptions and how they are deemed "successful" or not. -//! -//! To configure role, instance, and machine name provide `service.name`, `service.instance.id`, and -//! `host.name` resource attributes respectively in the trace config. -//! -//! Sample telemetry is not supported, yet. -//! -//! ```no_run -//! use opentelemetry::trace::Tracer as _; -//! -//! #[tokio::main] -//! async fn main() { -//! let tracer = opentelemetry_application_insights::new_pipeline_from_env() -//! .expect("env var APPLICATIONINSIGHTS_CONNECTION_STRING is valid connection string") -//! .with_client(reqwest::Client::new()) -//! .with_live_metrics(true) -//! .install_batch(opentelemetry_sdk::runtime::Tokio); -//! -//! // ... send traces ... -//! -//! opentelemetry::global::shutdown_tracer_provider(); -//! } -//! ``` +#![cfg_attr( + feature = "live-metrics", + doc = r#" +## Live Metrics + +This requires the **live-metrics** feature _and_ the `build_batch`/`install_batch` methods. + +Enable live metrics collection: . + +Metrics are based on traces. See attribute mapping below for how traces are mapped to requests, +dependencies and exceptions and how they are deemed "successful" or not. + +To configure role, instance, and machine name provide `service.name`, `service.instance.id`, and +`host.name` resource attributes respectively in the trace config. + +Sample telemetry is not supported, yet. + +```no_run +use opentelemetry::trace::Tracer as _; + +#[tokio::main] +async fn main() { + let tracer = opentelemetry_application_insights::new_pipeline_from_env() + .expect("env var APPLICATIONINSIGHTS_CONNECTION_STRING is valid connection string") + .with_client(reqwest::Client::new()) + .with_live_metrics(true) + .install_batch(opentelemetry_sdk::runtime::Tokio); + + // ... send traces ... + + opentelemetry::global::shutdown_tracer_provider(); +} +``` +"# +)] //! //! ## Simple or Batch //! @@ -231,7 +236,7 @@ //! //! | OpenTelemetry attribute key | Application Insights field | //! | -------------------------------------------------------------------------- | -------------------------------------------------------- | -//! | `enduser.id` | Context: Authenticated user id (`ai.user.authUserId`) | +//! | `user.id` | Context: Authenticated user id (`ai.user.authUserId`) | //! | `SpanKind::Server` + `http.request.method` + `http.route` | Context: Operation Name (`ai.operation.name`) | //! | `ai.*` | Context: AppInsights Tag (`ai.*`) | //! | `url.full` | Dependency Data | @@ -263,6 +268,7 @@ //! //! | Attribute | Deprecated attribute | //! | --------------------------- | ------------------------------------------ | +//! | `user.id` | `enduser.id` | //! | `db.namespace` | `db.name` | //! | `db.query.text` | `db.statement` | //! | `http.request.method` | `http.method` | diff --git a/src/logs.rs b/src/logs.rs index 902e6ff..e9a8a11 100644 --- a/src/logs.rs +++ b/src/logs.rs @@ -7,36 +7,39 @@ use crate::{ Exporter, }; use async_trait::async_trait; -use opentelemetry::logs::{LogResult, Severity}; +use opentelemetry::{ + logs::{LogResult, Severity}, + InstrumentationLibrary, +}; use opentelemetry_http::HttpClient; use opentelemetry_sdk::{ - export::logs::{LogData, LogExporter}, + export::logs::{LogBatch, LogExporter}, + logs::LogRecord, Resource, }; use opentelemetry_semantic_conventions as semcov; -use std::{borrow::Cow, sync::Arc, time::SystemTime}; +use std::{sync::Arc, time::SystemTime}; -fn is_exception(log: &LogData) -> bool { - if let Some(attrs) = &log.record.attributes { - attrs.iter().any(|(k, _)| { - k.as_str() == semcov::trace::EXCEPTION_TYPE - || k.as_str() == semcov::trace::EXCEPTION_MESSAGE - }) - } else { - false - } +fn is_exception(record: &LogRecord) -> bool { + record.attributes_iter().any(|(k, _)| { + k.as_str() == semcov::trace::EXCEPTION_TYPE + || k.as_str() == semcov::trace::EXCEPTION_MESSAGE + }) } impl Exporter { - fn create_envelope_for_log(&self, log: &LogData) -> Envelope { - let (data, name) = if is_exception(&log) { + fn create_envelope_for_log( + &self, + (record, instrumentation_lib): (&LogRecord, &InstrumentationLibrary), + ) -> Envelope { + let (data, name) = if is_exception(record) { ( - Data::Exception(log.into()), + Data::Exception(record.into()), "Microsoft.ApplicationInsights.Exception", ) } else { ( - Data::Message(log.into()), + Data::Message(record.into()), "Microsoft.ApplicationInsights.Message", ) }; @@ -44,15 +47,19 @@ impl Exporter { Envelope { name, time: time_to_string( - log.record + record .timestamp - .or(log.record.observed_timestamp) + .or(record.observed_timestamp) .unwrap_or_else(SystemTime::now), ) .into(), sample_rate: None, i_key: Some(self.instrumentation_key.clone().into()), - tags: Some(get_tags_for_log(&log, &self.resource)), + tags: Some(get_tags_for_log( + record, + instrumentation_lib, + &self.resource, + )), data: Some(data), } } @@ -64,12 +71,12 @@ impl LogExporter for Exporter where C: HttpClient + 'static, { - async fn export<'a>(&mut self, batch: Vec>) -> LogResult<()> { + async fn export(&mut self, batch: LogBatch<'_>) -> LogResult<()> { let client = Arc::clone(&self.client); let endpoint = Arc::clone(&self.endpoint); let envelopes: Vec<_> = batch - .into_iter() - .map(|log| self.create_envelope_for_log(&log)) + .iter() + .map(|log| self.create_envelope_for_log(log)) .collect(); crate::uploader::send(client.as_ref(), endpoint.as_ref(), envelopes).await?; @@ -108,13 +115,9 @@ impl From for SeverityLevel { } } -impl From<&LogData> for ExceptionData { - fn from(log: &LogData) -> ExceptionData { - let mut attrs = if let Some(attrs) = log.record.attributes.as_ref() { - attrs_to_map(attrs) - } else { - Default::default() - }; +impl From<&LogRecord> for ExceptionData { + fn from(record: &LogRecord) -> ExceptionData { + let mut attrs = attrs_to_map(record.attributes_iter()); let exception = ExceptionDetails { type_name: attrs .remove(semcov::trace::EXCEPTION_TYPE) @@ -131,32 +134,29 @@ impl From<&LogData> for ExceptionData { ExceptionData { ver: 2, exceptions: vec![exception], - severity_level: log.record.severity_number.map(Into::into), + severity_level: record.severity_number.map(Into::into), properties: attrs_map_to_properties(attrs), } } } -impl From<&LogData> for MessageData { - fn from(log: &LogData) -> MessageData { +impl From<&LogRecord> for MessageData { + fn from(record: &LogRecord) -> MessageData { MessageData { ver: 2, - severity_level: log.record.severity_number.map(Into::into), - message: log - .record + severity_level: record.severity_number.map(Into::into), + message: record .body .as_ref() .map(|v| v.as_str().into_owned()) .unwrap_or_else(|| "".into()) .into(), - properties: log.record.attributes.as_ref().and_then(|attrs| { - attrs_to_properties( - attrs, - None, - #[cfg(feature = "trace")] - &[], - ) - }), + properties: attrs_to_properties( + record.attributes_iter(), + None, + #[cfg(feature = "trace")] + &[], + ), } } } diff --git a/src/tags.rs b/src/tags.rs index 401f3fa..3e80928 100644 --- a/src/tags.rs +++ b/src/tags.rs @@ -7,10 +7,10 @@ use opentelemetry::trace::{SpanId, SpanKind}; #[cfg(feature = "metrics")] use opentelemetry::KeyValue; use opentelemetry::{InstrumentationLibrary, Key}; -#[cfg(feature = "logs")] -use opentelemetry_sdk::export::logs::LogData; #[cfg(feature = "trace")] use opentelemetry_sdk::export::trace::SpanData; +#[cfg(feature = "logs")] +use opentelemetry_sdk::logs::LogRecord; use opentelemetry_sdk::Resource; use opentelemetry_semantic_conventions as semcov; use std::collections::HashMap; @@ -33,7 +33,12 @@ pub(crate) fn get_tags_for_span(span: &SpanData, resource: &Resource) -> Tags { tags.insert(tags::OPERATION_PARENT_ID, span.parent_span_id.to_string()); } - if let Some(user_id) = attrs_map.get(semcov::trace::ENDUSER_ID) { + if let Some(user_id) = attrs_map.get(semcov::attribute::USER_ID).or_else(|| { + attrs_map.get( + #[allow(deprecated)] + semcov::attribute::ENDUSER_ID, + ) + }) { // Using authenticated user id here to be safe. Or would ai.user.id (anonymous user id) // fit better? tags.insert(tags::USER_AUTH_USER_ID, user_id.as_str().into_owned()); @@ -76,7 +81,7 @@ pub(crate) fn get_tags_for_event(span: &SpanData, resource: &Resource) -> Tags { pub(crate) fn get_tags_for_metric( resource: &Resource, scope: &InstrumentationLibrary, - attrs: &Vec, + attrs: &[KeyValue], ) -> Tags { let mut tags = Tags::new(); build_tags_from_resource_attrs(&mut tags, resource, scope); @@ -90,18 +95,22 @@ pub(crate) fn get_tags_for_metric( } #[cfg(feature = "logs")] -pub(crate) fn get_tags_for_log(log: &LogData, resource: &Resource) -> Tags { +pub(crate) fn get_tags_for_log( + record: &LogRecord, + instrumentation_lib: &InstrumentationLibrary, + resource: &Resource, +) -> Tags { let mut tags = Tags::new(); - build_tags_from_resource_attrs(&mut tags, resource, &log.instrumentation); + build_tags_from_resource_attrs(&mut tags, resource, instrumentation_lib); - if let Some(attrs) = &log.record.attributes { - build_tags_from_attrs( - &mut tags, - attrs.iter().map(|(k, v)| (k, v as &dyn AttrValue)), - ); - } + build_tags_from_attrs( + &mut tags, + record + .attributes_iter() + .map(|(k, v)| (k, v as &dyn AttrValue)), + ); - if let Some(trace_context) = &log.record.trace_context { + if let Some(trace_context) = &record.trace_context { tags.insert(tags::OPERATION_ID, trace_context.trace_id.to_string()); tags.insert(tags::OPERATION_PARENT_ID, trace_context.span_id.to_string()); } diff --git a/src/trace.rs b/src/trace.rs index 7f08f21..7f15ec9 100644 --- a/src/trace.rs +++ b/src/trace.rs @@ -228,7 +228,11 @@ impl<'a> From> for RequestData { success: is_request_success(span), source: None, url: None, - properties: attrs_to_properties(&span.attributes, Some(resource), &span.links.links), + properties: attrs_to_properties( + span.attributes.iter(), + Some(resource), + &span.links.links, + ), }; let attrs: HashMap<&str, &Value> = span @@ -320,7 +324,11 @@ impl<'a> From> for RemoteDependencyData { data: None, target: None, type_: None, - properties: attrs_to_properties(&span.attributes, Some(resource), &span.links.links), + properties: attrs_to_properties( + span.attributes.iter(), + Some(resource), + &span.links.links, + ), }; let attrs: HashMap<&str, &Value> = span @@ -434,7 +442,7 @@ impl<'a> From> for RemoteDependencyData { impl From<&Event> for ExceptionData { fn from(event: &Event) -> ExceptionData { - let mut attrs = attrs_to_map(&event.attributes); + let mut attrs = attrs_to_map(event.attributes.iter()); let exception = ExceptionDetails { type_name: attrs .remove(semcov::trace::EXCEPTION_TYPE) @@ -459,7 +467,7 @@ impl From<&Event> for ExceptionData { impl From<&Event> for EventData { fn from(event: &Event) -> EventData { - let mut attrs = attrs_to_map(&event.attributes); + let mut attrs = attrs_to_map(event.attributes.iter()); EventData { ver: 2, name: attrs @@ -478,7 +486,7 @@ const LEVEL: &str = "level"; impl From<&Event> for MessageData { fn from(event: &Event) -> MessageData { - let mut attrs = attrs_to_map(&event.attributes); + let mut attrs = attrs_to_map(event.attributes.iter()); let severity_level = attrs.get(LEVEL).and_then(|&x| value_to_severity_level(x)); if severity_level.is_some() { attrs.remove(LEVEL); diff --git a/tests/http_requests.rs b/tests/http_requests.rs index a2e90b3..ac8420c 100644 --- a/tests/http_requests.rs +++ b/tests/http_requests.rs @@ -7,11 +7,13 @@ //! ``` use format::requests_to_string; +#[cfg(feature = "live-metrics")] +use opentelemetry::trace::{Span, Status}; use opentelemetry::{ logs::{LogRecord as _, Logger as _, LoggerProvider as _, Severity}, trace::{ - get_active_span, mark_span_as_active, Link, Span, SpanKind, Status, TraceContextExt, - Tracer, TracerProvider, + get_active_span, mark_span_as_active, Link, SpanKind, TraceContextExt, Tracer, + TracerProvider, }, Context, KeyValue, }; @@ -71,7 +73,7 @@ fn traces() { KeyValue::new(semcov::trace::SERVER_PORT, 8080), KeyValue::new(semcov::trace::NETWORK_PEER_ADDRESS, "10.1.2.4"), KeyValue::new(semcov::trace::HTTP_RESPONSE_STATUS_CODE, 200), - KeyValue::new(semcov::trace::ENDUSER_ID, "marry"), + KeyValue::new(semcov::attribute::USER_ID, "marry"), ]) .start(&client_tracer); { @@ -95,7 +97,7 @@ fn traces() { KeyValue::new(semcov::trace::CLIENT_ADDRESS, "10.1.2.3"), KeyValue::new(semcov::trace::NETWORK_PEER_ADDRESS, "10.1.2.2"), KeyValue::new(semcov::trace::USER_AGENT_ORIGINAL, "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0"), - KeyValue::new(semcov::trace::ENDUSER_ID,"marry"), + KeyValue::new(semcov::attribute::USER_ID,"marry"), ]); let span = server_tracer.build_with_context(builder, &cx); { @@ -224,6 +226,7 @@ async fn logs() { } #[tokio::test] +#[cfg(feature = "live-metrics")] async fn live_metrics() { let requests = record(TokioTick, |client| { let tracer_provider = new_pipeline_from_connection_string(CONNECTION_STRING) diff --git a/tests/snapshots/http_requests__live_metrics.snap b/tests/snapshots/http_requests__live_metrics.snap index aad651a..f05679f 100644 --- a/tests/snapshots/http_requests__live_metrics.snap +++ b/tests/snapshots/http_requests__live_metrics.snap @@ -21,7 +21,7 @@ x-ms-qps-role-name: unknown_service "RoleName": "unknown_service", "StreamId": "STRIPPED", "Timestamp": "STRIPPED", - "Version": "opentelemetry:0.24.1" + "Version": "opentelemetry:0.25.0" } @@ -87,7 +87,7 @@ content-encoding: gzip "RoleName": "unknown_service", "StreamId": "STRIPPED", "Timestamp": "STRIPPED", - "Version": "opentelemetry:0.24.1" + "Version": "opentelemetry:0.25.0" } ] @@ -144,7 +144,7 @@ content-encoding: gzip "RoleName": "unknown_service", "StreamId": "STRIPPED", "Timestamp": "STRIPPED", - "Version": "opentelemetry:0.24.1" + "Version": "opentelemetry:0.25.0" } ] @@ -165,7 +165,7 @@ content-encoding: gzip "service.name": "unknown_service", "telemetry.sdk.language": "rust", "telemetry.sdk.name": "opentelemetry", - "telemetry.sdk.version": "0.24.1" + "telemetry.sdk.version": "0.25.0" }, "resultCode": "2", "success": false, @@ -178,7 +178,7 @@ content-encoding: gzip "sampleRate": 100.0, "tags": { "ai.cloud.role": "unknown_service", - "ai.internal.sdkVersion": "opentelemetry:0.24.1", + "ai.internal.sdkVersion": "opentelemetry:0.25.0", "ai.operation.id": "STRIPPED" }, "time": "STRIPPED" @@ -201,7 +201,7 @@ content-encoding: gzip "sampleRate": 100.0, "tags": { "ai.cloud.role": "unknown_service", - "ai.internal.sdkVersion": "opentelemetry:0.24.1", + "ai.internal.sdkVersion": "opentelemetry:0.25.0", "ai.operation.id": "STRIPPED", "ai.operation.parentId": "STRIPPED" }, @@ -217,7 +217,7 @@ content-encoding: gzip "service.name": "unknown_service", "telemetry.sdk.language": "rust", "telemetry.sdk.name": "opentelemetry", - "telemetry.sdk.version": "0.24.1" + "telemetry.sdk.version": "0.25.0" }, "responseCode": "2", "success": false, @@ -230,7 +230,7 @@ content-encoding: gzip "sampleRate": 100.0, "tags": { "ai.cloud.role": "unknown_service", - "ai.internal.sdkVersion": "opentelemetry:0.24.1", + "ai.internal.sdkVersion": "opentelemetry:0.25.0", "ai.operation.id": "STRIPPED" }, "time": "STRIPPED" @@ -245,7 +245,7 @@ content-encoding: gzip "service.name": "unknown_service", "telemetry.sdk.language": "rust", "telemetry.sdk.name": "opentelemetry", - "telemetry.sdk.version": "0.24.1" + "telemetry.sdk.version": "0.25.0" }, "responseCode": "0", "success": true, @@ -258,7 +258,7 @@ content-encoding: gzip "sampleRate": 100.0, "tags": { "ai.cloud.role": "unknown_service", - "ai.internal.sdkVersion": "opentelemetry:0.24.1", + "ai.internal.sdkVersion": "opentelemetry:0.25.0", "ai.operation.id": "STRIPPED" }, "time": "STRIPPED" diff --git a/tests/snapshots/http_requests__logs.snap b/tests/snapshots/http_requests__logs.snap index 3a14c30..7d18806 100644 --- a/tests/snapshots/http_requests__logs.snap +++ b/tests/snapshots/http_requests__logs.snap @@ -121,7 +121,7 @@ content-encoding: gzip "service.name": "unknown_service", "telemetry.sdk.language": "rust", "telemetry.sdk.name": "opentelemetry", - "telemetry.sdk.version": "0.24.1" + "telemetry.sdk.version": "0.25.0" }, "resultCode": "0", "type": "InProc", @@ -134,7 +134,7 @@ content-encoding: gzip "sampleRate": 100.0, "tags": { "ai.cloud.role": "unknown_service", - "ai.internal.sdkVersion": "opentelemetry:0.24.1", + "ai.internal.sdkVersion": "opentelemetry:0.25.0", "ai.operation.id": "STRIPPED" }, "time": "STRIPPED" diff --git a/tests/snapshots/http_requests__traces.snap b/tests/snapshots/http_requests__traces.snap index 3c15b9f..a35e019 100644 --- a/tests/snapshots/http_requests__traces.snap +++ b/tests/snapshots/http_requests__traces.snap @@ -1,6 +1,6 @@ --- source: tests/http_requests.rs -expression: traces_simple +expression: traces --- POST /v2/track HTTP/1.1 host: dc.services.visualstudio.com @@ -51,7 +51,6 @@ content-encoding: gzip "name": "GET /hello/world", "properties": { "client.address": "10.1.2.3", - "enduser.id": "marry", "http.request.method": "GET", "http.response.status_code": "200", "http.route": "/hello/world", @@ -65,6 +64,7 @@ content-encoding: gzip "url.path": "/hello/world", "url.query": "name=marry", "url.scheme": "https", + "user.id": "marry", "user_agent.original": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0" }, "responseCode": "200", @@ -172,7 +172,6 @@ content-encoding: gzip "properties": { "device.id": "123", "device.model.name": "device", - "enduser.id": "marry", "http.request.method": "GET", "http.response.status_code": "200", "network.peer.address": "10.1.2.4", @@ -182,7 +181,8 @@ content-encoding: gzip "server.port": "8080", "service.name": "client", "service.namespace": "test", - "url.full": "https://example.com:8080/hello/world?name=marry" + "url.full": "https://example.com:8080/hello/world?name=marry", + "user.id": "marry" }, "resultCode": "200", "target": "example.com:8080", diff --git a/tests/snapshots/http_requests__traces_batch_async_std.snap b/tests/snapshots/http_requests__traces_batch_async_std.snap index 238c5d3..c32479c 100644 --- a/tests/snapshots/http_requests__traces_batch_async_std.snap +++ b/tests/snapshots/http_requests__traces_batch_async_std.snap @@ -18,7 +18,7 @@ content-encoding: gzip "service.name": "unknown_service", "telemetry.sdk.language": "rust", "telemetry.sdk.name": "opentelemetry", - "telemetry.sdk.version": "0.24.1" + "telemetry.sdk.version": "0.25.0" }, "resultCode": "0", "type": "InProc", @@ -31,7 +31,7 @@ content-encoding: gzip "sampleRate": 100.0, "tags": { "ai.cloud.role": "unknown_service", - "ai.internal.sdkVersion": "opentelemetry:0.24.1", + "ai.internal.sdkVersion": "opentelemetry:0.25.0", "ai.operation.id": "STRIPPED" }, "time": "STRIPPED" diff --git a/tests/snapshots/http_requests__traces_batch_tokio.snap b/tests/snapshots/http_requests__traces_batch_tokio.snap index b6bc4d4..9657a05 100644 --- a/tests/snapshots/http_requests__traces_batch_tokio.snap +++ b/tests/snapshots/http_requests__traces_batch_tokio.snap @@ -18,7 +18,7 @@ content-encoding: gzip "service.name": "unknown_service", "telemetry.sdk.language": "rust", "telemetry.sdk.name": "opentelemetry", - "telemetry.sdk.version": "0.24.1" + "telemetry.sdk.version": "0.25.0" }, "resultCode": "0", "type": "InProc", @@ -31,7 +31,7 @@ content-encoding: gzip "sampleRate": 100.0, "tags": { "ai.cloud.role": "unknown_service", - "ai.internal.sdkVersion": "opentelemetry:0.24.1", + "ai.internal.sdkVersion": "opentelemetry:0.25.0", "ai.operation.id": "STRIPPED" }, "time": "STRIPPED"