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

[WIP][Prometheus] PrometheusClient use Labels API for "describe" resultset #2435

Closed
wants to merge 1 commit into from

Conversation

pjfitzgibbons
Copy link

@pjfitzgibbons pjfitzgibbons commented Nov 21, 2023

Description

Modify PrometheusClient to use Prometheus Labels API for PPL "describe" results, instead of Prometheus "metadata" API.

Prometheus series will only produce a "metadata" record if the Prometheus server actively scrapes the configured metrics source server.

In the case of backfilling via promtool tsdb create-blocks-from, this scraping event does not occur. In the case of development or test environment, this scraping event may never occur.

All series are exposed by the Prometheus Labels API, via endpoint /api/v1/label/__name__/values. Prometheus naming conventions can be used to determine the "unit" and "type" of each series. This is the expected internal behaviour of the Prometheus service itself.

Use case :
Script-generated backfill files are created, with content similar to :

# HELP test metric
# TYPE test gauge
test_usage{instance="2"} 8.723671517308066 1640995200
# EOF

Upon ingestion of this backfill via the cli promtool tsdb create-blocks-from /tmp/test_usage_backfill.txt, the series is visible in the Promethus Web UI (http://localhost:9090) via the "metrics browser".
Yet the series is not visible in the Metadata API (/api/v1/metdata).

This result is irrespective of any configuration in prometheus.yml for scraping, relabeling, or other configuration feautres.

Issues Resolved

[List any issues this PR will resolve]

Check List

  • New functionality includes testing.
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented.
    • New functionality has javadoc added
    • New functionality has user manual doc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@@ -83,6 +83,17 @@ public Map<String, List<MetricMetadata>> getAllMetrics() throws IOException {
return new ObjectMapper().readValue(jsonObject.getJSONObject("data").toString(), typeRef);
}

@Override
public List<String> getAllSeriesLabels() throws IOException {
Copy link
Member

Choose a reason for hiding this comment

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

Can you add use case to the PR description, what are we trying to achieve?

Copy link
Author

Choose a reason for hiding this comment

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

Updated. Please review.

Copy link
Author

Choose a reason for hiding this comment

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

I'm only looking for your review on throughput and generic functionality.
There are some hardcoded values that I will produce dynamically in a fast-follow commit on this PR

Copy link

codecov bot commented Nov 21, 2023

Codecov Report

Attention: Patch coverage is 25.00000% with 21 lines in your changes missing coverage. Please review.

Project coverage is 94.83%. Comparing base (e58af26) to head (9cb7f1c).
Report is 221 commits behind head on 2.x.

Files with missing lines Patch % Lines
...uest/system/PrometheusListSeriesLabelsRequest.java 0.00% 21 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##                2.x    #2435      +/-   ##
============================================
- Coverage     96.61%   94.83%   -1.79%     
- Complexity     4751     5128     +377     
============================================
  Files           438      482      +44     
  Lines         12742    14615    +1873     
  Branches        869      995     +126     
============================================
+ Hits          12311    13860    +1549     
- Misses          422      734     +312     
- Partials          9       21      +12     
Flag Coverage Δ
sql-engine 94.83% <25.00%> (-1.79%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Swiddis
Copy link
Collaborator

Swiddis commented Dec 27, 2024

Is this still in progress?

@Swiddis Swiddis closed this Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants