PCBC-1038: Add ThresholdLoggingTracer implementation#245
Merged
DemetrisChr merged 1 commit intocouchbase:mainfrom Mar 3, 2026
Merged
PCBC-1038: Add ThresholdLoggingTracer implementation#245DemetrisChr merged 1 commit intocouchbase:mainfrom
DemetrisChr merged 1 commit intocouchbase:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a PHP-side implementation of the default ThresholdLoggingTracer by introducing a PHP wrapper around a C++ core span resource, allowing spans created in PHP to be backed by the C++ core’s threshold-logging tracer.
Changes:
- Introduces a new
core_span_resourceand exposescoreSpanCreate/coreSpanEnd/coreSpanAddTagextension functions to manage core spans from PHP. - Implements
ThresholdLoggingTracerandThresholdLoggingSpanin PHP, plus addsTracerException. - Adjusts tracer selection so
Clusterdefaults toThresholdLoggingTracerwhen no tracer is configured.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| src/wrapper/persistent_connections_cache.cxx | Removes a stray trailing line in the file footer. |
| src/wrapper/core_span_resource.hxx | Declares a new Zend resource wrapper for C++ core spans. |
| src/wrapper/core_span_resource.cxx | Implements core span resource creation, tagging, ending, and destruction behavior. |
| src/php_couchbase.cxx | Registers the new core span resource + adds PHP extension functions to create/end/tag spans. |
| Couchbase/ThresholdLoggingTracer.php | Implements ThresholdLoggingTracer backed by the extension’s core span functions. |
| Couchbase/ThresholdLoggingSpan.php | New PHP RequestSpan implementation that delegates to a core span resource. |
| Couchbase/RequestTracer.php | Updates the RequestTracer interface signature (return type + exception contract). |
| Couchbase/Exception/TracerException.php | Adds a new exception type for tracer/span misuse. |
| Couchbase/ClusterOptions.php | Changes getTracer() to return nullable, enabling defaulting logic in Cluster. |
| Couchbase/Cluster.php | Defaults to ThresholdLoggingTracer when no tracer is configured. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Matt-Woz
reviewed
Mar 2, 2026
703fee9 to
ec92541
Compare
avsej
approved these changes
Mar 2, 2026
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.
Motivation
When no external tracer is configured, the SDK must default to the
ThresholdLoggingTracer. Now that spans are created on the PHP-side, we need to implement theThresholdLoggingTracerPHP class.Changes
ThresholdLoggingTracer. It acts as a wrapper over the C++ core's tracer. When operation spans are created in the PHP wrapper code, the corresponding threshold logging spans are created in the C++ core.TracerExceptioncore_span_resourcethat allows interacting with a C++ core span from PHP. This is only used for theThresholdLoggingTracer.