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

Add support for histograms to metrics intake #5360

Merged
merged 6 commits into from
Jun 1, 2021

Conversation

axw
Copy link
Member

@axw axw commented May 28, 2021

Motivation/summary

Extend the metricset schema with additional fields on "samples": type, unit, values, and counts. For now, the only type that is honoured is "histogram", and units are not honoured at all. We need a resolution on elastic/elasticsearch#72536 to handle gauge/counter and units.

If type is "histogram", then you are expected send "counts" and "values". Counts must be a list of non-negative integers. Values must be a list of (any) numbers; the values must be provided in ascending order.

With this change, one of "value" or "values" must be supplied. Previously "value" was required, so sending a histogram to an older server will result in a validation error. If "values" is supplied, "counts" must also be supplied.

Checklist

How to test these changes

Once one of our agents has implemented support for sending histogram metrics (probably via the Prometheus API?), use one to send to APM Server and ensure the metric is stored in a histogram field with expected counts/values.

Related issues

Closes #4884
Closes #3195

@axw axw added the v7.14.0 label May 28, 2021
@axw axw force-pushed the modeldecoder-metric-type-unit branch from e2b6d5c to 2fc5e46 Compare May 28, 2021 05:00
@apmmachine
Copy link
Contributor

apmmachine commented May 28, 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: Pull request #5360 updated

  • Start Time: 2021-06-01T02:03:31.265+0000

  • Duration: 40 min 18 sec

  • Commit: e7bc476

Test stats 🧪

Test Results
Failed 0
Passed 6154
Skipped 120
Total 6274

Trends 🧪

Image of Build Times

Image of Tests

@axw
Copy link
Member Author

axw commented May 28, 2021

@beniwohli @felixbarny FYI. Would be good to get your eyes at least on the changes in docs/schema and testdata: https://github.com/elastic/apm-server/pull/5360/files?file-filters%5B%5D=.json&file-filters%5B%5D=.ndjson

@axw axw force-pushed the modeldecoder-metric-type-unit branch from 2fc5e46 to 89ee1e2 Compare May 28, 2021 08:17
@axw axw force-pushed the modeldecoder-metric-type-unit branch from 89ee1e2 to 1dca4c8 Compare May 28, 2021 09:01
@axw axw marked this pull request as ready for review May 28, 2021 10:03
@axw axw requested a review from a team May 28, 2021 10:03
@axw
Copy link
Member Author

axw commented May 31, 2021

jenkins run the tests please

@axw axw merged commit 0744428 into elastic:master Jun 1, 2021
@axw axw deleted the modeldecoder-metric-type-unit branch June 1, 2021 02:45
mergify bot pushed a commit that referenced this pull request Jun 1, 2021
* model/modeldecoder: add metric type and unit

* systemtest: test histogram metrics

* Update changelog

* systemtest: fix min docs expectation in test

(cherry picked from commit 0744428)

# Conflicts:
#	changelogs/head.asciidoc
axw added a commit that referenced this pull request Jun 2, 2021
…5381)

* Add support for histograms to metrics intake (#5360)

* model/modeldecoder: add metric type and unit

* systemtest: test histogram metrics

* Update changelog

* systemtest: fix min docs expectation in test

(cherry picked from commit 0744428)

# Conflicts:
#	changelogs/head.asciidoc

* Delete head.asciidoc

Co-authored-by: Andrew Wilkins <[email protected]>
beniwohli added a commit to beniwohli/apm-agent-python that referenced this pull request Jun 14, 2021
@simitt
Copy link
Contributor

simitt commented Jul 13, 2021

Tested with BC2 with an example request received from @beniwohli (testing with opbeans app did not yet fully work): histogram data are indexed in ES.
Screenshot 2021-07-13 at 12 59 23

beniwohli added a commit to elastic/apm-agent-python that referenced this pull request Jul 19, 2021
* catch and log exceptions in the interval timer function

Instead of letting the thread die, we log the exception with
a stack trace to ease debugging.

* implement histogram metrics and a prometheus histogram bridge

The spec for histograms has been merged in
elastic/apm-server#5360

* trying to debug failure that only happens on CI...

* adapt prometheus histograms to use centroids instead of upper limit buckets

* move midpoint calculation into base metrics
beniwohli added a commit to beniwohli/apm-agent-python that referenced this pull request Sep 14, 2021
* catch and log exceptions in the interval timer function

Instead of letting the thread die, we log the exception with
a stack trace to ease debugging.

* implement histogram metrics and a prometheus histogram bridge

The spec for histograms has been merged in
elastic/apm-server#5360

* trying to debug failure that only happens on CI...

* adapt prometheus histograms to use centroids instead of upper limit buckets

* move midpoint calculation into base metrics
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.

Extend metrics intake to accept histograms Histogram metric support
4 participants