diff --git a/.circleci/config.yml b/.circleci/config.yml index 91a6f0051aae..20decdbc2779 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -66,6 +66,12 @@ workflows: filters: tags: only: /.*/ + - build-examples-tracing: + requires: + - setup-and-lint + filters: + tags: + only: /.*/ - cross-compile: requires: - build @@ -140,6 +146,16 @@ jobs: root: ~/ paths: project/bin + build-examples-tracing: + docker: + - image: cimg/go:1.14 + steps: + - attach_to_workspace + - setup_remote_docker + - run: + name: Build trace example + command: docker-compose -f examples/tracing/docker-compose.yml build + cross-compile: executor: golang parallelism: 4 diff --git a/cmd/otelcontribcol/Dockerfile b/cmd/otelcontribcol/Dockerfile index a519d8304992..0deaac7d25b1 100644 --- a/cmd/otelcontribcol/Dockerfile +++ b/cmd/otelcontribcol/Dockerfile @@ -5,4 +5,4 @@ FROM scratch COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt COPY otelcontribcol / ENTRYPOINT ["/otelcontribcol"] -EXPOSE 55678 55679 +EXPOSE 55680 55679 diff --git a/examples/tracing/Dockerfile b/examples/tracing/Dockerfile new file mode 100644 index 000000000000..fc7b73d7cb6c --- /dev/null +++ b/examples/tracing/Dockerfile @@ -0,0 +1,15 @@ +FROM golang:1.14 AS build + +WORKDIR /src +ADD . /src + +RUN make otelcontribcol + +FROM alpine:latest as certs +RUN apk --update add ca-certificates + +FROM scratch +COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt +COPY --from=build /src/bin/otelcontribcol_linux_amd64 /otelcontribcol +ENTRYPOINT ["/otelcontribcol"] +EXPOSE 55680 55679 diff --git a/examples/tracing/README.md b/examples/tracing/README.md new file mode 100644 index 000000000000..416df2b40e63 --- /dev/null +++ b/examples/tracing/README.md @@ -0,0 +1,11 @@ +# OpenTelemetry Collector Demo + +This demo is a sample app to build the collector and exercise its tracing functionality. + +To build and run the demo, switch to this directory and run + +`docker-compose up` + +Hit `http://localhost:8081` in your browser or using something like cURL, and then open +up `http://localhost:9411` or `http://localhost:16686` to search for the traces in the +Zipkin or Jaeger UIs. \ No newline at end of file diff --git a/examples/tracing/docker-compose.yml b/examples/tracing/docker-compose.yml new file mode 100644 index 000000000000..e84a849ab83e --- /dev/null +++ b/examples/tracing/docker-compose.yml @@ -0,0 +1,56 @@ +version: "3" +services: + # Jaeger + jaeger: + image: jaegertracing/all-in-one:latest + ports: + - "16686:16686" + - "14268" + - "14250" + + #Zipkin + zipkin: + image: openzipkin/zipkin + container_name: zipkin + ports: + - 9411:9411 + + otel-collector: + build: + context: ../.. + dockerfile: examples/tracing/Dockerfile + command: ["--config=/etc/otel-collector-config.yml"] + volumes: + - ./otel-collector-config.yml:/etc/otel-collector-config.yml + ports: + - "1888:1888" # pprof extension + - "8888:8888" # Prometheus metrics exposed by the collector + - "8889:8889" # Prometheus exporter metrics + - "13133:13133" # health_check extension + - "9411" # Zipkin receiver + - "55680:55679" # zpages extension + depends_on: + - jaeger + - zipkin + + # Expose the frontend on http://localhost:8081 + frontend: + image: openzipkin/example-sleuth-webmvc + command: Frontend + environment: + JAVA_OPTS: -Dspring.zipkin.baseUrl=http://otel-collector:9411 + ports: + - 8081:8081 + depends_on: + - otel-collector + + # Expose the backend on http://localhost:9000 + backend: + image: openzipkin/example-sleuth-webmvc + command: Backend + environment: + JAVA_OPTS: -Dspring.zipkin.baseUrl=http://otel-collector:9411 + ports: + - 9000:9000 + depends_on: + - otel-collector diff --git a/examples/tracing/otel-collector-config.yml b/examples/tracing/otel-collector-config.yml new file mode 100644 index 000000000000..973566b4a15e --- /dev/null +++ b/examples/tracing/otel-collector-config.yml @@ -0,0 +1,34 @@ +receivers: + otlp: + endpoint: 0.0.0.0:55680 + zipkin: + endpoint: 0.0.0.0:9411 + +exporters: + logging: + + zipkin: + url: "http://zipkin:9411/api/v2/spans" + format: proto + + jaeger_thrift: + url: "http://jaeger:14268/api/traces" + +processors: + batch: + queued_retry: + +extensions: + health_check: + pprof: + endpoint: :1888 + zpages: + endpoint: :55679 + +service: + extensions: [pprof, zpages, health_check] + pipelines: + traces: + receivers: [otlp, zipkin] + exporters: [zipkin, jaeger_thrift, logging] + processors: [batch, queued_retry]