prometheus / prometheus/prom2json

Add OpenMetrics support

Open
#208 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Go
Stars
411
Forks
94
PR merge metrics
No merged PRs in 30d

Description

Hi, I wanted to use prom2json to convert the output of promtool tsdb dump-openmetrics, but I get the following error:

error reading metrics: reading text format failed: text format parsing error in line 1: expected integer as timestamp, got "1739184970.553"

Here is the corresponding line:

go_gc_duration_seconds{instance="node5",job="file_discovery",quantile="0.0"} 0 1739184970.553

As I understand it, this comes from a breaking change between Prometheus exposition format and the OpenMetrics one that the timestamp must be in seconds.

Is parsing OpenMetrics format in the scope of prom2json?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the text-format parser used when prom2json reads output from promtool tsdb dump-openmetrics, then reproduce the reported decimal-timestamp failure with the example metric. Check the existing parser tests and define done as accepting OpenMetrics timestamps without breaking current Prometheus exposition parsing.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, prometheus
Domain
cli, observability
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.