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

[8.11](backport #36823) Azure Monitor: adjust grouping logic and avoid duplicating documents to make the metricset TSDB-friendly #37177

Merged
merged 3 commits into from
Nov 28, 2023

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Nov 22, 2023

This is an automatic backport of pull request #36823 done by Mergify.


Mergify commands and options

More conditions and actions can be found in the documentation.

You can also trigger Mergify actions by commenting on this pull request:

  • @Mergifyio refresh will re-evaluate the rules
  • @Mergifyio rebase will rebase this PR on its base branch
  • @Mergifyio update will merge the base branch into this PR
  • @Mergifyio backport <destination> will backport this PR on <destination> branch

Additionally, on Mergify dashboard you can:

  • look at your merge queues
  • generate the Mergify configuration with the config editor.

Finally, you can contact us on https://mergify.com

…to make the metricset TSDB-friendly (#36823)

## Overview

(WHAT) Here is a summary of the changes introduced with this PR.

- Update the metric grouping logic
- Track metrics collection info
- Adjust collection interval

### Update the metric grouping logic

Streamlines the metrics grouping logic to include all the fields the TSDB team identified as dimensions for the Azure Metrics events.

Here are the current components of the grouping key:

- timestamp
- namespace
- resource ID
- resource Sub ID
- dimensions
- time grain

It also tries to make the grouping simpler to read.

(WHY)

When TSDB is enabled, it drops events with the same timestamp and dimensions. The metricset must group all metrics values by timestamp+dimensions and create one event for each group to avoid data loss.

### Track metrics collection info

The metricset tracks the timestamp and time grain for each metrics collection. At the beginning of each iteration, it skips collecting a value if the metricset has already collected a value for the (time grain) period.

(WHY)

The metricset usually collects one data point for each collection period. When the time grain is larger than the collection period, the metricset collects the identical data point multiple times.

For example, consider a `PT1H` (one hour) time grain and a collection period of five minutes: without tracking, the metrics would collect the identical `PT1H` data point 12 times.

### Adjust collection interval

Change the collection interval to `[{-2 x INTERVAL},{-1 x INTERVAL})` with a delay of `{INTERVAL}`.

(WHY)

The collection interval was [2x the collection period or time grain](https://github.com/elastic/beats/blob/ed34c37f59c7bc0cf9e8051f7b5327c861b59467/x-pack/metricbeat/module/azure/client.go#L110-L116). This interval is too large, and we collected multiple data points for the same metric. There was some code to drop the additional data points, but it wasn't working in all cases.

Glossary:
- collection interval: the time range used to fetch metrics values.
- collection period: time between metric collections (e.g., with a 5 min period, the metricset collects new metrics every 5 minutes)

(cherry picked from commit 886d078)
@mergify mergify bot requested a review from a team as a code owner November 22, 2023 09:58
@mergify mergify bot added the backport label Nov 22, 2023
@mergify mergify bot assigned zmoog Nov 22, 2023
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Nov 22, 2023
@botelastic
Copy link

botelastic bot commented Nov 22, 2023

This pull request doesn't have a Team:<team> label.

@elasticmachine
Copy link
Collaborator

💚 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-11-22T09:58:19.806+0000

  • Duration: 55 min 1 sec

Test stats 🧪

Test Results
Failed 0
Passed 1466
Skipped 96
Total 1562

💚 Flaky test report

Tests succeeded.

🤖 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 the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

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

@elasticmachine
Copy link
Collaborator

💚 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-11-22T12:26:47.525+0000

  • Duration: 53 min 21 sec

Test stats 🧪

Test Results
Failed 0
Passed 1466
Skipped 96
Total 1562

💚 Flaky test report

Tests succeeded.

🤖 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 the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

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

Copy link
Contributor Author

mergify bot commented Nov 22, 2023

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b mergify/bp/8.11/pr-36823 upstream/mergify/bp/8.11/pr-36823
git merge upstream/8.11
git push upstream mergify/bp/8.11/pr-36823

Copy link
Contributor Author

mergify bot commented Nov 27, 2023

This pull request has not been merged yet. Could you please review and merge it @zmoog? 🙏

@elasticmachine
Copy link
Collaborator

💚 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-11-28T21:19:39.320+0000

  • Duration: 55 min 53 sec

Test stats 🧪

Test Results
Failed 0
Passed 1466
Skipped 96
Total 1562

💚 Flaky test report

Tests succeeded.

🤖 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 the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

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

@zmoog zmoog merged commit 11cb1b3 into 8.11 Nov 28, 2023
21 checks passed
@zmoog zmoog deleted the mergify/bp/8.11/pr-36823 branch November 28, 2023 22:16
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport needs_team Indicates that the issue/PR needs a Team:* label
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants