-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Added Weaver configuration for all telemetry, and a generated mkdocs site #2794
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
Open
martinjt
wants to merge
22
commits into
open-telemetry:main
Choose a base branch
from
martinjt:weaver-docs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
c0a83ba
Added Weaver configuration for all telemetry, and a generated mkdocs …
martinjt 65f304f
Merge branch 'main' into weaver-docs
puckpuck 0df3535
fix redirect
puckpuck 12d0939
use TELEMETRY_DOCS_PORT
puckpuck ca4e9b5
Merge branch 'main' into weaver-docs
puckpuck aee9e31
add changelog entry
puckpuck 597a724
Merge branch 'weaver-docs' of https://github.com/martinjt/opentelemet…
puckpuck 18a38e8
cleanup lint errors
puckpuck e9e9ca7
more lint fixes
puckpuck 073243e
add telemetry-docs dependency
puckpuck 15f9fb0
Merge branch 'main' into weaver-docs
julianocosta89 9962860
Merge branch 'main' into weaver-docs
julianocosta89 968f368
Move docs to nginx, and cleanup k8s manifests
julianocosta89 080d9ba
Update README
julianocosta89 b4a0ceb
Fix sanity and markdownlint
julianocosta89 4337a67
Add telemetry docs to build images workflow
julianocosta89 099a946
Merge branch 'main' into weaver-docs
julianocosta89 e1ecc2d
Merge branch 'main' into weaver-docs
julianocosta89 3db8ea9
Merge branch 'main' into weaver-docs
julianocosta89 e0853c9
Merge branch 'main' into weaver-docs
julianocosta89 8816e3e
Merge branch 'main' into weaver-docs
julianocosta89 5abbcc5
Merge branch 'main' into weaver-docs
julianocosta89 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| node_modules | ||
| npm-debug.log | ||
| .git | ||
| .gitignore | ||
| .DS_Store | ||
| *.md | ||
| !mkdocs.yml | ||
| .env | ||
| .venv | ||
| __pycache__ | ||
| *.pyc | ||
| .pytest_cache | ||
| .coverage | ||
| htmlcov | ||
| dist | ||
| build | ||
| *.egg-info |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| # Copyright The OpenTelemetry Authors | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| # Two-stage build: Generate service-centric Markdown with Weaver, then serve with mkdocs | ||
|
|
||
| # Stage 1: Generate Markdown files from telemetry schema using Weaver | ||
| FROM docker.io/otel/weaver:v0.21.2 AS registry-builder | ||
|
|
||
| WORKDIR /workspace | ||
|
|
||
| # Copy the telemetry schema | ||
| COPY telemetry-schema /workspace/telemetry-schema | ||
|
|
||
| # Copy the Weaver templates | ||
| COPY src/telemetry-docs/templates /workspace/templates | ||
|
|
||
| # Generate service-centric pages and mkdocs.yml using Weaver | ||
| RUN /weaver/weaver registry generate \ | ||
| --registry=/workspace/telemetry-schema \ | ||
| --templates=/workspace/templates \ | ||
| markdown \ | ||
| /workspace/docs | ||
|
|
||
| # Generate fully resolved schema as JSON | ||
| RUN /weaver/weaver registry resolve \ | ||
| --registry=/workspace/telemetry-schema \ | ||
| --format=json \ | ||
| --output=/workspace/docs/schema.json | ||
|
|
||
| # Stage 2: Build static site | ||
| FROM python:3.14-slim-bookworm AS site-builder | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| RUN pip install --no-cache-dir mkdocs mkdocs-material | ||
|
|
||
| COPY src/telemetry-docs/mkdocs.yml /app/mkdocs-base.yml | ||
| COPY --from=registry-builder /workspace/docs /app/docs | ||
|
|
||
| RUN mv /app/docs/mkdocs.yml /app/mkdocs.yml && \ | ||
| mkdocs build --clean | ||
|
|
||
| # Stage 3: Serve with nginx (tiny!) | ||
| FROM docker.io/nginxinc/nginx-unprivileged:1.29-alpine3.23-otel | ||
|
|
||
| USER 101 | ||
|
|
||
| COPY --from=site-builder /app/site /static | ||
| COPY src/telemetry-docs/nginx.conf.template /nginx.conf.template | ||
|
|
||
| EXPOSE ${TELEMETRY_DOCS_PORT} | ||
|
|
||
| STOPSIGNAL SIGQUIT | ||
|
|
||
| # Start nginx | ||
| CMD ["/bin/sh" , "-c" , "envsubst '$OTEL_COLLECTOR_HOST $OTEL_COLLECTOR_PORT_GRPC $OTEL_SERVICE_NAME $TELEMETRY_DOCS_PORT' < /nginx.conf.template > /etc/nginx/nginx.conf && exec nginx -g 'daemon off;'"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| # Telemetry Documentation Service | ||
|
|
||
| This service generates and hosts comprehensive documentation for the | ||
| OpenTelemetry Demo's telemetry schema using | ||
| [OpenTelemetry Weaver](https://github.com/open-telemetry/weaver), | ||
| [MkDocs](https://www.mkdocs.org/), and | ||
| [nginx with OpenTelemetry instrumentation](https://github.com/nginxinc/nginx-otel). | ||
|
|
||
| ## Overview | ||
|
|
||
| The telemetry-docs service provides a web-based documentation interface that | ||
| documents all custom attributes and metrics used across the OpenTelemetry Demo | ||
| application. The documentation is automatically generated from the YAML schema | ||
| definitions in the `telemetry-schema/` directory and served as a static site | ||
| with full OpenTelemetry tracing. | ||
|
|
||
| ## Architecture | ||
|
|
||
| The service uses a **3-stage Docker build** for optimal performance and observability: | ||
|
|
||
| ### Stage 1: Schema Generation (Weaver) | ||
|
|
||
| - Uses the official `otel/weaver:v0.21.2` image | ||
| - Reads the telemetry schema from `/telemetry-schema` directory | ||
| - Generates service-centric Markdown documentation files | ||
| - Generates fully resolved schema as JSON | ||
|
|
||
| ### Stage 2: Static Site Build (MkDocs) | ||
|
|
||
| - Uses Python 3.14 slim-bookworm image | ||
| - Installs MkDocs and Material theme | ||
| - Builds static HTML site from generated Markdown | ||
| - Optimizes assets for production delivery | ||
|
|
||
| ### Stage 3: Production Server (nginx + OpenTelemetry) | ||
|
|
||
| - Uses `nginxinc/nginx-unprivileged:<version>-otel` | ||
| - Serves pre-built static site | ||
| - **Full OpenTelemetry instrumentation** with optimized configuration | ||
|
|
||
| ## OpenTelemetry Instrumentation | ||
|
|
||
| The service includes production-ready OpenTelemetry tracing with: | ||
|
|
||
| ### Batch Configuration | ||
|
|
||
| - **Interval**: 5s export frequency | ||
| - **Batch size**: 256 spans per batch (optimized for static content) | ||
| - **Batch count**: 2 pending batches per worker (reduced memory footprint) | ||
|
|
||
| ### Low-Cardinality Span Names | ||
|
|
||
| Implements route parameterization to avoid high cardinality: | ||
|
|
||
| - `/attributes/*.html` -> `GET /attributes/{business_domain}` | ||
| - `/services/*.html` -> `GET /services/{service_name}` | ||
| - `/index.html` -> `GET /index` | ||
| - `/` -> `GET /` | ||
|
|
||
| ### Tracing Exclusions | ||
|
|
||
| Static assets and health checks are excluded from tracing for **80-90% | ||
| span volume reduction**: | ||
|
|
||
| - Static files (CSS, JS, images, fonts) | ||
| - Search indexes | ||
| - Health check endpoint (`/status`) | ||
|
|
||
| This follows | ||
| [OpenTelemetry HTTP semantic conventions](https://opentelemetry.io/docs/specs/semconv/http/http-spans/) | ||
| for optimal observability. | ||
|
|
||
| ## Usage | ||
|
|
||
| ### Running the telemetry-docs service | ||
|
|
||
| The application can be run with the rest of the demo using the documented | ||
| [docker compose or make commands](https://opentelemetry.io/docs/demo/#running-the-demo). | ||
|
|
||
| ### Accessing the Documentation | ||
|
|
||
| Once the service is running, access the documentation at: | ||
| <http://localhost:8080/telemetry> | ||
|
|
||
| ### Building the telemetry-docs service | ||
|
|
||
| ```bash | ||
| docker compose build telemetry-docs | ||
| ``` | ||
|
|
||
| ## Configuration | ||
|
|
||
| ### Environment Variables | ||
|
|
||
| The service requires the following environment variables: | ||
|
|
||
| - `TELEMETRY_DOCS_PORT` - Port for the nginx server (default: 8000) | ||
| - `OTEL_COLLECTOR_HOST` - OpenTelemetry Collector hostname | ||
| - `OTEL_COLLECTOR_PORT_GRPC` - OTel Collector gRPC port (default: 4317) | ||
| - `OTEL_SERVICE_NAME` - Service name for telemetry (default: `telemetry-docs`) | ||
|
|
||
| ### nginx Configuration | ||
|
|
||
| The service uses a templated nginx configuration (`nginx.conf.template`) with | ||
| environment variable substitution. Key features: | ||
|
|
||
| - **Static file serving** from `/static` directory | ||
| - **OpenTelemetry module** for distributed tracing | ||
| - **Cache headers** for static assets (1 year expiry) | ||
| - **Health check endpoint** at `/status` (excluded from tracing) | ||
| - **gzip compression** for efficient content delivery | ||
|
|
||
| ## References | ||
|
|
||
| - [OpenTelemetry Weaver](https://github.com/open-telemetry/weaver) | ||
| - [nginx OpenTelemetry Module](https://github.com/nginxinc/nginx-otel) | ||
| - [OpenTelemetry HTTP Semantic Conventions](https://opentelemetry.io/docs/specs/semconv/http/http-spans/) | ||
| - [MkDocs Documentation](https://www.mkdocs.org/) | ||
| - [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| # Copyright The OpenTelemetry Authors | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| site_name: OpenTelemetry Demo Telemetry Schema | ||
| site_description: Semantic conventions and telemetry schema for the OpenTelemetry Demo application | ||
| site_author: OpenTelemetry Demo Contributors | ||
| site_url: https://opentelemetry-demo.example.com/telemetry/ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we change this to |
||
|
|
||
| theme: | ||
| name: material | ||
| palette: | ||
| - scheme: default | ||
| primary: indigo | ||
| accent: indigo | ||
| toggle: | ||
| icon: material/brightness-7 | ||
| name: Switch to dark mode | ||
| - scheme: slate | ||
| primary: indigo | ||
| accent: indigo | ||
| toggle: | ||
| icon: material/brightness-4 | ||
| name: Switch to light mode | ||
| features: | ||
| - navigation.instant | ||
| - navigation.tracking | ||
| - navigation.tabs | ||
| - navigation.sections | ||
| - navigation.expand | ||
| - toc.follow | ||
| - content.code.copy | ||
|
|
||
| plugins: | ||
| - search | ||
| - offline | ||
|
|
||
| markdown_extensions: | ||
| - pymdownx.highlight: | ||
| use_pygments: true | ||
| - pymdownx.superfences | ||
| - pymdownx.tabbed: | ||
| alternate_style: true | ||
| - pymdownx.details | ||
| - pymdownx.tasklist: | ||
| custom_checkbox: true | ||
| - tables | ||
| - toc: | ||
| permalink: true | ||
| - admonition | ||
| - attr_list | ||
|
|
||
| extra: | ||
| version: 1.0.0 | ||
| social: | ||
| - icon: fontawesome/brands/github | ||
| link: https://github.com/open-telemetry/opentelemetry-demo | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the envoy template is shared with minimal docker compose. We should add these in minimal compose or the envoy template will fail to resolve
${TELEMETRY_DOCS_HOST}and${TELEMETRY_DOCS_PORT}.