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

spanmetrics: Add 10m, 60m aggregation intervals #9926

Merged
merged 8 commits into from
Jan 2, 2023

Conversation

marclop
Copy link
Contributor

@marclop marclop commented Dec 29, 2022

Motivation/summary

Modifies the spanmetrics aggregator to support extra aggregation
intervals by introducing a new RollUpIntervals (internal only) config
option. The configuration option is not user facing, but rather allow us
to configure smaller intervals for testing purposes. Also removing the
aggregation.service_destinations.interval config option.

Two new intervals are added and published by default, 10 and 60m (1h).
and these are flushed when the APM Server is stopped or restarted.

Introduces 3 metrics-apm.service_destinations.${interval}m datastreams
which contain the mapping definitions for transaction metrics with a
series of changes to the apmpackage generator to allow interval
templating and individual ILM policies to be tied to each interval.
A new Metricset.Interval field is added to the ingested documents, to
allow them to contain the aggregated interval they represent. The field
format is ${interval}m or ${interval}s if < 60s.

Older APM Servers sending data to an Elasticsearch cluster with updated
APM Package, will continue indexing metrics to metrics-apm.internal.

Last, there's some light refactoring for the Start and Stop methods
to a common baseaggregator package which is imported by each of the
individual aggregators.

Checklist

How to test these changes

See linked issue

Related issues

Part of #9703

Modifies the `spanmetrics` aggregator to support extra aggregation
intervals by introducing a new `RollUpIntervals` (internal only) config
option. The configuration option is not user facing, but rather allow us
to configure smaller intervals for testing purposes. Also removing the
`aggregation.service_destinations.interval` config option.

Two new intervals are added and published by default, 10 and 60m (1h).
and these are flushed when the APM Server is stopped or restarted.

Introduces 3 `metrics-apm.service_destinations.${interval}m` datastreams
which contain the mapping definitions for transaction metrics with a
series of changes to the apmpackage generator to allow interval
templating and individual ILM policies to be tied to each interval.
A new `Metricset.Interval` field is added to the ingested documents, to
allow them to contain the aggregated interval they represent. The field
format is `${interval}m` or `${interval}s` if < 60s.

Older APM Servers sending data to an Elasticsearch cluster with updated
APM Package, will continue indexing metrics to `metrics-apm.internal`.

Last, there's some light refactoring for the `Start` and `Stop` methods
to a common `baseaggregator` package which is imported by each of the
individual aggregators.

Signed-off-by: Marc Lopez Rubio <marc5.12@outlook.com>
Signed-off-by: Marc Lopez Rubio <marc5.12@outlook.com>
Signed-off-by: Marc Lopez Rubio <marc5.12@outlook.com>
@marclop marclop added enhancement backport-skip Skip notification from the automated backport with mergify labels Dec 29, 2022
Signed-off-by: Marc Lopez Rubio <marc5.12@outlook.com>
@apmmachine
Copy link
Contributor

apmmachine commented Dec 29, 2022

💚 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: 2023-01-02T04:46:52.790+0000

  • Duration: 10 min 18 sec

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate and publish the docker images.

  • /test windows : Build & tests on Windows.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@apmmachine
Copy link
Contributor

apmmachine commented Dec 29, 2022

📚 Go benchmark report

Diff with the main branch

name                                          old time/op    new time/op    delta
pkg:github.com/elastic/apm-server/internal/agentcfg goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/internal/beater/request goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/internal/publish goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/x-pack/apm-server/aggregation/spanmetrics goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/x-pack/apm-server/aggregation/txmetrics goos:linux goarch:amd64
AggregateTransaction-12                         91.6ns ± 5%    78.3ns ± 5%  -14.50%  (p=0.008 n=5+5)
pkg:github.com/elastic/apm-server/x-pack/apm-server/sampling goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/x-pack/apm-server/sampling/eventstorage goos:linux goarch:amd64
ReadEvents/json_codec/100_events-12              835µs ± 1%     850µs ± 2%   +1.78%  (p=0.032 n=5+5)

name                                          old alloc/op   new alloc/op   delta
pkg:github.com/elastic/apm-server/internal/agentcfg goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/internal/beater/request goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/internal/publish goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/x-pack/apm-server/aggregation/spanmetrics goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/x-pack/apm-server/aggregation/txmetrics goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/x-pack/apm-server/sampling goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/x-pack/apm-server/sampling/eventstorage goos:linux goarch:amd64
ReadEvents/json_codec/1000_events-12            3.46MB ± 0%    3.49MB ± 0%   +0.92%  (p=0.029 n=4+4)

name                                          old allocs/op  new allocs/op  delta
pkg:github.com/elastic/apm-server/internal/agentcfg goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/internal/beater/request goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/internal/publish goos:linux goarch:amd64
Publisher-12                                     1.24k ± 1%     1.26k ± 1%   +1.88%  (p=0.029 n=4+4)
pkg:github.com/elastic/apm-server/x-pack/apm-server/aggregation/spanmetrics goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/x-pack/apm-server/aggregation/txmetrics goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/x-pack/apm-server/sampling goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/x-pack/apm-server/sampling/eventstorage goos:linux goarch:amd64

report generated with https://pkg.go.dev/golang.org/x/perf/cmd/benchstat

@marclop
Copy link
Contributor Author

marclop commented Dec 29, 2022

For reviewers, I've split the changes into more "reviewable" commits:

  • d2a031a: contains the server code changes.
  • f07b994: contains the new data stream definition.
  • ee12537: contains updates to system test and approved documents.
  • c139bc8: contains all the docs / changelogs.

@marclop marclop marked this pull request as ready for review December 29, 2022 06:14
@marclop marclop requested a review from a team December 29, 2022 06:14
Copy link
Contributor

@simitt simitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look great; only one minor note about the changelog.

changelogs/head.asciidoc Outdated Show resolved Hide resolved
@mergify

This comment was marked as resolved.

@marclop marclop enabled auto-merge (squash) January 2, 2023 04:47
@marclop marclop merged commit f2611d3 into elastic:main Jan 2, 2023
@marclop marclop deleted the f/add-service_destination-metrics-ds branch January 2, 2023 04:58
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 enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants