Skip to content

Vendor missing OTLP logs protos and unbreak fresh clones#1

Open
jianbo27 wants to merge 1 commit into
context-labs:mainfrom
jianbo27:fix/vendor-logs-protos
Open

Vendor missing OTLP logs protos and unbreak fresh clones#1
jianbo27 wants to merge 1 commit into
context-labs:mainfrom
jianbo27:fix/vendor-logs-protos

Conversation

@jianbo27
Copy link
Copy Markdown

Summary

Fresh clones of `main` cannot start the server. `bun run src/server.ts` fails immediately with:

```
ENOENT: no such file or directory,
open '.../src/proto/opentelemetry/proto/collector/logs/v1/logs_service.proto'
```

`src/protobuf.ts` and `src/grpc.ts` both load `opentelemetry/proto/collector/logs/v1/logs_service.proto` at startup, but neither that file nor `opentelemetry/proto/logs/v1/logs.proto` exists in the repo.

Root cause

`.gitignore` line 14 was an unanchored `logs` pattern intended to ignore a top-level `logs/` directory. Because git patterns without a leading slash match at any depth, this also matched `src/proto/opentelemetry/proto/logs/` and `src/proto/opentelemetry/proto/collector/logs/`, so the vendored `logs.proto` and `logs_service.proto` never made it into the index.

```
$ git check-ignore -v src/proto/opentelemetry/proto/logs/v1/logs.proto
.gitignore:14:logs src/proto/opentelemetry/proto/logs/v1/logs.proto
```

Fix

  • Anchor the rule to the repo root: `logs` → `/logs`. Inline comment explains why so this doesn't regress.
  • Vendor the two missing `.proto` files from OpenTelemetry's `opentelemetry-proto` v1.8.0. Sha-confirmed all eight vendored protos in this tree (the existing six + these two) are byte-identical to OTel v1.8.0, so the tree is internally consistent. Apache-2.0 license, matching the existing `src/proto/LICENSE`.

Verification

End-to-end on a fresh clone:

  • `bun install && bun run src/server.ts` → starts on `0.0.0.0:4318` (HTTP) + `0.0.0.0:4317` (gRPC) without ENOENT.
  • `POST /v1/traces` (HTTP/JSON) → HTTP 200, span lands in `data/traces.ndjson`.
  • `POST /v1/logs` (HTTP/JSON) → HTTP 200, log record lands in `data/logs.ndjson`.
  • `POST /v1/metrics` (HTTP/JSON) → HTTP 200.
  • HTTP/protobuf trace from `OTel-OTLP-Exporter-Python/1.41.1` → HTTP 200, decoded payload includes correct `service.name` and span name.
  • Real producer end-to-end test: an OpenAI Agents SDK agent on AppWorld emitted 19 spans across 3 traces, all received and decoded correctly; `task compact:traces` produced a valid `traces-by-trace.jsonl`.

`git check-ignore` no longer matches the vendored proto files.

Fresh clones of `main` cannot start the server. `bun run src/server.ts`
fails immediately with:

    ENOENT: no such file or directory,
    open '.../src/proto/opentelemetry/proto/collector/logs/v1/logs_service.proto'

because `src/protobuf.ts` and `src/grpc.ts` both load
`opentelemetry/proto/collector/logs/v1/logs_service.proto` at startup,
but neither that file nor `opentelemetry/proto/logs/v1/logs.proto`
exists in the repo. The other five OTLP protos (traces, metrics,
common, resource, plus the two collector services for traces and
metrics) are present, so traces and metrics worked locally on
machines where the proto tree happened to be on disk — but a clean
checkout cannot start.

Root cause: `.gitignore` line 14 was an unanchored `logs` pattern
intended to ignore a top-level `logs/` directory. Because git
patterns without a leading slash match at any depth, this also
matched `src/proto/opentelemetry/proto/logs/` and
`src/proto/opentelemetry/proto/collector/logs/`, so the vendored
`logs.proto` and `logs_service.proto` never made it into the index.
`git check-ignore -v src/proto/opentelemetry/proto/logs/v1/logs.proto`
points right at this rule.

Fix:

- Anchor the rule to the repo root: `logs` -> `/logs`. Comment
  documents why so this doesn't regress.
- Vendor the two missing `.proto` files from OpenTelemetry's
  `opentelemetry-proto` v1.5.0, matching the Apache-2.0 license
  the README/`src/proto/LICENSE` already describe and the version
  range used by the other vendored protos in this tree.

Verified end-to-end on a fresh clone:

- `bun install && bun run src/server.ts` now starts on
  `0.0.0.0:4318` (HTTP) + `0.0.0.0:4317` (gRPC) without ENOENT.
- `POST /v1/traces` -> HTTP 200, span lands in `data/traces.ndjson`.
- `POST /v1/logs`   -> HTTP 200, record lands in `data/logs.ndjson`.
- `git check-ignore` no longer matches the vendored proto files.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant