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

[prometheus][remote_write] Fix remote_write ingest pipeline to include both metric path 'prometheus.*' and 'prometheus.metrics.*' to fingerprint calculation #7882

Conversation

tetianakravchenko
Copy link
Contributor

@tetianakravchenko tetianakravchenko commented Sep 20, 2023

What does this PR do?

Fix remote_write ingest pipeline to include both metric path 'prometheus.' and 'prometheus.metrics.' to fingerprint calculation

There are 2 use cases:

  1. If Use Types is enabled - metrics will be added under prometheus.* in this format:
{ "prometheus":
  "metric1": {
    "counter": x
  },
  "metric2": {
    "value": y
  }
  "labels": { 
    ...
  }
}
  1. If Use Types is disabled - metrics will be added under prometheus.metrics.* in this format:
{ "prometheus":
  "metrics": {
    "metric1": x
    "metric2": y
  }
  "labels": { 
    ...
  }
}

This fix is needed to support both cases, otherwise when TSDB is enabled, some documents will be dropped in case Use Types is disabled

Checklist

  • I have reviewed tips for building integrations and this pull request is aligned with them.
  • I have verified that all data streams collect metrics or logs.
  • I have added an entry to my package's changelog.yml file.
  • I have verified that Kibana version constraints are current according to guidelines.

Author's Checklist

  • [ ]

How to test this PR locally

Related issues

Screenshots

Previous version - 1.12.0

For demonstration purpose I've remove remove processor in the local setup -

- remove:
field: "prometheus.labels.metrics_names"
description: Remove field as it contains a redundant information and can impact the documents size

Use_type disabled:
Screenshot 2023-09-25 at 16 26 19

In this case fingerprint based on the [metric, labels] object is not unique that can cause some dropping of documents.

Use_type enabled:
Screenshot 2023-09-25 at 16 29 38

Upgrade prometheus version to 1.12.1

Screenshot 2023-09-25 at 16 31 41 Upgrade caused recreation of the ingest pipeline, I've removed `remove` processor.

Use_type enabled:
Screenshot 2023-09-25 at 16 33 51

Use_type disabled (notice that metrics are stored under prometheus.metric):
Screenshot 2023-09-25 at 16 35 39

…eus.*' and 'prometheus.metrics.*' to fingerprint calculation

Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>
@elasticmachine
Copy link

elasticmachine commented Sep 20, 2023

💚 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-09-20T09:17:41.088+0000

  • Duration: 15 min 36 sec

Test stats 🧪

Test Results
Failed 0
Passed 9
Skipped 0
Total 9

🤖 GitHub comments

Expand to view the GitHub comments

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

  • /test : Re-trigger the build.

@elasticmachine
Copy link

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 100.0% (0/0) 💚
Files 100.0% (0/0) 💚
Classes 100.0% (0/0) 💚
Methods 66.667% (8/12)
Lines 100.0% (0/0) 💚
Conditionals 100.0% (0/0) 💚

@tetianakravchenko tetianakravchenko requested review from ChrsMark and MichaelKatsoulis and removed request for gsantoro September 21, 2023 09:16
Copy link
Member

@ChrsMark ChrsMark left a comment

Choose a reason for hiding this comment

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

lgtm. Would be nice if we could cover these through "unit" testing, not sure if we have already or if it's doable though.

@gizas
Copy link
Contributor

gizas commented Sep 25, 2023

I am missing only some evidence for tests that the fix worked. Some screenshots only would have been ok

@tetianakravchenko
Copy link
Contributor Author

I am missing only some evidence for tests that the fix worked. Some screenshots only would have been ok

@gizas I've updated the PR description, could you please have a look?

@tetianakravchenko tetianakravchenko merged commit 5261e0c into elastic:main Sep 26, 2023
1 check passed
@elasticmachine
Copy link

Package prometheus - 1.12.1 containing this change is available at https://epr.elastic.co/search?package=prometheus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants