Skip to content

Commit f5ace44

Browse files
committed
cleanup jaeger example
1 parent 8872bf8 commit f5ace44

File tree

5 files changed

+46
-106
lines changed

5 files changed

+46
-106
lines changed

examples/tracing-jaeger/Cargo.toml

Lines changed: 0 additions & 12 deletions
This file was deleted.

examples/tracing-jaeger/README.md

Lines changed: 0 additions & 21 deletions
This file was deleted.

examples/tracing-jaeger/jaeger.png

-165 KB
Binary file not shown.

examples/tracing-jaeger/src/main.rs

Lines changed: 0 additions & 50 deletions
This file was deleted.

opentelemetry-otlp/src/lib.rs

Lines changed: 46 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,49 @@
1-
//! The OTLP Exporter supports exporting logs, metrics and traces in the OTLP
2-
//! format to the OpenTelemetry collector or other compatible backend.
1+
//! The OTLP Exporter allows exporting logs, metrics, and traces in the OTLP
2+
//! format to any backend that supports OTLP. This includes the OpenTelemetry Collector,
3+
//! open-source telemetry solutions like Prometheus and Jaeger, and vendor-specific endpoints.
34
//!
4-
//! The OpenTelemetry Collector offers a vendor-agnostic implementation on how
5-
//! to receive, process, and export telemetry data. In addition, it removes
6-
//! the need to run, operate, and maintain multiple agents/collectors in
7-
//! order to support open-source telemetry data formats (e.g. Jaeger,
8-
//! Prometheus, etc.) sending to multiple open-source or commercial back-ends.
5+
//! The OpenTelemetry Collector provides a vendor-neutral way to receive, process, and export telemetry data.
6+
//! It simplifies instrumentation by removing the need to operate multiple agents for different telemetry formats.
97
//!
10-
//! Currently, this crate supports sending telemetry in OTLP
11-
//! via gRPC and http (binary and json).
8+
//! Currently, this crate supports sending telemetry in OTLP via gRPC and HTTP (binary and JSON).
129
//!
13-
//! # Quickstart
10+
//! # Quickstart with OpenTelemetry Collector (HTTP)
1411
//!
15-
//! First make sure you have a running version of the opentelemetry collector
16-
//! you want to send data to:
12+
//! The following examples sets up Collector to receive OTLP data over HTTP on port 4318,
13+
//! and the application is configured to send OTLP data to this Collector.
1714
//!
1815
//! ```shell
19-
//! $ docker run -p 4317:4317 otel/opentelemetry-collector:latest
16+
//! $ docker run -p 4318:4318 otel/opentelemetry-collector:latest
2017
//! ```
2118
//!
22-
//! Then create a new `Exporter`, and `Provider` with the recommended defaults to start exporting
23-
//! telemetry.
19+
//! ```no_run
20+
//! # #[cfg(all(feature = "trace", feature = "http-proto"))]
21+
//! # {
22+
//! use opentelemetry::global;
23+
//! use opentelemetry::trace::Tracer;
24+
//!
25+
//! fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
26+
//! let otlp_exporter = opentelemetry_otlp::SpanExporter::builder().with_http().with_protocol(Protocol::HttpBinary).build()?;
27+
//! let _ = opentelemetry_sdk::trace::SdkTracerProvider::builder()
28+
//! .with_simple_exporter(otlp_exporter)
29+
//! .build();
30+
//! let tracer = global::tracer("my_tracer");
31+
//! tracer.in_span("doing_work", |cx| {
32+
//! // Traced application logic here...
33+
//! });
34+
//!
35+
//! Ok(())
36+
//! # }
37+
//! }
38+
//! ```
39+
//! # Quickstart with OpenTelemetry Collector (gRPC)
2440
//!
25-
//! You will have to build a OTLP exporter first. Create the correct exporter based on the signal
26-
//! you are looking to export `SpanExporter::builder()`, `MetricExporter::builder()`,
27-
//! `LogExporter::builder()` respectively for traces, metrics, and logs.
41+
//! The following examples sets up Collector to receive OTLP data over gRPC on port 4317,
42+
//! and the application is configured to send OTLP data to this Collector.
2843
//!
29-
//! Once you have the exporter, you can create your `Provider` by starting with `TracerProvider::builder()`,
30-
//! `SdkMeterProvider::builder()`, and `LoggerProvider::builder()` respectively for traces, metrics, and logs.
44+
//! ```shell
45+
//! $ docker run -p 4317:4317 otel/opentelemetry-collector:latest
46+
//! ```
3147
//!
3248
//! ```no_run
3349
//! # #[cfg(all(feature = "trace", feature = "grpc-tonic"))]
@@ -36,21 +52,28 @@
3652
//! use opentelemetry::trace::Tracer;
3753
//!
3854
//! fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
39-
//! // First, create a OTLP exporter builder. Configure it as you need.
4055
//! let otlp_exporter = opentelemetry_otlp::SpanExporter::builder().with_tonic().build()?;
41-
//! // Then pass it into provider builder
4256
//! let _ = opentelemetry_sdk::trace::SdkTracerProvider::builder()
4357
//! .with_simple_exporter(otlp_exporter)
4458
//! .build();
4559
//! let tracer = global::tracer("my_tracer");
4660
//! tracer.in_span("doing_work", |cx| {
47-
//! // Traced app logic here...
61+
//! // Traced application logic here...
4862
//! });
4963
//!
5064
//! Ok(())
5165
//! # }
5266
//! }
5367
//! ```
68+
//!
69+
//! The same application can also send traces to Jaeger, which natively supports OTLP.
70+
//! The following command shows how to run Jaeger with the OTLP endpoint enabled.
71+
//!
72+
//! ```shell
73+
//! docker run -p16686:16686 -p4317:4317 -e COLLECTOR_OTLP_ENABLED=true jaegertracing/all-in-one:latest
74+
//! ```
75+
//!
76+
//! After running the application, you can view the traces in Jaeger UI at `http://localhost:16686`.
5477
//!
5578
//! ## Performance
5679
//!

0 commit comments

Comments
 (0)