Skip to content

PROM-0097: PromQL Metadata querying / promotion. - #97

Closed
roidelapluie wants to merge 3 commits into
prometheus:mainfrom
roidelapluie:roidelapluie/promql-metadata
Closed

roidelapluie wants to merge 3 commits into
prometheus:mainfrom
roidelapluie:roidelapluie/promql-metadata

Conversation

@roidelapluie

@roidelapluie roidelapluie commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

This proposal was writting by hand. Grammar fixed by AI.

I asked AI 5 examples queries:

up{target[deployment.environment.name]="production"} == 0
up{target[team.name] as team} == 0
queue_depth{resource[deployment.environment.name]="production" as environment} > 1000
sum by (service) (
  rate(http_requests_total{resource[service.name] as service}[5m])
)
sum by (cost_center) (
  process_resident_memory_bytes{resource["billing/cost-center"] as cost_center}
)

Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
@roidelapluie roidelapluie changed the title Add PromQL Metadata proposal PROM-0097: PromQL Metadata support Sep 22, 2026
@roidelapluie roidelapluie changed the title PROM-0097: PromQL Metadata support PROM-0097: PromQL Metadata querying / promotion. Sep 22, 2026
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>

4. Native metadata can optionally be promoted to labels with the `as` keyword.

`foo{resource[power.status] as power_status}` `foo{namespace["super+name"] as "supername"}`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

So what are the keywords allowed here? resource namespace? What else?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This proposal is agnostic of the keywords. The keywords are actual namespaces of metadata and should be defined in a broader metadata design doc like the ones that exist. I can think of resource for OTLP: resource, k8s, host, service...

@bwplotka bwplotka Sep 23, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks. I am missing an exact definition of "namespace" or "scope", especially how it would be reflected in Prometheus world. Also if we expect UTF-8 in those (:

Maybe it's out of scope, but then how we could understand limitations of <prefix>[<suffix>] syntax?

If we mean here OTel entity namespaces and let's take process.executable)

Then should I go for

cpu_info{process["executable.name"]="docker" as exec}
or
cpu_info{"process.executable"[name]="docker" as exec}

..and if this "namespacing" is required, why not cpu_info{["process.executable.name"]="docker" as exec}

Then can we guarentee some namespace is always there for metadata?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I believe we can have better and will do a second proposal later.

@roidelapluie

Copy link
Copy Markdown
Member Author

Closing in favour of #99

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.

2 participants