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

feat: support 2+2 and /status/buildinfo #3604

Merged
merged 5 commits into from Mar 29, 2024

Conversation

waynexia
Copy link
Member

I hereby agree to the terms of the GreptimeDB CLA.

Refer to a related PR or issue link (optional)

Closes #3496

What's changed and what's your intention?

When adding GreptimeDB to Grafana (v9.0) datasource using Prometheus extension, it will send two queries:

tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on docker0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
15:55:50.899080 IP 172.17.0.3.54034 > 172.17.0.1.4000: Flags [P.], seq 3048369435:3048369718, ack 3792103051, win 251, options [nop,nop,TS val 2511689527 ecr 2125370641], length 283
E..O..@.@.................m.........Yh.....
..W7~...POST /v1/prometheus/api/v1/query HTTP/1.1
Host: 172.17.0.1:4000
User-Agent: Grafana/10.2.3
Content-Length: 18
Content-Type: application/x-www-form-urlencoded
X-Datasource-Uid: c91e98f4-01ea-4ffd-890a-eef523983c78
X-Grafana-Org-Id: 1
Accept-Encoding: gzip

query=1%2B1&time=4
15:55:50.901986 IP 172.17.0.3.54034 > 172.17.0.1.4000: Flags [P.], seq 283:489, ack 229, win 250, options [nop,nop,TS val 2511689530 ecr 2125370644], length 206
E.....@.@.................n6...o....Y......
..W:~...GET /v1/prometheus/api/v1/status/buildinfo HTTP/1.1
Host: 172.17.0.1:4000
User-Agent: Grafana/10.2.3
X-Datasource-Uid: c91e98f4-01ea-4ffd-890a-eef523983c78
X-Grafana-Org-Id: 1
Accept-Encoding: gzip

This patch supports these two requests. Now GreptimeDB can be add to Grafana data source via Prometheus extension without error:

image

Checklist

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.
  • This PR does not require documentation updates.

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
@github-actions github-actions bot added the docs-not-required This change does not impact docs. label Mar 28, 2024
Copy link

codecov bot commented Mar 28, 2024

Codecov Report

Attention: Patch coverage is 78.78788% with 7 lines in your changes are missing coverage. Please review.

Project coverage is 85.08%. Comparing base (92a8e86) to head (90fb898).
Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3604      +/-   ##
==========================================
- Coverage   85.35%   85.08%   -0.27%     
==========================================
  Files         931      931              
  Lines      154611   154551      -60     
==========================================
- Hits       131961   131505     -456     
- Misses      22650    23046     +396     

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
Copy link
Contributor

@tisonkun tisonkun left a comment

Choose a reason for hiding this comment

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

Thank you!

@waynexia waynexia enabled auto-merge March 28, 2024 17:08
Copy link
Contributor

@killme2008 killme2008 left a comment

Choose a reason for hiding this comment

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

LGTM

src/servers/src/http/prometheus_resp.rs Outdated Show resolved Hide resolved
@waynexia waynexia added this pull request to the merge queue Mar 29, 2024
Merged via the queue into GreptimeTeam:main with commit 77cc721 Mar 29, 2024
18 checks passed
@waynexia waynexia deleted the fix-prom-api branch March 29, 2024 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs-not-required This change does not impact docs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error when saving GreptimeDB as Prometheus data source
3 participants