Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .coderabbit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
language: en-US

reviews:
profile: chill
high_level_summary: true
review_status: true
poem: false
auto_review:
enabled: true
drafts: false
path_filters:
- "!**/*.lock"
- "!dist/**"
- "!coverage/**"
- "!**/*.snap"
pre_merge_checks:
docstrings:
mode: warning
threshold: 80
description:
mode: warning
issue_assessment:
mode: warning

chat:
auto_reply: true
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@ body:
- label: I have searched existing issues to ensure this hasn't been reported
required: true
- label: I have redacted any sensitive information (API keys, tokens, etc.)
required: true
required: true
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ contact_links:
about: Share and discuss ideas for new features
- name: Questions & Help
url: https://github.com/DEVtheOPS/opencode-plugin-otel/discussions/categories/q-a
about: Ask the community for help
about: Ask the community for help
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ body:
- label: I have searched existing issues and discussions for similar feature requests
required: true
- label: I have checked the changelog to see if this already exists
required: true
required: true
4 changes: 3 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

- [ ] I have read the [CONTRIBUTING.md](../CONTRIBUTING.md) document
- [ ] My code follows the style guidelines of this project
- [ ] `bun run lint` passes with no errors
- [ ] `bun run check:jsdoc-coverage` passes with no errors
- [ ] `bun run typecheck` passes with no errors
- [ ] `bun test` passes with no errors
- [ ] I have added tests that prove my fix is effective or that my feature works
Expand All @@ -29,4 +31,4 @@

## Additional context

<!-- Any other context, screenshots, or information that might be helpful -->
<!-- Any other context, screenshots, or information that might be helpful -->
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ jobs:
- name: Install dependencies
run: bun install --frozen-lockfile

- name: Lint
run: bun run lint

- name: JSDoc coverage
run: bun run check:jsdoc-coverage

- name: Typecheck
run: bun run typecheck

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/opencode.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ jobs:
env:
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
with:
model: opencode/big-pickle
model: opencode/big-pickle
14 changes: 14 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,20 @@ repos:

- repo: local
hooks:
- id: eslint
name: ESLint
language: system
entry: bun run lint
pass_filenames: false
types: [ts]

- id: jsdoc-coverage
name: JSDoc coverage
language: system
entry: bun run check:jsdoc-coverage
pass_filenames: false
types: [ts]

- id: typecheck
name: TypeScript typecheck
language: system
Expand Down
11 changes: 6 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,32 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and

---

## [0.6.0](https://github.com/DEVtheOPS/opencode-plugin-otel/compare/v0.5.0...v0.6.0) (2026-03-26)
## [Unreleased]

### Features

* **otel:** add OTLP HTTP/protobuf exporter support via `OPENCODE_OTLP_PROTOCOL`

## [0.6.0](https://github.com/DEVtheOPS/opencode-plugin-otel/compare/v0.5.0...v0.6.0) (2026-03-26)

### Features

* **config:** add OPENCODE_DISABLE_TRACES for per-type trace suppression ([89cb9b9](https://github.com/DEVtheOPS/opencode-plugin-otel/commit/89cb9b9b9b1f79559f3930a2017ca16f513785b3))
* **tracing:** add OpenTelemetry traces with gen_ai.* and tool spans ([0a00b43](https://github.com/DEVtheOPS/opencode-plugin-otel/commit/0a00b43c714c45146ac93b9077c478127727e6ce))
* **tracing:** add OpenTelemetry traces with gen_ai.* and tool spans ([6c848a7](https://github.com/DEVtheOPS/opencode-plugin-otel/commit/6c848a7bca237ab60e7035244d4889dae44560ca)), closes [#19](https://github.com/DEVtheOPS/opencode-plugin-otel/issues/19)


### Bug Fixes

* **traces:** apply metricPrefix to opencode span names and fix out-of-order parentage ([65f1e70](https://github.com/DEVtheOPS/opencode-plugin-otel/commit/65f1e70ec592a571dd5fd410769920cc5c6e1142))

## [0.5.0](https://github.com/DEVtheOPS/opencode-plugin-otel/compare/v0.4.1...v0.5.0) (2026-03-21)


### Features

* **handlers:** add agent usage metrics and sub-agent tracking ([2d12f88](https://github.com/DEVtheOPS/opencode-plugin-otel/commit/2d12f8846425075c4d8aac1573ac6e488bf868c3))

## [0.4.1](https://github.com/DEVtheOPS/opencode-plugin-otel/compare/v0.4.0...v0.4.1) (2026-03-16)


### Bug Fixes

* Normalize token and cost units for Claude compatibility ([a8b35dc](https://github.com/DEVtheOPS/opencode-plugin-otel/commit/a8b35dc65e84c646b40abccc534afb6110ba2f26))
Expand All @@ -38,7 +40,6 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and

## [0.4.0](https://github.com/DEVtheOPS/opencode-plugin-otel/compare/v0.3.0...v0.4.0) (2026-03-15)


### Features

* **config:** add OPENCODE_DISABLE_METRICS to suppress individual metrics ([8ec7c48](https://github.com/DEVtheOPS/opencode-plugin-otel/commit/8ec7c486d102921829a26d1f377df6aa20d988ad))
Expand Down
6 changes: 4 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ opencode loads TypeScript natively via Bun, so there is no build step required d

| Command | Description |
|---------|-------------|
| `bun run lint` | Run ESLint, including JSDoc formatting checks |
| `bun run check:jsdoc-coverage` | Enforce minimum JSDoc coverage for exported API declarations |
| `bun run typecheck` | Type-check all sources without emitting |
| `bun test` | Run the test suite |

Expand Down Expand Up @@ -109,9 +111,9 @@ chore(deps): bump @opentelemetry/api to 1.10.0
## Submitting changes

1. Fork the repo and create a branch from `main`: `git checkout -b feat/my-feature`
2. Make your changes and ensure `bun run typecheck` and `bun test` pass
2. Make your changes and ensure `bun run lint`, `bun run check:jsdoc-coverage`, `bun run typecheck`, and `bun test` pass
3. Commit using Conventional Commits format
4. Open a pull request — the title should also follow Conventional Commits format
4. Open a pull request with a clear, human-readable title and link any related issues in the description

## Releasing

Expand Down
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[![Build status](https://img.shields.io/github/actions/workflow/status/DEVtheOPS/opencode-plugin-otel/release-please.yml?branch=main)](https://github.com/DEVtheOPS/opencode-plugin-otel/actions/workflows/release-please.yml)
[![License](https://img.shields.io/npm/l/@devtheops/opencode-plugin-otel.svg)](https://github.com/DEVtheOPS/opencode-plugin-otel/blob/main/LICENSE)

An [opencode](https://opencode.ai) plugin that exports telemetry via OpenTelemetry (OTLP/gRPC), mirroring the same signals as [Claude Code's monitoring](https://code.claude.com/docs/en/monitoring-usage).
An [opencode](https://opencode.ai) plugin that exports telemetry via OpenTelemetry (OTLP over gRPC or HTTP/protobuf), mirroring the same signals as [Claude Code's monitoring](https://code.claude.com/docs/en/monitoring-usage).

- [What it instruments](#what-it-instruments)
- [Metrics](#metrics)
Expand Down Expand Up @@ -82,7 +82,8 @@ All configuration is via environment variables. Set them in your shell profile (
| Variable | Default | Description |
|----------|---------|-------------|
| `OPENCODE_ENABLE_TELEMETRY` | _(unset)_ | Set to any non-empty value to enable the plugin |
| `OPENCODE_OTLP_ENDPOINT` | `http://localhost:4317` | gRPC OTLP collector endpoint |
| `OPENCODE_OTLP_ENDPOINT` | `http://localhost:4317` | OTLP collector endpoint. For `grpc`, use the collector host/port. For `http/protobuf`, use the base URL and the plugin will append `/v1/traces`, `/v1/metrics`, and `/v1/logs`. |
| `OPENCODE_OTLP_PROTOCOL` | `grpc` | OTLP transport protocol: `grpc` or `http/protobuf` |
| `OPENCODE_OTLP_METRICS_INTERVAL` | `60000` | Metrics export interval in milliseconds |
| `OPENCODE_OTLP_LOGS_INTERVAL` | `5000` | Logs export interval in milliseconds |
| `OPENCODE_METRIC_PREFIX` | `opencode.` | Prefix for all metric names (e.g. set to `claude_code.` for Claude Code dashboard compatibility) |
Expand All @@ -95,9 +96,12 @@ All configuration is via environment variables. Set them in your shell profile (
```bash
export OPENCODE_ENABLE_TELEMETRY=1
export OPENCODE_OTLP_ENDPOINT=http://localhost:4317
export OPENCODE_OTLP_PROTOCOL=grpc
opencode
```

For `OPENCODE_OTLP_PROTOCOL=http/protobuf`, set `OPENCODE_OTLP_ENDPOINT` to the collector base URL rather than a per-signal path. The plugin expands it to `/v1/traces`, `/v1/metrics`, and `/v1/logs` automatically.

### Headers and resource attributes

```bash
Expand Down Expand Up @@ -147,13 +151,24 @@ export OPENCODE_DISABLE_METRICS="cache.count,session.duration,session.token.tota
```bash
export OPENCODE_ENABLE_TELEMETRY=1
export OPENCODE_OTLP_ENDPOINT=https://api.datadoghq.com
export OPENCODE_OTLP_PROTOCOL=http/protobuf
```

### Honeycomb example

```bash
export OPENCODE_ENABLE_TELEMETRY=1
export OPENCODE_OTLP_ENDPOINT=https://api.honeycomb.io
export OPENCODE_OTLP_PROTOCOL=http/protobuf
```

### Grafana Cloud example

```bash
export OPENCODE_ENABLE_TELEMETRY=1
export OPENCODE_OTLP_ENDPOINT=https://otlp-gateway-prod-us-central-0.grafana.net/otlp
export OPENCODE_OTLP_PROTOCOL=http/protobuf
export OPENCODE_OTLP_HEADERS="Authorization=Basic <base64-instance-id:api-key>"
```

### Claude Code dashboard compatibility
Expand Down
4 changes: 2 additions & 2 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
If you discover a security vulnerability, please report it responsibly:

1. **Do not** open a public issue
2. Email the maintainer at security@devtheops.com
2. Email the maintainer at <security@devtheops.com>
3. Include:
- Description of the vulnerability
- Steps to reproduce
Expand All @@ -30,4 +30,4 @@ If you discover a security vulnerability, please report it responsibly:

English is preferred, but we will do our best to accommodate other languages.

Thank you for helping keep this project secure.
Thank you for helping keep this project secure.
Loading
Loading