grafana / worldmap-panel

Worldmap panel plugin for Grafana 3.0 that can be overlaid with circles for data points.
MIT License
309 stars 199 forks source link

Is the Loki datasource supported? #254

Closed jorgelbg closed 4 years ago

jorgelbg commented 4 years ago

I've been playing with Loki recently and trying to create a map using this plugin without any success. AFAIK the response from the Loki datasource should be fairly similar to the Prometheus one.

I'm testing with the following query:

count_over_time({country="DE",place=~".+"}[1h])

When inspecting the query this is the output:

Query Inspector output:
{
  "xhrStatus": "complete",
  "request": {
    "method": "GET",
    "url": "api/datasources/proxy/1/loki/api/v1/query_range?direction=BACKWARD&limit=1®exp=&query=count_over_time(%7Bcountry%3D%22DE%22%2Cplace%3D~%22.%2B%22%7D%5B1h%5D)&start=1582743866000000000&end=1582765467000000000&step=21600"
  },
  "response": {
    "status": "success",
    "data": {
      "resultType": "matrix",
      "result": [
        {
          "metric": {
            "host": "somehost",
            "job": "name-of-your-job",
            "place": "Dublin",
            "source": "Name-of-your-source",
            "country": "DE",
            "geohash": "gc7x"
          },
          "values": [
            [
              1582765466,
              "1"
            ]
          ]
        }
      ],
      "stats": {
        "summary": {
          "bytesProcessedPerSeconds": 28067,
          "linesProcessedPerSeconds": 467,
          "totalBytesProcessed": 60,
          "totalLinesProcessed": 1,
          "execTime": 0.002137707
        },
        "store": {
          "totalChunksRef": 1,
          "totalChunksDownloaded": 1,
          "chunksDownloadTime": 0.000238201,
          "headChunkBytes": 0,
          "headChunkLines": 0,
          "decompressedBytes": 60,
          "decompressedLines": 1,
          "compressedBytes": 89,
          "totalDuplicates": 3
        },
        "ingester": {
          "totalReached": 1,
          "totalChunksMatched": 0,
          "totalBatches": 0,
          "totalLinesSent": 0,
          "headChunkBytes": 0,
          "headChunkLines": 0,
          "decompressedBytes": 0,
          "decompressedLines": 0,
          "compressedBytes": 0,
          "totalDuplicates": 0
        }
      }
    }
  }
}

yet, when configuring the datasource following what is recommended in this post and in issue #245 does not work.

I keep getting the following error: "Error: Missing geohash value".

ℹ️ If I use a Table visualization with the same query I get a Metric column with the following content (matching the metric from the JSON payload):

{host="somehost",job="name-of-your-job",place="Dublin",source="Name-of-your-source",country="DE",geohash="gc7x"}
austenmadden commented 4 years ago

Would be curious to know the answer to this. We were considering putting Loki data into a map as well.

jorgelbg commented 4 years ago

@austenmadden I managed to get it working, the issue was that the options available for customizing the query for the Loki datasource are not the same as for a Prometheus datasource.

The good news is that we can configure Loki as a Prometheus datasource in Grafana. We just need to use the http://<ip>:<port>/loki path. We can now, use the same toggles on Loki as if it were a Prometheus server (with the subset of PromQL supported by LogQL).

austenmadden commented 4 years ago

@jorgelbg Thank for the quick followup. That seems like a solid workaround. Good to know!

jorgelbg commented 4 years ago

Any time. I'm closing this issue since we already know the answer.