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: introduce APMEvent; Batch is now []model.APMEvent #5613

Merged
merged 3 commits into from
Jul 7, 2021

Conversation

axw
Copy link
Member

@axw axw commented Jul 6, 2021

Motivation/summary

Introduce model.APMEvent, a sort of discriminated union of all possible APM event types. In the future I intend to define model types in protobuf and generate the Go code. The APMEvent type will evolve to map directly to the Elasticsearch docs we produce, along these lines:

message APMEvent {
  google.protobuf.Timestamp timestamp = 1;
  Event event = 2;
  Trace trace = 3;
  Transaction transaction = 4;
  Span span = 5;
  Metricset metricset = 6;
  Parent parent = 7;
  Agent agent = 8;
  Client client = 9;
  Cloud cloud = 10;
  Container container = 11;
  Host host = 12;
  Kubernetes kubernetes = 13;
  map<string, LabelValue> labels = 14;
  Process process = 15;
  Service service = 16;
  Session session = 17;
  User user = 18;
  UserAgent user_agent = 19;
  HTTP http = 20;
  URL url = 21;
  Child child = 22;
  Error error = 23;
}

When we do that, we'll be moving common fields (e.g. service details, labels) to APMEvent, and out of the specific event objects. By moving common fields to this top-level type, we'll be able to generate code for encoding to Beats events.

How to test these changes

N/A, non-functional change.

Related issues

#4120
#4410
#3565

Introduce APMEvent, a sort of discriminated union of all
possible APM event types.

In the future we will define module types in protobuf and
generate the Go code. The APMEvent type will evolve to map
directly to the Elasticsearch docs we produce, along these
lines:

```
message APMEvent {
  google.protobuf.Timestamp timestamp = 1;
  Event event = 2;
  Trace trace = 3;
  Transaction transaction = 4;
  Span span = 5;
  Metricset metricset = 6;
  Parent parent = 7;
  Agent agent = 8;
  Client client = 9;
  Cloud cloud = 10;
  Container container = 11;
  Host host = 12;
  Kubernetes kubernetes = 13;
  map<string, LabelValue> labels = 14;
  Process process = 15;
  Service service = 16;
  Session session = 17;
  User user = 18;
  UserAgent user_agent = 19;
  HTTP http = 20;
  URL url = 21;
  Child child = 22;
  Error error = 23;
}
```

When we do that, we'll be moving common fields (e.g. service details,
labels) to APMEvent, and out of the specific event objects.
@axw axw added the v7.15.0 label Jul 6, 2021
@apmmachine
Copy link
Contributor

apmmachine commented Jul 6, 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

Expand to view the summary

Build stats

  • Build Cause: axw commented: /test

  • Start Time: 2021-07-06T05:40:39.297+0000

  • Duration: 37 min 11 sec

  • Commit: 1f7d522

Test stats 🧪

Test Results
Failed 0
Passed 6004
Skipped 106
Total 6110

Trends 🧪

Image of Build Times

Image of Tests

axw added 2 commits July 6, 2021 11:28
Order of events changed: they're once again reported in the order received.
@axw axw force-pushed the model-apmevent branch from 506a6ef to 1f7d522 Compare July 6, 2021 03:28
@axw
Copy link
Member Author

axw commented Jul 6, 2021

/test

@axw axw requested a review from a team July 6, 2021 06:22
@axw axw marked this pull request as ready for review July 6, 2021 06:22
@axw axw merged commit 0661ad0 into elastic:master Jul 7, 2021
@axw axw deleted the model-apmevent branch July 7, 2021 00:40
mergify bot pushed a commit that referenced this pull request Jul 7, 2021
* model: introduce APMEvent; Batch is now []APMEvent

Introduce APMEvent, a sort of discriminated union of all
possible APM event types.

In the future we will define module types in protobuf and
generate the Go code. The APMEvent type will evolve to map
directly to the Elasticsearch docs we produce, along these
lines:

```
message APMEvent {
  google.protobuf.Timestamp timestamp = 1;
  Event event = 2;
  Trace trace = 3;
  Transaction transaction = 4;
  Span span = 5;
  Metricset metricset = 6;
  Parent parent = 7;
  Agent agent = 8;
  Client client = 9;
  Cloud cloud = 10;
  Container container = 11;
  Host host = 12;
  Kubernetes kubernetes = 13;
  map<string, LabelValue> labels = 14;
  Process process = 15;
  Service service = 16;
  Session session = 17;
  User user = 18;
  UserAgent user_agent = 19;
  HTTP http = 20;
  URL url = 21;
  Child child = 22;
  Error error = 23;
}
```

When we do that, we'll be moving common fields (e.g. service details,
labels) to APMEvent, and out of the specific event objects.

* Adapt code to model.Batch changes

* Update approvals

Order of events changed: they're once again reported in the order received.

(cherry picked from commit 0661ad0)
axw added a commit that referenced this pull request Jul 7, 2021
* model: introduce APMEvent; Batch is now []APMEvent

Introduce APMEvent, a sort of discriminated union of all
possible APM event types.

In the future we will define module types in protobuf and
generate the Go code. The APMEvent type will evolve to map
directly to the Elasticsearch docs we produce, along these
lines:

```
message APMEvent {
  google.protobuf.Timestamp timestamp = 1;
  Event event = 2;
  Trace trace = 3;
  Transaction transaction = 4;
  Span span = 5;
  Metricset metricset = 6;
  Parent parent = 7;
  Agent agent = 8;
  Client client = 9;
  Cloud cloud = 10;
  Container container = 11;
  Host host = 12;
  Kubernetes kubernetes = 13;
  map<string, LabelValue> labels = 14;
  Process process = 15;
  Service service = 16;
  Session session = 17;
  User user = 18;
  UserAgent user_agent = 19;
  HTTP http = 20;
  URL url = 21;
  Child child = 22;
  Error error = 23;
}
```

When we do that, we'll be moving common fields (e.g. service details,
labels) to APMEvent, and out of the specific event objects.

* Adapt code to model.Batch changes

* Update approvals

Order of events changed: they're once again reported in the order received.

(cherry picked from commit 0661ad0)

Co-authored-by: Andrew Wilkins <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants