Skip to content

Realign project priorities#187

Merged
lillem4n merged 2 commits into
masterfrom
realign-project-priorities
Jun 19, 2026
Merged

Realign project priorities#187
lillem4n merged 2 commits into
masterfrom
realign-project-priorities

Conversation

@lillem4n

@lillem4n lillem4n commented Jun 19, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

Release Notes

  • New Features

    • Added OTLP HTTP protocol selection: choose between JSON ("http/json") or Protobuf ("http/protobuf") encoding for telemetry exports.
    • Enhanced clone() method to inherit OTLP configuration and trace info settings from parent instances.
  • Documentation

    • Updated README with refined design priorities and expanded configuration guide for the new protocol option.
    • Added contributor guidance for development practices.
  • Tests

    • Introduced end-to-end OTLP validation testing against a real OpenTelemetry Collector for both JSON and Protobuf exports.

@lillem4n lillem4n merged commit c5002aa into master Jun 19, 2026
8 of 9 checks passed
@lillem4n lillem4n deleted the realign-project-priorities branch June 19, 2026 10:01
@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d52829de-6e1a-4b6b-8dbd-f82b2e33e6ff

📥 Commits

Reviewing files that changed from the base of the PR and between e04489a and 5f70290.

📒 Files selected for processing (8)
  • .github/workflows/master.yaml
  • AGENTS.md
  • README.md
  • index.ts
  • package.json
  • scripts/otel-collector-config.yaml
  • scripts/run-otlp-tests.mjs
  • test.ts

📝 Walkthrough

Walkthrough

Adds an optional otlpProtocol: "http/protobuf" configuration to @larvit/log, implementing a self-contained protobuf encoder (ProtoWriter) for OTLP HTTP export. Fixes Log.clone() to inherit all LogConf settings per-key. Validates both transports via expanded unit tests with an in-process protobuf decoder and a new Docker-based end-to-end test against a real OpenTelemetry Collector.

Changes

OTLP HTTP/protobuf transport, clone() fix, and E2E validation

Layer / File(s) Summary
LogConf type extension and ProtoWriter encoder
index.ts
Adds optional otlpProtocol?: "http/json" | "http/protobuf" to LogConf and implements the internal ProtoWriter class plus encodeOtlpLogPayload, encodeOtlpSpanPayload, and encodeOtlpProtobuf functions to produce OTLP protobuf wire bytes.
otlpCall() protocol dispatch and response handling
index.ts
Sets Content-Type header based on otlpProtocol, conditionally serializes the request body as protobuf bytes or JSON, and skips JSON response body parsing for the protobuf transport.
clone() context merge and LogConf inheritance
index.ts
Rewrites Log.clone() to resolve entryFormatter from effective format, merge context per-key, and inherit all remaining LogConf fields from the current instance when not explicitly overridden (excluding parentLog and spanName).
Unit test harness expansion and protobuf/clone coverage
test.ts
Rewrites stubFetch to capture contentType and rawBody, adds a zero-dependency protobuf wire decoder, adds a clone() config-inheritance test, asserts application/json as default content-type, and adds a full http/protobuf test that decodes and validates wire payloads.
E2E test script, OTel Collector config, and npm/CI wiring
scripts/otel-collector-config.yaml, scripts/run-otlp-tests.mjs, package.json, .github/workflows/master.yaml
Adds an OTel Collector config (OTLP HTTP receiver + file exporter), a Docker-based E2E runner script with polling, assertion helpers and container cleanup, the test-otlp npm script, and the OTLP-test CI workflow job.
README, changelog, and AGENTS.md updates
README.md, AGENTS.md
Documents the otlpProtocol option, the test-otlp script, the v2.2.0 changelog entry, updated design priorities, and contributor guidance.

Sequence Diagram(s)

sequenceDiagram
    participant Test as run-otlp-tests.mjs
    participant Log as Log (larvit/log)
    participant Fetch as fetch (OTLP HTTP)
    participant Collector as OTel Collector (Docker)
    participant File as /data/otlp-received.json

    Test->>Collector: docker run otel/opentelemetry-collector-contrib
    Test->>Test: waitUntil(collector HTTP reachable)
    loop For each protocol: http/json, http/protobuf
        Test->>Log: new Log({ otlpProtocol, otlpHttpBaseURI })
        Log->>Log: log.error(msg, attrs)
        Log->>Fetch: POST /v1/logs (JSON or protobuf body)
        Fetch->>Collector: HTTP request
        Collector->>File: write newline-delimited JSON record
        Test->>Test: waitUntil(File has ≥1 record for protocol)
        Test->>File: readReceivedData()
        Test->>Test: assertLog() + assertSpan()
    end
    Test->>Collector: docker rm (finally)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • larvit/log#178: Overlaps at the otlpCall() internals and Log lifecycle handling in index.ts, including payload construction and context isolation that this PR also modifies.
  • larvit/log#179: Both PRs modify the OTLP HTTP fetch-stubbing and request-body assertion harness in test.ts, with this PR building directly on top of that test infrastructure.

Poem

🐰 Hoppity-hop through bytes so small,
ProtoWriter encodes them all!
JSON or protobuf, take your pick,
Clone inherits settings — slick!
The Collector listens, Docker purrs,
A bunny logs and nothing stirs.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch realign-project-priorities

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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