profile
viewpoint

Ask questionsSupport timestamp option on prometheus import API

Is your feature request related to a problem? Please describe.

When I push metrics to /api/v1/import/prometheus, I want to specify a timestamp.

Describe the solution you'd like

/api/v1/import/prometheus?timestamp=1594370496905

Describe alternatives you've considered

add timestamps on prom file one by one

Additional context

our architecture:

IoT devices --> gateway --> pubsub --> worker --> VictoriaMetrics

IoT devices post prom formatted metrics (without timestamp) to gateway, and we push it to VictoriaMetrics through pubsub. Since there exist some latency on this path, I want to specify metrics timestamp by myself, instead of using current timestamp in VM import API layer.

VictoriaMetrics/VictoriaMetrics

Answer questions ledmonster

Thank you, it works as expected.

$ curl -v  --data-binary @node-exporter.prom  'http://localhost:8428/api/v1/import/prometheus?extra_label=job=curl&extra_label=instance=pc&timestamp=1599894041764'
$ curl -G 'http://localhost:8428/api/v1/query' --data-urlencode 'query=go_gc_duration_seconds[5m]' | jq . 
{
  "status": "success",
  "data": {
    "resultType": "matrix",
    "result": [
      {
        "metric": {
          "__name__": "go_gc_duration_seconds",
          "job": "curl",
          "instance": "pc",
          "quantile": "1"
        },
        "values": [
          [
            1599894041.764,
            "0.007358708"
          ]
        ]
      },
      {
        "metric": {
          "__name__": "go_gc_duration_seconds",
          "job": "curl",
          "instance": "pc",
          "quantile": "0.25"
        },
        "values": [
          [
            1599894041.764,
            "0.000048134"
          ]
        ]
      },
      {
        "metric": {
          "__name__": "go_gc_duration_seconds",
          "job": "curl",
          "instance": "pc",
          "quantile": "0.5"
        },
        "values": [
          [
            1599894041.764,
            "0.000071184"
          ]
        ]
      },
      {
        "metric": {
          "__name__": "go_gc_duration_seconds",
          "job": "curl",
          "instance": "pc",
          "quantile": "0"
        },
        "values": [
          [
            1599894041.764,
            "0.000009038"
          ]
        ]
      },
      {
        "metric": {
          "__name__": "go_gc_duration_seconds",
          "job": "curl",
          "instance": "pc",
          "quantile": "0.75"
        },
        "values": [
          [
            1599894041.764,
            "0.001780718"
          ]
        ]
      }
    ]
  }
}
useful!

Related questions

Failure to deploy with `helm template` in ArgoCD hot 2
Remote write for Prometheus not working hot 1
Graph missing some points hot 1
How to write data to VictoriaMetrics individually in batches? hot 1
Add data deduplication from HA Prometheus pair based on `--query.replica-label` arg similar to Thanos Query hot 1
Can't start VictoriaMetrics use docker-compose and volume mapping on Windows hot 1
Downsampling data - VictoriaMetrics hot 1
While under heavy load getting error panic hot 1
While under heavy load getting error panic hot 1
While under heavy load getting error panic hot 1
Windows build hot 1
Increase default value for -search.maxPointsPerTimeseries hot 1
changing precisionBits doesn't result in change in precision of stored value hot 1
Drop-in replacement prometheus not work with promxy (Prometheus HA) hot 1
source:https://uonfu.com/
Github User Rank List