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
model: allow mixing Span/Transaction/Error/Metricset in APMEvent #6066
Conversation
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
Trends 🧪 |
7a005fc
to
f905dca
Compare
/test |
Refactor model types to bring them close to the produced Elasticsearch document structure: - introduce Parent; remove the ParentID fields from Transaction, Span, and Error - introduce Child; remove the ChildIDs field from from Span - allow more than one of Transaction, Span, Error, Metricset to be set in APMEvent; remove Span and Transaction fields from Metricset; remove TransactionID, TransactionSampled, and TransactionType fields from Error; remove TransactionID field from Span Various transaction and span fields are now only recorded if they have the non-zero value. We take care to still record zero durations, as the APM UI makes heavy use of this field and it is not unreasonable to expect a short span to be recorded as having a zero duration, on machines which have low resolution timers.
f905dca
to
33f2dfd
Compare
// Child holds information about the children of a trace event. | ||
type Child struct { | ||
// ID holds IDs of child events. | ||
ID []string |
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.
nit: shouldn't this be named IDs
?
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.
I named it after the Elasticsearch field, which is child.id
-- a keyword field which naturally allows multiple values.
Refactor model types to bring them close to the produced Elasticsearch document structure: - introduce Parent; remove the ParentID fields from Transaction, Span, and Error - introduce Child; remove the ChildIDs field from from Span - allow more than one of Transaction, Span, Error, Metricset to be set in APMEvent; remove Span and Transaction fields from Metricset; remove TransactionID, TransactionSampled, and TransactionType fields from Error; remove TransactionID field from Span Various transaction and span fields are now only recorded if they have the non-zero value. We take care to still record zero durations, as the APM UI makes heavy use of this field and it is not unreasonable to expect a short span to be recorded as having a zero duration, on machines which have low resolution timers. (cherry picked from commit 12bf386) # Conflicts: # changelogs/head.asciidoc
…t (backport #6066) (#6107) * model: further align types with document structure (#6066) Refactor model types to bring them close to the produced Elasticsearch document structure: - introduce Parent; remove the ParentID fields from Transaction, Span, and Error - introduce Child; remove the ChildIDs field from from Span - allow more than one of Transaction, Span, Error, Metricset to be set in APMEvent; remove Span and Transaction fields from Metricset; remove TransactionID, TransactionSampled, and TransactionType fields from Error; remove TransactionID field from Span Various transaction and span fields are now only recorded if they have the non-zero value. We take care to still record zero durations, as the APM UI makes heavy use of this field and it is not unreasonable to expect a short span to be recorded as having a zero duration, on machines which have low resolution timers. (cherry picked from commit 12bf386) # Conflicts: # changelogs/head.asciidoc * Delete head.asciidoc Co-authored-by: Andrew Wilkins <axw@elastic.co>
Motivation/summary
Allow multiple of
Span
,Transaction
,Error
, andMetricset
fields to be set, e.g. to settransaction.id
on a span event, ortransaction.name
for breakdown metrics. This moves the model types another step closer to how the Elasticsearch documents are structured, and another step towards auto-generating the JSON/beat event encoding.Remove
{Span,Transaction,Error}.ParentID
, introduceAPMEvent.Parent
; removeSpan.ChildIDs
, introduceAPMEvent.Child
.Remove
{Span,Error}.TransactionID
andMetricset.{Span,Transaction}
. These are replaced by settingAPMEvent.Transaction
andAPMEvent.Span
.Only set
transaction.sampled
for sampled transactions; UI only ever uses it in the querytransaction.sampled: true
. This change is to avoid addingtransaction.sampled: false
to non-transaction events.Checklist
- [ ] Documentation has been updatedHow to test these changes
Should be non-functional change. Make sure the APM UI still functions.
Related issues
#4120