Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
prom2json
✓ github.com/prometheus/prom2json
Parses Prometheus metrics text and returns JSON.
package main
import (
"fmt"
"github.com/prometheus/prom2json"
)
func main() {
// Example usage: parse a Prometheus metrics string
metrics := "# HELP go_gc_duration_seconds A summary of the GC invocation durations.\n# TYPE go_gc_duration_seconds summary\ngo_gc_duration_seconds{quantile=\"0\"} 0.0001\n"
result, _ := prom2json.Parse(metrics)
fmt.Println(result)
}
Debug
Known issues
No known issues recorded.
Upgrade
Version history
1.5.0latest on pkg.go.dev
Audit
Dependencies
No dependency data recorded yet.