Skip to content

[FEATURE] Add optional links to the Exemplar type (perses#3445) - #118

Open
julianocosta89 wants to merge 2 commits into
perses:mainfrom
julianocosta89:exemplars/3445-exemplar-links
Open

julianocosta89 wants to merge 2 commits into
perses:mainfrom
julianocosta89:exemplars/3445-exemplar-links

Conversation

@julianocosta89

Copy link
Copy Markdown
Contributor

Description

First step of the "embed links" part of the exemplars roadmap (perses/perses#3445, step 2): extends the query-result contract with an optional links field on Exemplar.

The design keeps the division of responsibilities clean:

  • The query plugin (PrometheusTimeSeriesQuery, follow-up PR) reads the datasource exemplars configuration (URL template + trace ID label) and computes the final URLs per exemplar, attaching them here.
  • The panels and the shared tooltip stay datasource-agnostic: they just render ExemplarLink[] as clickable buttons. Any panel that displays exemplars gets link support for free, and any query plugin can produce links without the UI knowing anything about the datasource.
export interface ExemplarLink {
  /** Optional display label for the link (e.g. shown on the button in the tooltip). */
  name?: string;
  /** Final URL, with variables and trace ID placeholders already resolved. */
  url: string;
}

export interface Exemplar {
  labels: Labels;
  value: number;
  timestamp: UnixTimeMs;
  /**
   * Links related to this exemplar (e.g. to a tracing UI), computed by the query
   * plugin from the datasource exemplars configuration. Optional so plugins that
   * don't support links keep the payload unchanged.
   */
  links?: ExemplarLink[];
}

The field is optional, so the change is fully backwards compatible: older dashboards/datasources load unchanged, and plugins that don't produce links keep the payload identical.

Testing

  • Type-check and the full existing spec test suite pass (14 tests).
  • No CUE / Go / Java counterpart: TimeSeriesData and its exemplar types exist only in the TS part of the spec (query-result contract, not a persisted resource) — verified there are no exemplar references in cue/, go/ or java/.

@jgbernalp

Copy link
Copy Markdown
Contributor

@julianocosta89 can you please sign your commits?

@Nexucis

Nexucis commented Oct 26, 2026

Copy link
Copy Markdown
Member

@julianocosta89 do you mind to signoff your commit, we will then be able to move forward

@julianocosta89
julianocosta89 force-pushed the exemplars/3445-exemplar-links branch from a29b35c to 357a1fb Compare October 27, 2026 10:08
@julianocosta89

Copy link
Copy Markdown
Contributor Author

@jgbernalp and @Nexucis sorry, I was off last week and couldn't do it.
I've just pushed the signed commit, sorry about that

@julianocosta89

Copy link
Copy Markdown
Contributor Author

I believe the failing CI is not related to this PR

Query plugins (e.g. PrometheusTimeSeriesQuery) will compute these links
from the datasource exemplars configuration (URL template + trace ID
label) so that exemplar tooltips can offer a jump to a tracing UI without
the panels or the shared tooltip knowing anything about the datasource.

Signed-off-by: Juliano Costa <julianocosta89@outlook.com>
@julianocosta89
julianocosta89 force-pushed the exemplars/3445-exemplar-links branch from 357a1fb to ed01fba Compare October 27, 2026 11:13
@jgbernalp

Copy link
Copy Markdown
Contributor

We fixed the CI in #125, mind rebasing?

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