Skip to content

Commit

Permalink
Merge branch 'main' into jaeger-remote-sampler
Browse files Browse the repository at this point in the history
# Conflicts:
#	opentelemetry-http/src/lib.rs
#	opentelemetry-sdk/Cargo.toml
  • Loading branch information
TommyCpp committed Jun 23, 2022
2 parents 0ebdff1 + e33859f commit bda212e
Show file tree
Hide file tree
Showing 61 changed files with 1,818 additions and 385 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.49.0
toolchain: 1.55.0
override: true
- name: Run tests
run: cargo --version &&
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ analysis in order to understand your software's performance and behavior. You
can export and analyze them using [Prometheus], [Jaeger], and other
observability tools.

*Compiler support: [requires `rustc` 1.49+][msrv]*
*Compiler support: [requires `rustc` 1.55+][msrv]*

[Prometheus]: https://prometheus.io
[Jaeger]: https://www.jaegertracing.io
Expand Down Expand Up @@ -130,7 +130,7 @@ above, please let us know! We'd love to add your project to the list!
## Supported Rust Versions

OpenTelemetry is built against the latest stable release. The minimum supported
version is 1.49. The current OpenTelemetry version is not guaranteed to build
version is 1.55. The current OpenTelemetry version is not guaranteed to build
on Rust versions earlier than the minimum supported version.

The current stable Rust compiler and the three most recent minor versions
Expand Down
14 changes: 7 additions & 7 deletions examples/actix-http-tracing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ edition = "2018"
publish = false

[dependencies]
actix-web = "3.2"
actix-web-opentelemetry = { version = "0.9", features = ["metrics"] }
opentelemetry = { version = "0.11", features = ["metrics", "tokio"] }
opentelemetry-jaeger = { version = "0.10", features = ["tokio"] }
opentelemetry-prometheus = "0.4"
actix-web = "4.1"
actix-web-opentelemetry = { version = "0.12", features = ["metrics"] }
opentelemetry = { version = "0.17", features = ["metrics", "tokio"] }
opentelemetry-jaeger = { version = "0.16", features = ["tokio"] }
opentelemetry-prometheus = "0.10"
tracing = "0.1"
tracing-opentelemetry = "0.10"
tracing-subscriber = "0.2"
tracing-opentelemetry = "0.17"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
4 changes: 2 additions & 2 deletions examples/actix-http-tracing/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ async fn main() -> io::Result<()> {

// Start an otel jaeger trace pipeline
global::set_text_map_propagator(TraceContextPropagator::new());
let (tracer, _uninstall) = opentelemetry_jaeger::new_pipeline()
let tracer = opentelemetry_jaeger::new_pipeline()
.with_service_name("app_name")
.install()
.install_simple()
.unwrap();

// Initialize `tracing` using `opentelemetry-tracing` and configure logging
Expand Down
5 changes: 2 additions & 3 deletions examples/actix-http/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ publish = false
[dependencies]
opentelemetry = { path = "../../opentelemetry", features = ["rt-tokio"] }
opentelemetry-jaeger = { path = "../../opentelemetry-jaeger", features = ["reqwest_collector_client", "rt-tokio-current-thread"] }
thrift = "0.13"
actix-web = "4.0.0"
actix-web = "4.1.0"
actix-service = "2.0.0"
env_logger = "0.8.2"
env_logger = "0.9.0"
tokio = { version = "1", features = ["full"] }
1 change: 1 addition & 0 deletions examples/actix-http/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ fn init_tracer() -> Result<sdktrace::Tracer, TraceError> {
opentelemetry_jaeger::new_collector_pipeline()
.with_endpoint("http://127.0.0.1:14268/api/traces")
.with_service_name("trace-http-demo")
.with_reqwest()
.install_batch(opentelemetry::runtime::TokioCurrentThread)
}

Expand Down
7 changes: 3 additions & 4 deletions examples/actix-udp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ publish = false
[dependencies]
opentelemetry = { path = "../../opentelemetry" }
opentelemetry-jaeger = { path = "../../opentelemetry-jaeger" }
thrift = "0.13"
actix-web = "3"
actix-service = "1"
env_logger = "0.8.2"
actix-web = "4.1"
actix-service = "2"
env_logger = "0.9"
3 changes: 2 additions & 1 deletion examples/basic-otlp-http/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
* Run the application locally, to run as a docker container you have to change the relative paths from the `Cargo.toml`
* The Collector then sends the data to the appropriate backend, in this case JAEGER

This demo uses `docker-compose` and by default runs against the `otel/opentelemetry-collector-dev:latest` image.
This demo uses `docker-compose` and by default runs against the `otel/opentelemetry-collector-dev:latest` image,
and uses `http` as the transport.

```shell
docker-compose up
Expand Down
2 changes: 1 addition & 1 deletion examples/basic-otlp-http/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ services:
ports:
- "1888:1888" # pprof extension
- "13133:13133" # health_check extension
- "4317" # OTLP gRPC receiver
- "4317:4317" # OTLP gRPC receiver
- "4318:4318" # OTLP HTTP receiver
- "55670:55679" # zpages extension
depends_on:
Expand Down
6 changes: 6 additions & 0 deletions examples/basic-otlp/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM rust:1.51
COPY . /usr/src/basic-otlp/
WORKDIR /usr/src/basic-otlp/
RUN cargo build --release
RUN cargo install --path .
CMD ["/usr/local/cargo/bin/basic-otlp"]
31 changes: 30 additions & 1 deletion examples/basic-otlp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,33 @@ This example shows basic span and metric usage, and exports to the [OpenTelemetr

## Usage

### `docker-compose`

By default runs against the `otel/opentelemetry-collector-dev:latest` image, and uses the `tonic`'s
`grpc` example as the transport.

```shell
docker-compose up
or
docker-compose up -d
```

In another terminal run the application `cargo run`

Use the browser to see the trace:
- Jaeger at http://0.0.0.0:16686

Tear it down:

```shell
docker-compose down
```

### Manual

If you don't want to use `docker-compose`, you can manually run the `otel/opentelemetry-collector` container
and inspect the logs to see traces being transferred.

```shell
# Run `opentelemetry-collector`
$ docker run -p4317:4317 otel/opentelemetry-collector:latest
Expand Down Expand Up @@ -90,4 +117,6 @@ Data point attributes:
StartTimestamp: 2021-11-19 04:07:46.29555 +0000 UTC
Timestamp: 2021-11-19 04:08:36.297279 +0000 UTC
Value: 1.000000
```
```


37 changes: 37 additions & 0 deletions examples/basic-otlp/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
version: "2"
services:

# Jaeger
jaeger-all-in-one:
image: jaegertracing/all-in-one:latest
ports:
- "16686:16686"
- "14268"
- "14250"

# Collector
otel-collector:
image: otel/opentelemetry-collector:latest
command: ["--config=/etc/otel-collector-config.yaml", "${OTELCOL_ARGS}"]
volumes:
- ./otel-collector-config.yaml:/etc/otel-collector-config.yaml
ports:
- "1888:1888" # pprof extension
- "13133:13133" # health_check extension
- "4317:4317" # OTLP gRPC receiver
- "4318:4318" # OTLP HTTP receiver
- "55670:55679" # zpages extension
depends_on:
- jaeger-all-in-one


# metrics-rust:
# build:
# dockerfile: $PWD/Dockerfile
# context: ./basic-otlp-http
# environment:
# - OTLP_TONIC_ENDPOINT=otel-collector:4317
# depends_on:
# - otel-collector


35 changes: 35 additions & 0 deletions examples/basic-otlp/otel-collector-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
receivers:
otlp:
protocols:
http:
grpc:

exporters:
logging:
loglevel: debug

jaeger:
endpoint: jaeger-all-in-one:14250
insecure: true

processors:
batch:

extensions:
health_check:
pprof:
endpoint: :1888
zpages:
endpoint: :55679

service:
extensions: [pprof, zpages, health_check]
pipelines:
traces:
receivers: [otlp]
processors: [batch]
exporters: [logging, jaeger]
metrics:
receivers: [otlp]
processors: [batch]
exporters: [logging]
2 changes: 1 addition & 1 deletion examples/external-otlp-grpcio-async-std/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = "2018"
publish = false

[dependencies]
async-std = { version = "1.9.0", features = ["attributes"] }
async-std = { version = "= 1.8.0", features = ["attributes"] }
env_logger = "0.8.2"
opentelemetry = { path = "../../opentelemetry", features = ["rt-async-std"] }
opentelemetry-otlp = { path = "../../opentelemetry-otlp", features = [
Expand Down
1 change: 1 addition & 0 deletions opentelemetry-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ lazy_static = "1.4"
pin-project = { version = "1.0.2", optional = true }
thiserror = "1"
tokio-stream = { version = "0.1", optional = true }
indexmap = "1.8"

[package.metadata.docs.rs]
all-features = true
Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ analysis in order to understand your software's performance and behavior. You
can export and analyze them using [Prometheus], [Jaeger], and other
observability tools.

*Compiler support: [requires `rustc` 1.49+][msrv]*
*Compiler support: [requires `rustc` 1.55+][msrv]*

[Prometheus]: https://prometheus.io
[Jaeger]: https://www.jaegertracing.io
Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//! services to capture distributed traces and metrics from your application. You
//! can analyze them using [Prometheus], [Jaeger], and other observability tools.
//!
//! *Compiler support: [requires `rustc` 1.49+][msrv]*
//! *Compiler support: [requires `rustc` 1.55+][msrv]*
//!
//! [Prometheus]: https://prometheus.io
//! [Jaeger]: https://www.jaegertracing.io
Expand Down
2 changes: 2 additions & 0 deletions opentelemetry-api/src/trace/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,15 @@ use thiserror::Error;

mod context;
pub mod noop;
mod order_map;
mod span;
mod span_context;
mod tracer;
mod tracer_provider;

pub use self::{
context::{get_active_span, mark_span_as_active, FutureExt, SpanRef, TraceContextExt},
order_map::OrderMap,
span::{Span, SpanKind, Status},
span_context::{SpanContext, SpanId, TraceFlags, TraceId, TraceState},
tracer::{SamplingDecision, SamplingResult, SpanBuilder, Tracer},
Expand Down

0 comments on commit bda212e

Please sign in to comment.