-
Notifications
You must be signed in to change notification settings - Fork 79
[FEATURE] Prometheus: add Exemplars support #799
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
Merged
AntoineThebaud
merged 13 commits into
perses:main
from
julianocosta89:exemplars/3445-datasource
Sep 17, 2026
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
69e7266
feat(prometheus): add exemplars spec section and queryExemplars clien…
julianocosta89 543b09a
feat(prometheus): fetch exemplars in PrometheusTimeSeriesQuery
julianocosta89 367f773
Merge branch 'main' into exemplars/3445-datasource
julianocosta89 6ffbfa1
Merge branch 'main' into exemplars/3445-datasource
julianocosta89 165c473
Move exemplars section into General Settings in PrometheusDatasourceE…
julianocosta89 4933c27
Merge branch 'main' into exemplars/3445-datasource
julianocosta89 a5f6ffc
[DOC] Document the exemplars support in the Prometheus plugin
julianocosta89 80408da
Merge branch 'main' into exemplars/3445-datasource
julianocosta89 740bdab
Address review feedback: handle exemplar failures eagerly and mirror …
julianocosta89 71131a0
[DOC] Describe the exemplar metadata dialog interaction
julianocosta89 c90b8c7
Merge branch 'main' into exemplars/3445-datasource
julianocosta89 5734c2b
Fix CI: repair exemplars doc link and format get-time-series-data.ts
julianocosta89 99e5ee5
Merge branch 'main' into exemplars/3445-datasource
julianocosta89 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| // Copyright The Perses Authors | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| package datasource | ||
|
|
||
| import ( | ||
| "encoding/json" | ||
| "testing" | ||
| ) | ||
|
|
||
| func TestPrometheusDatasourceBuilder(t *testing.T) { | ||
| builder, err := create(DirectURL("https://prometheus.demo.do.prometheus.io")) | ||
| if err != nil { | ||
| t.Fatalf("unexpected error: %v", err) | ||
| } | ||
| if builder.DirectURL != "https://prometheus.demo.do.prometheus.io" { | ||
| t.Errorf("directUrl mismatch: %s", builder.DirectURL) | ||
| } | ||
| if builder.Exemplars != nil { | ||
| t.Errorf("exemplars should not be set: %v", builder.Exemplars) | ||
| } | ||
| } | ||
|
|
||
| func TestEnableExemplars(t *testing.T) { | ||
| builder, err := create( | ||
| DirectURL("https://prometheus.demo.do.prometheus.io"), | ||
| EnableExemplars(), | ||
| ) | ||
| if err != nil { | ||
| t.Fatalf("unexpected error: %v", err) | ||
| } | ||
| if builder.Exemplars == nil || !builder.Exemplars.Enable { | ||
| t.Fatalf("exemplars should be enabled: %v", builder.Exemplars) | ||
| } | ||
|
|
||
| raw, err := json.Marshal(builder.PluginSpec) | ||
| if err != nil { | ||
| t.Fatalf("marshal: %v", err) | ||
| } | ||
|
|
||
| var out map[string]any | ||
| if err := json.Unmarshal(raw, &out); err != nil { | ||
| t.Fatalf("unmarshal: %v", err) | ||
| } | ||
|
|
||
| exemplars, ok := out["exemplars"].(map[string]any) | ||
| if !ok { | ||
| t.Fatalf("exemplars section is missing in the serialized spec: %v", out) | ||
| } | ||
| if enable, ok := exemplars["enable"].(bool); !ok || !enable { | ||
| t.Errorf("exemplars.enable mismatch: %v", exemplars["enable"]) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.