Guidelines for creating and maintaining OpenTelemetry example code.
This is Last9's collection of production-ready OpenTelemetry instrumentation examples. When a user asks about instrumenting an application with OpenTelemetry, you can reference examples in this repo by language/framework.
Languages: Go, Python, JavaScript/Node.js, Ruby, Java, PHP, .NET, Elixir Cloud: AWS (ECS, Lambda, EC2), GCP (Cloud Run), Kubernetes Collector: Pre-configured OTel Collector setups for various backends
Examples are organized by language/platform:
go/- Go examplesphp/- PHP examplespython/- Python examplesjava/- Java examplesjavascript/- JavaScript/Node.js examplesruby/- Ruby examples- etc.
Always use the latest stable OpenTelemetry Collector version in examples (currently 0.144.0). Check https://github.com/open-telemetry/opentelemetry-collector-releases/releases for the latest version before writing new examples.
- Binaries - No compiled executables,
.exe,.so,.dylib,.dllfiles - Secrets - No API keys, passwords, tokens, or credentials
- Dependencies - No
vendor/,node_modules/,.venv/, etc. - IDE files - No
.idea/,.vscode/(unless shared configs) - OS files - No
.DS_Store,Thumbs.db - Build artifacts - No
dist/,build/,target/,bin/
.gitignore- Every example directory must have a proper .gitignoreREADME.md- Setup instructions and usage.env.example- Template for environment variables (no real values)
Every example should include a .gitignore with at minimum:
# Environment/secrets
.env
.env.local
.env.*.local
# Dependencies (language-specific)
/vendor/
/node_modules/
/.venv/
/target/
/bin/
# IDE
.idea/
.vscode/
*.swp
# OS
.DS_Store
Thumbs.db
# Logs
*.log
# Build artifacts
/dist/
/build/Each example should have:
README.md- Quick start guide (this is the ONLY documentation file needed)docker-compose.yaml- For easy local testing (when applicable).env.example- Environment variable template.gitignore- Ignore secrets, deps, binaries- Source code with OTel instrumentation
Do NOT create additional documentation files like:
QUICK_SETUP.mdGETTING_STARTED.mdINSTALLATION.mdSETUP.mdGUIDE.mdTUTORIAL.mdCONTRIBUTING.md(at example level)CHANGELOG.md(at example level)
Why: Multiple docs files create maintenance burden, become stale, and confuse users. All setup instructions belong in README.md.
If content feels too long for README:
- Simplify the setup process instead of documenting complexity
- Use collapsible sections (
<details>) for optional/advanced content - Link to external Last9 docs for detailed explanations
Keep READMEs focused and concise:
# Example Name
Brief description (1-2 sentences)
## Prerequisites
- List requirements
## Quick Start
1. Step one
2. Step two
3. Step three
## Configuration
Environment variables table
## Verification
How to confirm it's working
Avoid verbose explanations - link to Last9 docs instead.
- Use placeholders:
<your-api-key>,<your-credentials> - Reference Last9 dashboard for obtaining credentials
- Default passwords for local dev DBs are OK (e.g.,
password: wordpress)