OpenTelemetry Astronomy Shop Demo

repository·main·Indexed 23 days ago

https://github.com/open-telemetry/opentelemetry-demo

A microservice-based distributed system designed to demonstrate OpenTelemetry instrumentation, observability, and vendor integrations. The demo includes various services such as the Accounting, Ad, Agent, Cart, and Chatbot services, providing a realistic environment for testing OpenTelemetry APIs, SDKs, and OTLP exports across different languages and frameworks.

Tokens
36.2K
Snippets
135
Records
285
Agent score
84%

What's inside opentelemetry-demo

  1. Overview of the MCP Service

    main

    The MCP service exposes the OpenTelemetry Astronomy Shop demo's tools via the Model Context Protocol. It uses the FastMCP framework to allow MCP-compatible clients (like the agent service) to discover and invoke shop operations such as listing products, managing carts, and checking out.

    Technical Specifications:

    • Runtime: Python 3.14
    • Framework: FastMCP
    • Transport: HTTP streamable transport at /mcp
    • Default Port: 8011
    • Observability: Traceloop SDK and OpenTelemetry OTLP export with httpx auto-instrumentation.
  2. Overview of the OpAMP Server service

    main

    The OpAMP Server service runs the Go reference OpAMP server from open-telemetry/opamp-go. It acts as a control plane for the OpenTelemetry Collector.

    Key capabilities include:

    • Allowing the OpenTelemetry Collector to connect via the opampextension.
    • Reporting Collector health status, version, attributes, and effective configuration to the server.
    • Providing a minimal HTML UI for managing the control plane.

    In this demo environment, the UI is accessible via the frontend proxy at /opamp/.

  3. Overview of the Chatbot Service

    main

    The Chatbot service provides a browser-based chat UI for the OpenTelemetry Astronomy Shop demo using the Gradio framework. It acts as a client that forwards user messages to an Agent service.

    Key Specifications:

    • Runtime: Python 3.14
    • UI Framework: Gradio
    • HTTP Client: Requests
    • Observability: OpenTelemetry traces exported via OTLP/gRPC
    • Default Port: 7860 (exposed via proxy at http://localhost:8080/chatbot/)
  4. Overview of the OpenTelemetry Astronomy Shop Demo

    main

    The OpenTelemetry Astronomy Shop is a microservice-based distributed system designed to:

    • Provide a realistic example of a distributed system for demonstrating OpenTelemetry instrumentation and observability.
    • Serve as a base for vendors and tooling authors to extend and demonstrate OpenTelemetry integrations.
    • Act as a living example for OpenTelemetry contributors to test new versions of APIs, SDKs, and other components.
  5. Understand the OpenTelemetry Demo Telemetry Schema structure

    main

    The OpenTelemetry Demo Telemetry Schema serves as the single source of truth for all custom telemetry used across the demo services. It defines all custom attributes and metrics to ensure naming consistency and to enable validation of instrumentation code. The schema is organized into three main directories:

    • attributes/: Contains attribute definitions organized by business domain (e.g., ad, cart, exchange, feature flag, order, payment, product, recommendation, request, shipping, user).
    • services/: Contains service-specific attribute references, with one file per service.
    • metrics/: Contains metric definitions, with one file per service that produces metrics.
  6. Understand telemetry-docs architecture and instrumentation

    main

    The service uses a 3-stage Docker build process:

    1. Schema Generation (Weaver): Uses otel/weaver:v0.21.2 to generate Markdown and JSON from YAML schemas in /telemetry-schema.
    2. Static Site Build (MkDocs): Uses Python 3.14 and MkDocs with the Material theme to build the HTML site.
    3. Production Server (nginx + OpenTelemetry): Uses nginxinc/nginx-unprivileged:<version>-otel to serve the site with full OpenTelemetry tracing.

    Instrumentation Details

    • Batch Configuration: Export frequency is 5s, batch size is 256 spans, and batch count is 2 pending batches per worker.
    • Low-Cardinality Span Names: Routes are parameterized (e.g., /attributes/{business_domain}) to prevent high cardinality.
    • Tracing Exclusions: To reduce span volume by 80-90%, the following are excluded from tracing:
      • Static files (CSS, JS, images, fonts)
      • Search indexes
      • Health check endpoint (/status)
  7. Build and run the React Native app on Android

    main

    To run the app on Android, you must first install dependencies. The npm run android command compiles the app, deploys it to a running Android simulator or connected device, and starts the JS Bundle server.

    Prerequisites:

    • Local Android development environment setup.
    • Run npm install inside src/react-native-app first.
    cd src/react-native-app
    npm install
    npm run android
  8. Build and run the React Native app on iOS

    main

    To run the app on iOS, you must first install dependencies. The iOS build uses the Ruby version in .ruby-version and Bundler for CocoaPods. Ensure ruby --version matches .ruby-version before proceeding.

    Prerequisites:

    • Local iOS development environment setup.
    • Run bundle install inside src/react-native-app first.
    • Run npm install inside src/react-native-app first.
    cd src/react-native-app
    npm install
    bundle install
    npm run ios