Skip to content

Duplicate labels in JSON parsing causing metric conflicts #394

@buzztekk

Description

@buzztekk

I’m encountering an issue where my JSON contains duplicate labels with no unique identifier to distinguish them. The exporter fails with the error:

text
An error has occurred while serving metrics:
collected metric "litellm_endpoint_status_health" {
label:{name:"api_base" value:"deepseek-r1"}
label:{name:"model" value:"hosted_vllm"}
untyped:{value:1}
} was collected before with the same name and label values
Problem:

The JSON data has multiple entries with identical api_base and model labels.

There is no unique field (like an id) to differentiate them.

Questions:

Is there a way to automatically add a unique index (e.g., an incrementing counter) to each JSON node?
(For example: endpoint_id: "1", endpoint_id: "2", etc.)

If not, can I simply allow or suppress duplicate labels?
(Some exporters have flags like --allow-duplicate-metrics—does json_exporter support this?)

Workarounds I’ve considered (but need guidance on):

Modifying the JSON source (not always possible).

Using a custom template or script to inject uniqueness (if supported).

Any advice or configuration options to handle this?

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