Skip to content

Using timestamp from api as timestamp in promehteous metric #80

@mostafashr

Description

@mostafashr

Is there a way to use timestamp from the api data as timestamp in output result? in promehteous documentation in instrumentation part there is :

metric_name [
  "{" label_name "=" `"` label_value `"` { "," label_name "=" `"` label_value `"` } [ "," ] "}"
] value [ timestamp ]

I have this data from my api:

{
  "data": {
    "object1": {
      "label": "test1",
      "value": 25551.671688,
      "timestamp": 1613115501
    },
    "object2": {
      "label": "test1"
      "value": 20630.985927,
      "timestamp": 1613115603
    }
}

is it possible to get output like this?

example_metrics{label="test1"}   20630.985927   1613115603
example_metrics{label="test1"}   25551.671688   1613115501

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