Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[shippingservice] add resource data #504

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ significant modifications will be credited to OpenTelemetry Authors.
([#455](https://github.com/open-telemetry/opentelemetry-demo/pull/455))
* Update cartservice Dockerfile to support ARM64
([#439](https://github.com/open-telemetry/opentelemetry-demo/pull/439))
* Update shippingservice to add resource data to spans
([#504](https://github.com/open-telemetry/opentelemetry-demo/pull/504))
* Add Envoy as reverse proxy for all user-facing services
([#508](https://github.com/open-telemetry/opentelemetry-demo/pull/508))
* Envoy: Grafana, Load Generator, Jaeger exposed.
Expand Down
7 changes: 7 additions & 0 deletions docs/services/shippingservice.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ The OpenTelemetry SDK is initialized from `main`.
```rust
fn init_tracer() -> Result<sdktrace::Tracer, TraceError> {
global::set_text_map_propagator(TraceContextPropagator::new());
let os_resource = OsResourceDetector.detect(Duration::from_secs(0));
let process_resource = ProcessResourceDetector.detect(Duration::from_secs(0));
let sdk_resource = SdkProvidedResourceDetector.detect(Duration::from_secs(0));
opentelemetry_otlp::new_pipeline()
.tracing()
.with_exporter(
Expand All @@ -38,6 +41,10 @@ fn init_tracer() -> Result<sdktrace::Tracer, TraceError> {
)), // TODO: assume this ^ is true from config when opentelemetry crate > v0.17.0
// https://github.com/open-telemetry/opentelemetry-rust/pull/806 includes the environment variable.
)
.with_trace_config(
sdktrace::config()
.with_resource(os_resource.merge(&process_resource).merge(&sdk_resource)),
)
.install_batch(opentelemetry::runtime::Tokio)
}
```
Expand Down
Loading