Skip to content
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

Merged
merged 1 commit into from Sep 1, 2021

Conversation

axw
Copy link
Member

@axw axw commented Aug 29, 2021

Motivation/summary

Allow multiple of Span, Transaction, Error, and Metricset fields to be set, e.g. to set transaction.id on a span event, or transaction.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, introduce APMEvent.Parent; remove Span.ChildIDs, introduce APMEvent.Child.

Remove {Span,Error}.TransactionID and Metricset.{Span,Transaction}. These are replaced by setting APMEvent.Transaction and APMEvent.Span.

Only set transaction.sampled for sampled transactions; UI only ever uses it in the query transaction.sampled: true. This change is to avoid adding transaction.sampled: false to non-transaction events.

Checklist

How to test these changes

Should be non-functional change. Make sure the APM UI still functions.

Related issues

#4120

@apmmachine
Copy link
Collaborator

apmmachine commented Aug 29, 2021

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2021-09-01T02:23:31.648+0000

  • Duration: 43 min 42 sec

  • Commit: 33f2dfd

Test stats 🧪

Test Results
Failed 0
Passed 5884
Skipped 14
Total 5898

Trends 🧪

Image of Build Times

Image of Tests

@axw axw force-pushed the model-transactionspanid branch 4 times, most recently from 7a005fc to f905dca Compare August 31, 2021 04:13
@axw
Copy link
Member Author

axw commented Aug 31, 2021

/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.
@axw axw requested a review from a team September 1, 2021 03:21
@axw axw marked this pull request as ready for review September 1, 2021 03:21
// Child holds information about the children of a trace event.
type Child struct {
// ID holds IDs of child events.
ID []string
Copy link
Contributor

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?

Copy link
Member Author

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.

@axw axw merged commit 12bf386 into elastic:master Sep 1, 2021
@axw axw deleted the model-transactionspanid branch September 1, 2021 12:29
mergify bot pushed a commit that referenced this pull request Sep 1, 2021
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
axw added a commit that referenced this pull request Sep 2, 2021
…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>
@marclop marclop added backport-skip Skip notification from the automated backport with mergify test-plan-skip labels Oct 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-skip Skip notification from the automated backport with mergify test-plan-skip v7.16.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants