Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The CI workflow references a non-existent actions/setup-go@v7, and the middleware span currently ends before downstream handling, producing incorrect/invalid trace structure.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds a standalone RoadRunner HTTP middleware plugin that enables Zstandard (zstd) response compression using klauspost/compress/gzhttp, along with docs, tests (unit + PHP-backed integration), and CI to validate the plugin end-to-end.
Changes:
- Introduces
zstd.Pluginimplementing the RoadRunner HTTP middleware interface withgzhttpconfigured for zstd-only compression. - Adds unit tests (encoding/response/flush + OTEL propagation) and an integration test module that runs a real PHP PSR-7 worker.
- Adds usage documentation and a Linux CI workflow to run Go + PHP test suites.
File summaries
| File | Description |
|---|---|
plugin.go |
Implements the zstd middleware plugin using gzhttp and OTEL propagation. |
doc.go |
Adds package-level documentation. |
plugin_test.go |
Unit tests for encoding negotiation, response behavior, and flush behavior. |
plugin_otel_test.go |
Unit tests for OTEL tracing/propagation behavior. |
go.mod |
Defines the root Go module and dependencies for the plugin. |
go.sum |
Locks root Go module dependencies. |
tests/zstd_test.go |
Integration tests that boot RoadRunner via Endure and validate zstd responses over HTTP. |
tests/go.mod |
Separate Go module for integration tests (with replace pointing to the repo root). |
tests/go.sum |
Locks integration-test module dependencies. |
tests/php_test_files/worker.php |
Minimal PHP PSR-7 worker used by integration tests. |
tests/php_test_files/composer.json |
PHP dependencies for the integration worker. |
tests/php_test_files/composer.lock |
Locked PHP dependency graph for reproducible CI runs. |
README.md |
Documents usage, behavior, and how to run unit/integration tests locally. |
.gitignore |
Ignores the PHP vendor directory for the integration test fixture. |
.github/workflows/linux.yml |
CI workflow running Go unit + integration tests and PHP dependency install. |
Review details
- Files reviewed: 11/15 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+35
to
+43
| if val, ok := r.Context().Value(rrcontext.OtelTracerNameKey).(string); ok { | ||
| tp := trace.SpanFromContext(r.Context()).TracerProvider() | ||
| ctx, span := tp.Tracer(val, trace.WithSchemaURL(semconv.SchemaURL), | ||
| trace.WithInstrumentationVersion(otelhttp.Version)). | ||
| Start(r.Context(), PluginName, trace.WithSpanKind(trace.SpanKindInternal)) | ||
|
|
||
| p.prop.Inject(ctx, propagation.HeaderCarrier(r.Header)) | ||
| r = r.WithContext(ctx) | ||
| span.End() |
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.
Add
github.com/roadrunner-server/zstd/v6as a zstd-only HTTP middleware.gzhttpresponse handling and follow the gzip plugin lifecycle and tracing behavior.closes: roadrunner-server/roadrunner#2080.