diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4779b29d8d..7b65d96140 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,7 +68,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.55.0 + toolchain: 1.59.0 override: true - name: Run tests run: cargo --version && diff --git a/examples/basic-otlp-http/README.md b/examples/basic-otlp-http/README.md index cca9f222d3..098c2e5bf0 100644 --- a/examples/basic-otlp-http/README.md +++ b/examples/basic-otlp-http/README.md @@ -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 diff --git a/examples/basic-otlp-http/docker-compose.yaml b/examples/basic-otlp-http/docker-compose.yaml index 0cbc679348..cd81583921 100644 --- a/examples/basic-otlp-http/docker-compose.yaml +++ b/examples/basic-otlp-http/docker-compose.yaml @@ -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: diff --git a/examples/basic-otlp/Dockerfile b/examples/basic-otlp/Dockerfile new file mode 100644 index 0000000000..b63241e283 --- /dev/null +++ b/examples/basic-otlp/Dockerfile @@ -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"] diff --git a/examples/basic-otlp/README.md b/examples/basic-otlp/README.md index 3c463b524a..d1b71a1228 100644 --- a/examples/basic-otlp/README.md +++ b/examples/basic-otlp/README.md @@ -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 @@ -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 -``` \ No newline at end of file +``` + + diff --git a/examples/basic-otlp/docker-compose.yaml b/examples/basic-otlp/docker-compose.yaml new file mode 100644 index 0000000000..cd81583921 --- /dev/null +++ b/examples/basic-otlp/docker-compose.yaml @@ -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 + + diff --git a/examples/basic-otlp/otel-collector-config.yaml b/examples/basic-otlp/otel-collector-config.yaml new file mode 100644 index 0000000000..1a822eee79 --- /dev/null +++ b/examples/basic-otlp/otel-collector-config.yaml @@ -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]