-
Notifications
You must be signed in to change notification settings - Fork 190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
apm: add ParentID methods to Span and Transaction #956
apm: add ParentID methods to Span and Transaction #956
Conversation
Adds two new methods to the `Span` and `Transaction` types, expanding the API so consumers can extract the ParentIDs should they desire to. The `Transaction.ParentID()` call reuses the already existing method `Transaction.EnsureParent()` since it handles all the cases already. `Span.ParentID()` is much simpler and does not generate a new SpanID when `parentID` is zero or nil, simply returns an empty `SpanID` with its zero value. Closes #909. Signed-off-by: Marc Lopez <marc5.12@outlook.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @marclop! Looks good overall, but I'd like to request a couple of main changes:
- Don't generate a parent ID in Transaction.ParentID (name doesn't suggest that, and I don't think it's generally desirable behaviour anyway)
- Add parentID as an immutable field to the top-level Transaction and Span types. When creating a transaction or span, set these fields. Then we can access them even after they're ended, like we can for TraceContext.
❕ Build Aborted
Expand to view the summary
Build stats
Test stats 🧪
Trends 🧪Log outputExpand to view the last 100 lines of log output
|
Adds a new `parentID` field to both `Transaction` and `Span` structures. The `parentID` is only populated at start time and remains immutable throughout the lifecycle of the Transaction or Span, making it possible to retrieve the `parentID` for either after they have ended. However, the `ParentID()` call might return a zero value `SpanID` when a trace has no parent. Signed-off-by: Marc Lopez <marc5.12@outlook.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks! Just a few minor things.
I think we'll hold off on merging this until the next release. We probably need a new branching strategy now that we're doing feature freezes...
Removes the `TransactionData.parentSpan` field in favor of the new `Transaction.parentID` and updates `EnsureParent()` to update that field and `Transaction.ParentID()` to hold a read lock to read `tx.parentID`. Signed-off-by: Marc Lopez <marc5.12@outlook.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lovely, thanks for the updates :)
Signed-off-by: Marc Lopez <marc5.12@outlook.com>
Still TODO is entry in the change log, once the upcoming version is released, we should update this PR with the change log entry. |
Turns out I misunderstood the agreed upon definition of feature freeze for agent development. @marclop it's OK to merge this now (with changelog updated). |
Signed-off-by: Marc Lopez <marc5.12@outlook.com>
Windows failed due to CI platform issues. Merging, nothing platform-specific here. |
* apm: add ParentID methods to Span and Transaction Adds two new methods to the `Span` and `Transaction` types, expanding the API so consumers can extract the ParentIDs should they desire to. The `Transaction.ParentID()` call reuses the already existing method `Transaction.EnsureParent()` since it handles all the cases already. `Span.ParentID()` is much simpler and does not generate a new SpanID when `parentID` is zero or nil, simply returns an empty `SpanID` with its zero value. Closes #909. Signed-off-by: Marc Lopez <marc5.12@outlook.com> * Address review comments Adds a new `parentID` field to both `Transaction` and `Span` structures. The `parentID` is only populated at start time and remains immutable throughout the lifecycle of the Transaction or Span, making it possible to retrieve the `parentID` for either after they have ended. However, the `ParentID()` call might return a zero value `SpanID` when a trace has no parent. Signed-off-by: Marc Lopez <marc5.12@outlook.com> * Address review comments Removes the `TransactionData.parentSpan` field in favor of the new `Transaction.parentID` and updates `EnsureParent()` to update that field and `Transaction.ParentID()` to hold a read lock to read `tx.parentID`. Signed-off-by: Marc Lopez <marc5.12@outlook.com> * Remove SpanData.parentID in favor of Span.parentID Signed-off-by: Marc Lopez <marc5.12@outlook.com> * Update changelog Signed-off-by: Marc Lopez <marc5.12@outlook.com>
Description
Adds a new
parentID
field to bothTransaction
andSpan
structures.The
parentID
is only populated at start time and remains immutablethroughout the lifecycle of the Transaction or Span, making it possible
to retrieve the
parentID
for either after they have ended.However, the
ParentID()
call might return a zero valueSpanID
whena trace has no parent.
Removes the
TransactionData.parentSpan
field in favor of the newTransaction.parentID
and updatesEnsureParent()
to update that fieldand
Transaction.ParentID()
to hold a read lock to readtx.parentID
.Last, removes the
SpanData.parentID
field and instead relies on thenew top level
Span.parentID
.Related issues
Closes #909.