Comments (7)
You should insert to the line column instead as clients do.
Ah yes... that seems to have fixed it.
More importantly everything works as intended when using Loki clients and Grafana which is our intended usecase.
The usecase I'm playing with cloki for is quite similar but I'm a suckler for testing APIs directly to know what's flowing in and out! π. I also confirmed via grafana that the data being pushed manually via is being returned there! Would be nice to have some simple examples to have people up and running, but can close this out for now! π
Thanks again @lmangani !
from qryn.
Hello @navinpai
Thanks for your report! There are indeed "leftovers" of the Loki 1.0 API here and there, and documentation for manual actions might need refresh. We'll make sure the examples for the query
API are rectified in the coming days.
Now, query
is used for doing queries against a single point in time, while most of the focus is on the Grafana integration at this time where query_range
is the core function:
Here's a working example:
curl -G -s localhost:3100/loki/api/v1/query_range --data-urlencode 'query={type="clickhouse"}'
EDIT: Wiki has been updated!
from qryn.
Patches for /query
endpoint being worked in #65
from qryn.
Thanks for the quick reply @lmangani
Unfortunately, looks like query_range
is not working for me either.
How to Reproduce
node v.17.0.1
cloki (current master: f3b32b5)
clickhouse v 21.12.1.8808
# Run Cloki to create initial tables in empty test db
DEBUG="true" CLICKHOUSE_SERVER="127.0.0.1" CLICKHOUSE_AUTH="default:" CLICKHOUSE_DB="test" node ./cloki.js
# Push log
$ curl -i -XPOST -H "Content-Type: application/json" http://localhost:3100/loki/api/v1/push --data '{"streams":[{"labels":"{\"__name__\":\"metric\"}","entries":[{"timestamp":"2021-11-21T16:00:06.944Z","value":"100"}]}]}'
HTTP/1.1 200 OK
# Ensure label is present
$ curl localhost:3100/loki/api/v1/label/__name__/values
{"status":"success","data":["metric"]}
# Query for data
curl -G -s localhost:3100/loki/api/v1/query_range --data-urlencode 'query={__name__="metric"}'
{"status":"success", "data":{ "resultType":"streams", "result": []}}
Debug logs show:
GET /loki/api/v1/query_range
QUERY: [Object: null prototype] { query: '{__name__="metric"}' }
Scanning Fingerprints...
Scanning Fingerprints...
and I also see the data in clickhouse in time_series
table and the samples_read
table:
ββββββββdateββ¬βfingerprintββ¬βlabelsβββββββββββββββββ¬βnameββ
β 2021-11-21 β 1417368218 β {"__name__":"metric"} β β
ββββββββββββββ΄ββββββββββββββ΄ββββββββββββββββββββββββ΄βββββββ
ββfingerprintββ¬ββtimestamp_msββ¬βvalueββ¬βstringββ
β 1417368218 β 1637510406944 β 100 β β
βββββββββββββββ΄ββββββββββββββββ΄ββββββββ΄βββββββββ
Any idea what I may be missing here?
from qryn.
Thanks for the details, I see the issue now - the example is a bit misleading and it seems you're inserting metrics rather than strings/logs. This is a special feature for timeseries. You should insert to the line column instead as clients do.
curl -i -XPOST -H "Content-Type: application/json" http://localhost:3100/loki/api/v1/push --data '{"streams":[{"labels":"{\"__name__\":\"up\"}","entries":[{"timestamp":"2020-11-21T21:00:09.999Z","line":"zzz"}]}]}'
Things should work if you push lines (please confirm)
More importantly everything works as intended when using Loki clients and Grafana which is our intended usecase.
from qryn.
Unrelated note: only node 14.x and 16.x are officially supported & tested, other version might fail.
from qryn.
We'll extend the documentation with better examples. Thanks for taking the time to confirm & welcome to our users family!
from qryn.
Related Issues (20)
- issue with prometheus remote write HOT 9
- error when trying to query prometheus HOT 1
- error on startup - docker HOT 3
- Decommission stddev_over_time usage HOT 4
- occasional exception in CPU graph HOT 1
- Prometheus Datasource problems HOT 3
- metrics select error on clickhouse cluster HOT 1
- When creating tables, create them with a storage policy if env var is set HOT 5
- Grafana > 10.1 tempo fail HOT 4
- Qryn bun get metrics error HOT 4
- Why limit MaxSamples to 100000? HOT 6
- Slow metrics requests HOT 6
- [Feature request] Frontend behind a reverse proxy HOT 4
- Wrong statuscode when Database push error HOT 3
- Inserted 'NaN' values are stored as zero in samples_v3 HOT 9
- Unexpected metrics gaps HOT 2
- Loki json formatter long response HOT 3
- Metrics labels and values in loki logs HOT 21
- No such file or directory error when starting qryn HOT 3
- suggest changing the insert operation to directly write to the local table instead of the distributed table HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qryn.