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
Introduce a way to extract the parent ID from Transactions and Spans #909
Labels
Comments
axw
pushed a commit
that referenced
this issue
Apr 23, 2021
* 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>
stuartnelson3
pushed a commit
that referenced
this issue
Jul 30, 2021
* 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>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your feature request related to a problem? Please describe.
It is currently not possible to extract the parent ID from a Transaction or Span. This makes it impossible to, for example, inject the parent ID into logs. See https://discuss.elastic.co/t/how-to-get-parent-span-id-from-span/266430
Describe the solution you'd like
Add a method to Transaction and Span to obtain the parent ID.
Describe alternatives you've considered
Alternatively, simply expose the parent ID as a field on Transaction and Span.
The text was updated successfully, but these errors were encountered: