Conversation
There was a problem hiding this comment.
Pull request overview
Adds OpenTelemetry error logging support for CakePHP via a new middleware, plus shared OpenTelemetry test setup helpers and integration tests to validate span/log behavior.
Changes:
- Introduces
OtelErrorLoggingMiddlewareto emit OpenTelemetry log records for 500-level (and unexpected) exceptions. - Adds
OtelTestTraitto centralize in-memory span/log exporter setup for tests, and refactors existing integration tests to use it. - Updates README (EN/JA) and adds a spec document describing the feature and test strategy.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/Middleware/OtelErrorLoggingMiddleware.php |
New PSR-15 middleware that logs eligible exceptions to OTel logs and rethrows. |
tests/TestCase/OtelTestTrait.php |
New shared test trait for configuring in-memory OTel exporters/providers. |
tests/TestCase/Integration/Middleware/OtelErrorLoggingMiddlewareTest.php |
New integration tests validating logging behavior for different exception types. |
tests/TestCase/Integration/ControllerInstrumentationTest.php |
Refactor to use OtelTestTrait and add ext-opentelemetry skip + teardown reset. |
tests/TestCase/Integration/TableInstrumentationTest.php |
Refactor to use OtelTestTrait and add ext-opentelemetry skip + teardown reset. |
README.md |
Documents the new middleware and recommended placement in the middleware queue. |
README.ja.md |
Japanese documentation for the new middleware and configuration guidance. |
specs/001-exception-logger/SPEC.md |
New feature spec (currently has some drift vs repo layout/phpunit config). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Add exception.message to OTel log attributes per semantic conventions - Rename resetSpans() to resetOtel() to reflect actual behavior (resets all globals) - Update SPEC.md to match implementation (file paths, suite names, composer.json) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
No description provided.