Production-ready examples for instrumenting applications with OpenTelemetry and sending telemetry data (traces, metrics, and logs) to Last9 or any OTLP-compatible observability platform.
Getting OpenTelemetry instrumentation right can be tricky. This repository provides:
- Copy-paste ready examples - Each example is a complete, working application
- Real-world patterns - Covers HTTP servers, databases, message queues, external APIs, and more
- Multiple languages - Go, Python, JavaScript/Node.js, Ruby, Java, PHP, .NET, and Elixir
- Cloud-native deployments - AWS (ECS, Lambda, EC2), GCP (Cloud Run), Kubernetes
- Collector configurations - Ready-to-use OTel Collector configs for various use cases
-
Get your OTLP credentials from Last9 (or use any OTLP-compatible backend)
-
Set environment variables:
export OTEL_EXPORTER_OTLP_ENDPOINT="https://otlp.last9.io" export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Basic <YOUR_AUTH_TOKEN>"
-
Browse the language directories below and follow the README in each example
| Framework | Description | Signals |
|---|---|---|
| Gin | Web framework with middleware instrumentation | Traces, Metrics |
| Gin + Redis | Gin with Redis client tracing | Traces, Metrics |
| Chi | Lightweight router instrumentation | Traces, Metrics |
| Gorilla Mux | Classic router with OTel middleware | Traces |
| net/http | Standard library HTTP server | Traces |
| FastHTTP | High-performance HTTP framework | Traces |
| Beego | Full-featured web framework | Traces |
| Iris | Fast web framework | Traces |
| gRPC | gRPC server and client instrumentation | Traces |
| gRPC-Gateway | REST to gRPC gateway with tracing | Traces |
| Kafka (Sarama) | Kafka producer/consumer with Sarama | Traces |
| Kafka (Confluent) | Kafka with Confluent client | Traces |
| SQLX | SQL database instrumentation | Traces |
| PGX | PostgreSQL driver tracing | Traces |
| eBPF | eBPF-based instrumentation | Traces |
| Framework | Description | Signals |
|---|---|---|
| FastAPI | Modern async API framework | Traces, Metrics |
| FastAPI + Uvicorn | Production ASGI deployment | Traces, Metrics |
| Flask | Lightweight WSGI framework | Traces |
| Django | Full-featured web framework | Traces |
| Sanic | Async web framework | Traces |
| GCP Cloud Functions | Serverless function instrumentation | Traces |
| Framework | Description | Signals |
|---|---|---|
| Express | Classic Node.js framework (JS & TS) | Traces, Metrics |
| Fastify | Fast and low overhead framework | Traces |
| NestJS | Enterprise Node.js framework | Traces |
| Next.js | React framework with SSR | Traces |
| Koa | Expressive middleware framework | Traces |
| Hono | Ultrafast web framework | Traces |
| Polka | Micro web server | Traces |
| GraphQL | GraphQL server instrumentation | Traces |
| Sails | MVC framework | Traces |
| Winston | Logging library integration | Logs |
| Cloudflare Workers | Edge runtime with itty-router | Traces |
| Framework | Description | Signals |
|---|---|---|
| Rails API | Modern Rails API-only app | Traces |
| Rails 5.2 | Legacy Rails support | Traces |
| Sinatra | Lightweight DSL framework | Traces |
| Roda | Routing tree framework | Traces |
| Karafka | Kafka for Ruby | Traces |
| File Logs | Log file collection | Logs |
| Framework | Description | Signals |
|---|---|---|
| Spring Boot | Popular Java framework | Traces, Metrics |
| Tomcat | Servlet container | Traces |
| Framework | Description | Signals |
|---|---|---|
| Laravel | Popular PHP framework | Traces |
| WordPress Plugin | WordPress instrumentation | Traces |
| Core PHP 7.3 | Vanilla PHP instrumentation | Traces |
| Core PHP 8 | Modern PHP instrumentation | Traces |
| Directory | Language | Framework | Description |
|---|---|---|---|
dotnet/ |
.NET | ASP.NET Core | Web API example |
elixir/ |
Elixir | Phoenix | Functional web framework |
| Directory | Framework | Description |
|---|---|---|
react/ |
React | SPA instrumentation |
angular/ |
Angular | SPA instrumentation |
| Example | Description |
|---|---|
| ECS Fargate | Container deployment with OTel sidecar |
| Lambda (Go) | Serverless Go function |
| EC2 | Virtual machine deployment |
| RDS PostgreSQL + ECS | Database monitoring with CDK/CloudFormation |
| Example | Description |
|---|---|
| Cloud Run | Serverless containers (Go, Python, Node.js, Java) |
Pre-configured collector setups for common use cases:
| Configuration | Description |
|---|---|
| Kubernetes Operator | K8s native deployment |
| OTel Operator | Auto-instrumentation for K8s |
| Fluent Bit | Log collection pipeline |
| Logstash | ELK stack integration |
| FireLens | AWS FireLens for ECS |
| Apache Server | Apache httpd metrics |
| Nginx Metrics | Nginx server metrics |
| MariaDB | Database metrics |
| Oracle | Oracle DB monitoring |
| YACE Metrics | AWS CloudWatch exporter |
| Directory | Description |
|---|---|
datadog-k8s-operator/ |
Migrate from Datadog Agent to OpenTelemetry |
Getting Started
- OpenTelemetry Overview - OTLP endpoints, credentials, and setup
- OpenTelemetry Collector - Collector configuration
Go Frameworks
- Gin ・ gRPC ・ FastHTTP ・ Iris ・ Gorilla Mux
Python Frameworks
JavaScript/Node.js Frameworks
Ruby Frameworks
Java Frameworks
Other Languages
Cloud & Infrastructure
Messaging & Databases
- Last9 Documentation - Full platform documentation
- OpenTelemetry Official Docs - Specification and SDKs
While these examples are configured for Last9, they work with any OTLP-compatible backend:
- Grafana Cloud / Tempo / Mimir
- Honeycomb
- Jaeger
- Zipkin
- Datadog
- New Relic
- Dynatrace
- Splunk
- And many more...
Just update the OTEL_EXPORTER_OTLP_ENDPOINT and authentication headers for your backend.
We welcome contributions! Whether it's adding new framework examples, improving documentation, or fixing bugs - PRs are appreciated.
This project is licensed under the MIT License - see the LICENSE file for details.
Built with love by Last9
High cardinality observability, simplified.