Exemplars/3445 datasource - #799
Open
julianocosta89 wants to merge 2 commits into
Open
Conversation
julianocosta89
requested review from
a team and
AntoineThebaud
as code owners
September 7, 2026 13:12
julianocosta89
requested review from
shahrokni
and removed request for
a team
September 7, 2026 13:12
This was referenced Sep 7, 2026
julianocosta89
force-pushed
the
exemplars/3445-datasource
branch
from
September 8, 2026 07:30
f0fb9a8 to
7664c7d
Compare
…t method
Add an optional `exemplars: { enable: boolean }` section to the
PrometheusDatasource spec, exposed in the datasource editor as a
toggle and validated by the CUE schema.
Add a `queryExemplars` method to the Prometheus client hitting
GET /api/v1/query_exemplars with the same query parameters and
authentication handling as the other API calls. The endpoint is also
added to the default proxy allowedEndpoints list.
Related to perses/perses#3445
Signed-off-by: Juliano Costa <juliano.costa@datadoghq.com>
When the selected datasource has exemplars enabled in its spec and the query runs in range mode, fire a query_exemplars request alongside the range query (same PromQL and time range, in parallel) and attach the converted exemplar data to the returned TimeSeriesData. Exemplar timestamps are converted from seconds to ms and values are parsed as numbers. A failing exemplar request never breaks the panel: the error is logged and the query result is returned without exemplars. Related to perses/perses#3445 Signed-off-by: Juliano Costa <juliano.costa@datadoghq.com>
julianocosta89
force-pushed
the
exemplars/3445-datasource
branch
from
September 8, 2026 12:07
fc0b4a9 to
543b09a
Compare
Contributor
|
Please add a screenshot to your PR desc 🙏 |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Part of #3445 (perses/perses#3445). Depends on the exemplars contract in perses/spec ().
Summary
Adds exemplars support to the Prometheus datasource and
PrometheusTimeSeriesQuery— the data path. Rendering in TimeSeriesChart follows in a follow-up PR stacked on this one.PrometheusDatasource
exemplars: { enable: boolean }section in the datasource spec — off by default, so existing datasources and dashboards are unaffected:prometheus/schemas/datasource/prometheus.cue— CUE schema for the new sectionprometheus/src/plugins/types.ts—PrometheusDatasourceSpec.exemplars?PrometheusDatasourceEditor.tsx— new "Exemplars" section with an "Enable exemplars"Switch(respects readonly mode; the section is removed from the spec when toggled off)queryExemplars()client method hittingGET /api/v1/query_exemplars?query=...&start=...&end=..., with API types (QueryExemplarsRequestParameters,ExemplarSeries,ExemplarData,QueryExemplarsResponse) modeled on the Prometheus docs.GET /api/v1/query_exemplars) and exposed onPrometheusClientvia the usualwrapClientMethod.PrometheusTimeSeriesQuery
query_exemplarsrequest with the same PromQL + time range is fired inparallel with the range query.
UnixTimeMs(× 1000), values (Prometheus strings) → numbers.TimeSeriesData.exemplarsper the spec contract.console.warn) and the series data is returned without exemplars.Testing
query_exemplarsclient call, exemplar enabled/disabled behavior, exemplar-request failure fallback, and unit conversion.turbo run type-check/test(30 packages),lint(31),oxfmtclean,make test-schemas-plugins(24 CUE schema tests),make lint-pluginspass.Follow-up
Stacked on this branch:
feat(timeserieschart)PR rendering exemplars as clickable diamond markers (#800).Screenshots
Checklist
[<catalog_entry>] <commit message>naming convention using one of thefollowing
catalog_entryvalues:FEATURE,ENHANCEMENT,BUGFIX,BREAKINGCHANGE,DOC,IGNORE.UI Changes