prometheus / prometheus/common

How to use model.Value?

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

Nobody has claimed this yet.

Dominant language
Go
Stars
295
Forks
367
Avg merge
2d 10h
Merged PRs (30d)
18

Description

I am using the Go client for Prometheus, but I wonder how to parse the response data in model.Value (including Vector and Matrix). I have checked the source code, only to find the String() method to get the Vector like {pod="test-001-deployment-896b6d55b-bs586"} => 0.06435052290435223 @[1598949467.625] {pod="test-003-deployment-665d48fb7f-dlxfb"} => 0.03620828100637146 @[1598949467.625]. So, how can I use the model data gracefully?

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 reading the Go client's model.Value, Vector, and Matrix definitions and the existing String() behavior mentioned in the issue. Determine how the response types are intended to be inspected or parsed, and document the supported usage for both Vector and Matrix.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, prometheus
Domain
observability-sre
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.