Skip to content
base-14Public

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

2 watching

Forks

Repository files navigation

OpenTelemetry Integration Examples

OpenTelemetry instrumentation examples for applications and components, sending telemetry to base14 Scout.

Available Examples

Node.js

Framework Stack Example Features
Express 5 Express 5 + TypeScript + PostgreSQL 18 express5-postgres BullMQ jobs, WebSockets, auto-instrumentation
NestJS NestJS + TypeScript + PostgreSQL 18 nestjs-postgres Enterprise architecture, BullMQ, WebSockets
Next.js Next.js 16 + TypeScript + MongoDB nextjs-api-mongodb BullMQ jobs, Mongoose, auto-instrumentation
Angular Angular 22 (zoneless) + Express 5 + PostgreSQL 18 angular-fullstack-otel Browser SDK (traces, metrics, logs), Core Web Vitals, trace propagation browser to DB
Fastify Fastify 5 + TypeScript + PostgreSQL 18 fastify-postgres Drizzle ORM, BullMQ jobs, Pino logging
tRPC tRPC 11 + TypeScript 6 + Prisma 7 + PostgreSQL 18 trpc-postgres OTel Node SDK, distributed tracing, tRPC-to-REST bridge
Express (Legacy) Express + TypeScript + MongoDB express-typescript-mongodb MongoDB integration, Redis
AI Contract Analyzer Bun + Hono + Vercel AI SDK ai-contract-analyzer GenAI observability, OpenLLMetry, multi-provider
AI Learning Path Planner Node.js 26 + Hono 4 + Vercel AI SDK 7 or Mastra 1 + Ollama ai-learning-path-planner Lead agent with researcher subagents, fan-out cost per run, deferred vs full tool catalogue

Python

Framework Stack Example Features
Django Django 5 LTS + PostgreSQL 18 django-postgres Celery jobs, PII masking, auto-instrumentation
Flask Flask 3 + PostgreSQL 18 flask-postgres Celery jobs, SQLAlchemy, auto-instrumentation
FastAPI FastAPI + PostgreSQL fastapi-postgres JWT auth, auto-instrumentation
FastAPI + Celery FastAPI + Celery + PostgreSQL fastapi-celery-postgres Distributed tracing across async tasks
Litestar Litestar 2.21 + PostgreSQL 18 (uv) litestar-postgres Two-service distributed tracing, async SQLAlchemy + asyncpg, notification microservice
AI Sales Intelligence FastAPI + LangChain + OpenAI ai-sales-intelligence GenAI observability, unified tracing
AI Content Quality FastAPI + LlamaIndex + Promptfoo ai-content-quality Eval-driven development, structured output
AI Runbook Assistant FastAPI + LangChain/LangGraph + pgvector ai-runbook-assistant Custom LangChain callback handler vs auto-instrumentation, GenAI semconv, token/cost metrics
Durable KYC Onboarding Agent FastAPI + Pydantic AI 2.49 + Temporal 1.33 + Ollama ai-kyc-onboarding Durable agent runs, human review waits as spans, log to trace correlation, application metrics, four injected failure types
Filing Analyst Agent FastAPI + Strands Agents 1.57 + Ollama ai-filing-analyst Agent as a tool, grounded answers checked by a verifier span, log to trace correlation, application metrics, eight injected failure types

Go

Framework Stack Example Features
Echo Echo 4 + GORM + PostgreSQL 18 echo-postgres Asynq jobs, GORM service pattern
Fiber Fiber 2 + sqlx + PostgreSQL 18 fiber-postgres River jobs (PostgreSQL-native), repository pattern
Echo + Temporal Echo 4 + Temporal + PostgreSQL 18 go-temporal-postgres Workflow orchestration, microservice workers, simulation framework
Chi Chi + In-memory storage chi-inmemory Custom instrumentation
stdlib net/http Go 1.27 stdlib + pgx + PostgreSQL 18 stdlib-postgres otelhttp + otelpgx, otelslog bridge, two-service distributed tracing
Gin (Legacy) Gin 1.9.1 + PostgreSQL 14 go119-gin191-postgres Legacy Go 1.19 support
AI Data Analyst Chi + Direct OpenAI API + Native OTel SDK ai-data-analyst NL-to-SQL pipeline, GenAI observability, multi-provider

Java

Framework Stack Example Features
Quarkus Quarkus 3 + Java 25 + PostgreSQL 18 quarkus-postgres Built-in OTEL, native compilation, JWT auth
Spring Boot Spring Boot 3 + Java 17 + MySQL spring-boot-java17-mysql Auto-instrumentation
Spring Boot Spring Boot 3 + Java 25 + PostgreSQL spring-boot-java25-postgresql SDK Integration
Spring Boot Spring Boot 3 + Java 25 + MongoDB spring-boot-java25-mongodb-java-agent Java Agent
Micronaut Micronaut 4.8 + Java 25 + PostgreSQL 18 micronaut-postgres OTel Java Agent, distributed tracing, notification microservice
AI Customer Support Spring Boot 4 + Spring AI 2.0 + Java 25 + pgvector ai-customer-support GenAI observability, RAG, tool calling, multi-provider

Kotlin

Framework Stack Example Features
Ktor Ktor 3.2 + Kotlin 2.2 + PostgreSQL 18 ktor-postgres OTel Java Agent, Exposed ORM, distributed tracing, notification microservice

Ruby

Framework Stack Example Features
Rails 8 Rails 8 + SQLite rails8-sqlite OIDC auth, auto-instrumentation
Rails 6.1 (Legacy) Rails 6.1 + Ruby 3.0 + MySQL 8 ruby30-rails61-mysql Pinned OTel gems, custom spans, log correlation
Rails 5 (Legacy) Rails 5.2 + Ruby 2.7 + MySQL 8 ruby27-rails52-mysql8 Scout APM integration
Puma Metrics Puma + yabeda-prometheus + OTel Collector puma-metrics Puma runtime metrics via Prometheus scrape, framework-agnostic

PHP

Framework Stack Example Features
Laravel 8 (Legacy) Laravel 8 + PHP 8 + SQLite php8-laravel8-sqlite JWT auth, auto-instrumentation
Laravel 13 Laravel 13 + PHP 8.5 + PostgreSQL 18 php85-laravel13-postgres JWT auth, auto-instrumentation
Slim 4 Slim 4 + PHP 8.4 + MongoDB 8 php84-slim4-mongodb Auto-slim HTTP spans, MongoDB, log correlation
Slim 3 (Legacy) Slim 3 + PHP 8.4 + MongoDB 8 php84-slim3-mongodb Manual TelemetryMiddleware, MongoDB, log correlation
Symfony 8 Symfony 8 + PHP 8.5 + MySQL 9 symfony-mysql Doctrine ORM, distributed tracing, notification microservice

Elixir

Framework Stack Example Features
Phoenix Phoenix 1.8 + Ecto 3 + PostgreSQL 18 phoenix18-ecto3-postgres LiveView, real-time chat, auto-instrumentation

Rust

Framework Stack Example Features
Axum Axum + SQLx + PostgreSQL 18 axum-postgres JWT auth, PostgreSQL-native job queue, custom spans
AI Report Generator Axum + async-openai + PostgreSQL ai-report-generator GenAI observability, economic report pipeline, multi-provider

C#

Framework Stack Example Features
ASP.NET Core .NET 10 + EF Core + Azure SQL Edge dotnet-sqlserver Minimal APIs, rate limiting, auto-instrumentation
ASP.NET Core zero-code .NET 8.0.22 + Microsoft.Data.SqlClient + Azure SQL Edge dotnet8-sqlserver-hello OpenTelemetry.AutoInstrumentation 1.17.0, no telemetry code, env-var configuration
.NET Aspire .NET Aspire 13.2 + ASP.NET Core 10 + EF Core 10 + PostgreSQL 18 aspire-postgres ServiceDefaults pattern, custom ActivitySource and Meter, two-service distributed tracing, Aspire and Compose run modes
Approval-Gated Agent .NET 10 + Microsoft Agent Framework 1.23 + MCP 2.2 + PostgreSQL 18 agent-rebooking Agent handoff, in-process MCP client and server, human approval as spans and a histogram, six-scenario error matrix

Infrastructure & Integrations

Component Purpose Example Documentation
Scout Collector OpenTelemetry Collector scout-collector Guide
AWS CloudWatch CloudWatch log streaming aws-cloudwatch-stream -
Load Generator Load testing with OTEL loadgen README

Component Rigs

Compose rigs under components/ that run a piece of software you operate, collect its telemetry with the Collector and send it to Scout.

Component Collected with Rig Documentation
OpenClaw diagnostics-otel plugin, OTLP traces, metrics and logs openclaw-telemetry Guide
Claude Code Built-in telemetry set by environment variables, OTLP traces, metrics and logs, for the CLI and the Claude Agent SDK claude-code-telemetry Guide
Codex CLI Built-in [otel] config, OTLP traces, metrics and logs codex-telemetry Guide
SQL Server sqlserverreceiver sqlserver-telemetry Guide
SNMP devices snmpreceiver snmp-telemetry Guide
Azure AKS OpenTelemetry Operator azure-aks-operator-telemetry Guide

Mobile Applications

Platform Example
Mobile Demo astronomy_shop_mobile

IoT & Edge

Local-first examples for device and edge instrumentation (MQTT, OPC-UA, Sparkplug B, ESP32). See iot/ for the phase-by-phase progression.

Phase Example Status
Track overview iot Scaffolding
1 — MQTT trace propagation iot/mqtt-trace-propagation Available

Quick Start

1. Choose Your Framework

Navigate to the framework directory that matches your stack:

# Node.js
cd nodejs/express5-postgres              # Express 5 + PostgreSQL + BullMQ
cd nodejs/nestjs-postgres                # NestJS + PostgreSQL + BullMQ
cd nodejs/trpc-postgres                  # tRPC + Prisma + PostgreSQL

# Python
cd python/django-postgres                # Django + PostgreSQL + Celery
cd python/flask-postgres                 # Flask + PostgreSQL + Celery

# Go
cd go/echo-postgres                      # Echo + GORM + Asynq
cd go/fiber-postgres                     # Fiber + sqlx + River

# Java
cd java/quarkus-postgres                 # Quarkus + PostgreSQL

# Kotlin
cd kotlin/ktor-postgres                  # Ktor + Exposed + PostgreSQL

2. Follow Framework-Specific README

Each example includes:

  • Prerequisites and setup instructions
  • OpenTelemetry configuration
  • Docker Compose setup for local development
  • API endpoints and usage examples
  • Troubleshooting guides

3. Configure Scout Connection

All examples require an OpenTelemetry Collector endpoint. See the Collector Setup Guide for configuration options.

What's Instrumented?

All examples demonstrate:

  • ✅ Distributed Tracing - Request flows across services
  • ✅ Metrics Collection - Application and infrastructure metrics
  • ✅ Structured Logging - Correlated logs with trace context
  • ✅ Resource Attributes - Service identification and metadata

Framework Highlights

Express 5

Modern Express REST API with TypeScript, WebSocket support, and background job processing with BullMQ. Demonstrates comprehensive auto-instrumentation and trace propagation across HTTP → Queue → Worker flows.

View README →

NestJS

Enterprise-grade architecture with dependency injection, background jobs, and WebSocket gateway. Full OpenTelemetry integration including queue depth metrics and distributed tracing.

View README →

Next.js

Modern Next.js 16 REST API with App Router, MongoDB, and BullMQ background jobs. Demonstrates auto-instrumentation with Turbopack and trace propagation across HTTP → Queue → Worker flows.

View README →

Django

Django LTS framework with Celery background tasks and PII masking at collector level. Comprehensive auto-instrumentation showing distributed tracing across app and worker processes.

View README →

Go Echo (GORM Pattern)

Demonstrates GORM ORM with service layer pattern, Asynq job queue, and type-safe database operations with auto-migrations. View README →

Go Fiber (Repository Pattern)

Shows repository pattern with raw SQL via sqlx, River PostgreSQL-native job queue (no Redis), and fine-grained SQL control for performance optimization. View README →

Go Temporal (Workflow Orchestration)

Demonstrates Temporal workflow orchestration with microservice workers for order fulfillment. Features fraud detection, inventory management, payment processing, and configurable failure simulation for testing.

View README →

Fastify

High-performance Fastify 5 REST API with TypeScript, Drizzle ORM for type-safe SQL, and BullMQ background jobs. Demonstrates Pino structured logging and full trace propagation across HTTP → Queue → Worker flows.

View README →

Micronaut

Compile-time DI framework with OTel Java Agent for zero-code HTTP, JDBC, and Netty instrumentation. Distributed tracing across app and notification microservice with structured JSON logging and custom metrics.

View README →

tRPC

Type-safe API layer with tRPC 11 procedures bridged to REST endpoints via createCallerFactory. Prisma 7 with adapter pattern for PostgreSQL, OTel Node SDK with auto-instrumentation for HTTP, Prisma, and Pino log bridging.

View README →

Ktor

Kotlin-idiomatic web framework with Exposed ORM for DSL-style database access and OTel Java Agent for zero-code instrumentation. Distributed tracing across app and notification microservice with Flyway migrations and structured JSON logging.

View README →

Quarkus

Supersonic startup times with native compilation support, built-in OpenTelemetry extension, and production-ready synchronous REST API pattern. View README →

Rust Axum

Async Rust web API with Axum, SQLx, and a PostgreSQL-native job queue using SKIP LOCKED. Full OpenTelemetry instrumentation with custom business metric spans and trace context propagation to background jobs.

View README →

ASP.NET Core

.NET 10 Minimal APIs with Entity Framework Core, Azure SQL Edge, and built-in rate limiting. SQL Server-native job queue with READPAST pattern and comprehensive OpenTelemetry instrumentation.

View README →

ASP.NET Core zero-code

Hello-world Minimal API on .NET 8.0.22 writing greetings to Azure SQL Edge through Microsoft.Data.SqlClient. No OpenTelemetry code; the OpenTelemetry.AutoInstrumentation 1.17.0 NuGet package and OTEL_ environment variables produce traces, metrics and correlated logs.

View README →

.NET Aspire

.NET Aspire 13.2 AppHost orchestrating PostgreSQL 18, an OTel Collector container, and two ASP.NET Core 10 services (articles API and notify). ServiceDefaults wires OTel for every project; custom ActivitySource and Meter demonstrate business-level instrumentation. Ships parallel Aspire AppHost and Docker Compose run modes from the same code.

View README →

Approval-Gated Rebooking Agent

Travel disruption agent on .NET 10 and Microsoft Agent Framework 1.23. A triage agent hands off to a rebooking agent, tools come from an in-process MCP server, and a rebooking over a price limit waits for a human before it runs. One trace covers the handoff, the MCP client and server, the Postgres queries and the approval; the approval wait is two short linked spans plus a histogram. Ships a six-scenario error matrix showing where each failure lands.

View README → · Guide

AI Learning Path Planner

Node.js 26 and Vercel AI SDK 7 on local Ollama models. A lead agent breaks a topic into subtopics and calls one researcher subagent per subtopic over base14's own docs and examples corpus, and every step of the finished plan cites a corpus path. Records a cost per run under fan-out and the token cost of the tool definitions each agent carries, so the deferred and full tool catalogues can be compared on the same request. PLANNER_FRAMEWORK=mastra runs the same agents on Mastra 1 through @mastra/otel-bridge.

View README → · Guide · Mastra guide

Go stdlib net/http

Two-service Go example using only the standard library net/http plus pgx for PostgreSQL 18. otelhttp + otelpgx + the otelslog bridge produce HTTP server spans, DB query spans, and trace-correlated JSON logs without any framework dependencies. Cross-service distributed tracing from articles API to notify microservice.

View README →

Litestar

Async Python web framework (Litestar 2.21 on Python 3.14, uv-managed) with SQLAlchemy + asyncpg and a notification microservice. Distributed tracing via the Litestar OTel plugin, trace-correlated JSON logs through python-json-logger, and custom metrics via OTel Meter API.

View README →

AI Runbook Assistant

SRE incident-diagnosis agent (LangChain 1.x create_agent on LangGraph, pgvector RAG, tool calling) with two interchangeable instrumentation modes: a hand-written OTel callback handler emitting GenAI semantic conventions, and zero-code OpenLLMetry. HTTP, agent, LLM, tool, vector search, and the database write land in one trace, alongside gen_ai.client.* metrics and trace-correlated logs.

View README →

Durable KYC Onboarding Agent

KYC onboarding agent on Pydantic AI and Temporal, with local Ollama models. One agent extracts document fields and a second decides to approve, ask for a document again, or escalate to a human reviewer. Each case is one trace that survives worker restarts, with spans for the waits on the applicant and the reviewer, links from each arrival back to the request that sent it, and case logs on the spans they were written under. Ships eleven scenarios, including a worker crash, a model outage, a sanctions service outage, a budget cap and bad model output.

View README →

Filing Analyst Agent

Filing analyst on Strands Agents over the SEC's XBRL APIs, with local Ollama models. An analyst agent answers questions about a company's reported financials, and a second agent, attached as a tool, ranks the company among every filer of a concept. Every figure is cited by the accession number of the filing it came from and checked by a verifier before the answer is served. Each question is one trace with its logs on the spans they were written under. Ships seventeen scenarios, including SEC outages and throttling, a model outage, a timeout, a budget cap, bad model output and an ungrounded answer.

View README →

Symfony

Symfony 8.0 articles API with Doctrine ORM, MySQL, and a notification microservice. Distributed tracing with W3C trace propagation across services, structured JSON logging with trace-log correlation, and custom business metrics via OTel Meter API.

View README →

Adding New Examples

Each framework example should follow this structure:

framework-name/
├── README.md              # Setup instructions, prerequisites, troubleshooting
├── compose.yaml           # Docker Compose for local development
├── Dockerfile             # Container configuration
├── config/
│   └── otel-config.yml   # OpenTelemetry Collector config (if needed)
└── src/                  # Application source code

Include in your README:

  • Quick start guide with Docker commands
  • Environment variables and configuration
  • API endpoints or usage examples
  • Link to Base14 App Instrumentation docs

Resources

Base14 Documentation

OpenTelemetry

License

See LICENSE for details.

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages