Skip to content

Crash if tags and not the same (allow different tags for the same metric name) #125

@blindspotbounty

Description

@blindspotbounty

Recently we had a crash due to not the same tags originating from different plugins from https://github.com/swift-server/swift-prometheus/blob/main/Sources/Prometheus/PrometheusCollectorRegistry.swift#L314.

We may load some arbitrary number of plugins that may define their own metrics. That may break when one of the plugin doesn't know about other one or if one of the plugins added its own specific distinguishing label.

I would like to be able to define the same metric with different set of values.
Particularly, that would be great if:

  1. Not to crash on different labels: assert, ignore or throw exception where possible?
  2. Add some option for enabling behavior with different labels allowed (or allow it permanently)

Thanks in advance, there are some links from prometheus interactions discussions (TL;DR)

Some info on related java libraries case for prometheus and compatibility below.
If I understand correctly that was some recommended behavior for Prometheus but didn't find anywhere those constraints and even their own metrics do not follow those recommendations.
Furthermore, their page advises that empty labels is the same as no labels at all.

There were some experiments around java micrometer library and some discussions around prometheus client_java library. Though, non of the discussions finished with any concrete conclusion, that is being massively workarounded al the related issues in various java libraries due to the lack for the fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions