Vendor missing OTLP logs protos and unbreak fresh clones#1
Open
jianbo27 wants to merge 1 commit into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Verification
End-to-end on a fresh clone:
`git check-ignore` no longer matches the vendored proto files.