Skip to content

Commit dd4c13b

Browse files
TommyCppcijothomas
andauthored
fix(sdk): fix incorrect doc (#1499)
Co-authored-by: Cijo Thomas <[email protected]>
1 parent 270c857 commit dd4c13b

File tree

3 files changed

+26
-64
lines changed

3 files changed

+26
-64
lines changed

opentelemetry-sdk/src/metrics/meter_provider.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,7 @@ impl Default for SdkMeterProvider {
3838
}
3939

4040
impl SdkMeterProvider {
41-
/// Flushes all pending telemetry.
42-
///
43-
/// There is no guaranteed that all telemetry be flushed or all resources have
44-
/// been released on error.
41+
/// Return default [MeterProviderBuilder]
4542
pub fn builder() -> MeterProviderBuilder {
4643
MeterProviderBuilder::default()
4744
}

opentelemetry-sdk/src/propagation/baggage.rs

-42
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,3 @@
1-
//! # OpenTelemetry Baggage API
2-
//!
3-
//! Baggage is used to annotate telemetry, adding context and
4-
//! information to metrics, traces, and logs. It is an abstract data type
5-
//! represented by a set of name-value pairs describing user-defined properties.
6-
//! Each name in a [`Baggage`] is associated with exactly one value.
7-
//! `Baggage`s are serialized according to the editor's draft of
8-
//! the [W3C Baggage] specification.
9-
//!
10-
//! [`Baggage`]: opentelemetry::baggage::Baggage
11-
//! [W3C Baggage]: https://w3c.github.io/baggage/
12-
//!
13-
//! # Examples
14-
//!
15-
//! ```
16-
//! use opentelemetry::{baggage::BaggageExt, Key, propagation::TextMapPropagator};
17-
//! use opentelemetry_sdk::propagation::BaggagePropagator;
18-
//! use std::collections::HashMap;
19-
//!
20-
//! // Example baggage value passed in externally via http headers
21-
//! let mut headers = HashMap::new();
22-
//! headers.insert("baggage".to_string(), "user_id=1".to_string());
23-
//!
24-
//! let propagator = BaggagePropagator::new();
25-
//! // can extract from any type that impls `Extractor`, usually an HTTP header map
26-
//! let cx = propagator.extract(&headers);
27-
//!
28-
//! // Iterate over extracted name-value pairs
29-
//! for (name, value) in cx.baggage() {
30-
//! // ...
31-
//! }
32-
//!
33-
//! // Add new baggage
34-
//! let cx_with_additions = cx.with_baggage(vec![Key::new("server_id").i64(42)]);
35-
//!
36-
//! // Inject baggage into http request
37-
//! propagator.inject_context(&cx_with_additions, &mut headers);
38-
//!
39-
//! let header_value = headers.get("baggage").expect("header is injected");
40-
//! assert!(header_value.contains("user_id=1"), "still contains previous name-value");
41-
//! assert!(header_value.contains("server_id=42"), "contains new name-value pair");
42-
//! ```
431
use once_cell::sync::Lazy;
442
use opentelemetry::{
453
baggage::{BaggageExt, KeyValueMetadata},

opentelemetry-sdk/src/propagation/trace_context.rs

+25-18
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,6 @@
11
//! # W3C Trace Context Propagator
22
//!
3-
//! The `traceparent` header represents the incoming request in a
4-
//! tracing system in a common format, understood by all vendors.
5-
//! Here’s an example of a `traceparent` header.
6-
//!
7-
//! `traceparent: 00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01`
8-
//!
9-
//! The `traceparent` HTTP header field identifies the incoming request in a
10-
//! tracing system. It has four fields:
11-
//!
12-
//! - version
13-
//! - trace-id
14-
//! - parent-id
15-
//! - trace-flags
16-
//!
17-
//! See the [w3c trace-context docs] for more details.
18-
//!
19-
//! [w3c trace-context docs]: https://w3c.github.io/trace-context/
3+
204
use once_cell::sync::Lazy;
215
use opentelemetry::{
226
propagation::{text_map_propagator::FieldIter, Extractor, Injector, TextMapPropagator},
@@ -33,8 +17,31 @@ const TRACESTATE_HEADER: &str = "tracestate";
3317
static TRACE_CONTEXT_HEADER_FIELDS: Lazy<[String; 2]> =
3418
Lazy::new(|| [TRACEPARENT_HEADER.to_owned(), TRACESTATE_HEADER.to_owned()]);
3519

36-
/// Propagates `SpanContext`s in [W3C TraceContext] format.
20+
/// Propagates `SpanContext`s in [W3C TraceContext] format under `traceparent` and `tracestate` header.
21+
///
22+
/// The `traceparent` header represents the incoming request in a
23+
/// tracing system in a common format, understood by all vendors.
24+
/// Here’s an example of a `traceparent` header.
25+
///
26+
/// `traceparent: 00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01`
27+
///
28+
/// The `traceparent` HTTP header field identifies the incoming request in a
29+
/// tracing system. It has four fields:
30+
///
31+
/// - version
32+
/// - trace-id
33+
/// - parent-id
34+
/// - trace-flags
35+
///
36+
/// The `tracestate` header provides additional vendor-specific trace
37+
/// identification information across different distributed tracing systems.
38+
/// Here's an example of a `tracestate` header
39+
///
40+
/// `tracestate: vendorname1=opaqueValue1,vendorname2=opaqueValue2`
41+
///
42+
/// See the [w3c trace-context docs] for more details.
3743
///
44+
/// [w3c trace-context docs]: https://w3c.github.io/trace-context/
3845
/// [W3C TraceContext]: https://www.w3.org/TR/trace-context/
3946
#[derive(Clone, Debug, Default)]
4047
pub struct TraceContextPropagator {

0 commit comments

Comments
 (0)