New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trying to under stand the format of PUT's and GET's #58
Comments
You need to design your time series first. In Opentsdb format, a time series should have a metric name, one or more tag-value pairs. There are a series of data points in a time series. Each data point defines what value the time series is at a specific timestamp. In you case, you should have 3 metrics (temperature, humidity, and pressure) and all of them have one tag, location.
Assume there are two locations, 'garden' and 'living_room'. At 11am 9/26/2023 PDT (i.e., Unix epoch time 1695751200), the temperatures are 80 and 70 degree in the garden and living_room respectively. If you use curl, run these two commands: (Note you need to use your TT host and port in the following, e.g., 192.168.0.2:6182)
Humidity and pressure are similar. If you want to send writes in other languages, e.g., python, you can look at a wiki here
Let's say you want to query the temperature in the garden 11am 9/26/2023 PDT, do this:
There are lots of examples in this wiki. Hope they will help. |
According to teh documentation a put ie in this form: but when I retrieve the data like this: results: Why am I doing wrong? |
Looks there are some other data points than the two you just added in the time range [1696695000, 1696695000+10minutes). Can you run the query without 10m-avg (i.e., m=avg:temperature instead of m=avg:10m-avg:temperature) to see what you get? |
Just to let you know I have a sensor send in temperature and pressure every 30 seconds and I grab weather data from openweatermap every 30 minutes (temperature, Humidity and pressure) Here it is:
|
I missed your question since the format was messed up. I believe you meant to ask why two queries with different locations returns the same result. What I would do is to make sure the specific data points are actually inserted in TT first.
This data point was actually successfully inserted in TT, as you can see it in the query result without downsampling (i.e., m=avg:temperature{location=office}). Just search 1696695267 in your query result, you can see the value 78.6200000000000045 (the last two digit 45 is due to precision lost in data compression).
This data point is not supposed to be in your query result since its location is not 'office'. I don't know what's wrong with your first query. Maybe the two time series happen to have same values at the time range [1696695000,+10min). You can do the same query without downsampling but with location='foxboro' (i.e, m=avg:temperature{location=foxboro}) to see if the data point is correctly inserted or not. BTW, to make query result concise, you can adjust start and end timestamps to limit the time range, e.g., start=1696695000 &end=1696696000 |
I ran a test to show the problem so there are just two data points,
here is what I did:
The same two entries are returned
How can I retrieve the data from just one location? |
p.s. just to see what would happen, I changed things in the put and crashed ticktock
in addition, the data files and mete were wiped out
(I'm good at breaking things (grin) |
hm, this is a serious bug. Let me repro it in my side. I assume you use the latest version 0.12.1, don't you? |
The put statement looks fine to me. TT shouldn't crash anyway. Are you running it in what hardware (RPI on bullseye 32bit) and what version of TT (v0.12.1)? |
Running on a PI 2 Model B running Bullseye 32 bit |
Oh, and it is ticktock.0.12.1 |
oh, I know why. Your query format is wrong. You have an extra '&' between temperature and {location=office}
I can repro it.
Note there is no '&' after temperature. Another hint is We will think about how to add validation message to protect users from mis-typos. I am still trying to repro your crash case. |
I was basing the query off this the Usage Examples:
|
Unfortunately I am not able to repro the crash. Please refer to my execution below.
|
I add another note after this example in the wiki. Also note that there is no & in between m=avg:testM1 and {host=foo}. If you add a & in between, then anything after & won't be considered as part of query parameters m=aggregator:downsampler:metric{tag1=val1,tag2=val2...}. The results would be like no tags is specified. |
Yea!! Thank you so much. That works!! And I was wrong about where I got that from. At this point I've tried so many iterations I probably added it in at some point. Do you want me to try and reproduce the crash in another thread and if so is there any information I can gather to help debug it? |
Crash is hard to debug unless with core dump and in debug mode. It would be great if you can repro reliably. Just collect the steps and maybe logs. |
So I have TickTock running and I the ping/pong works and the example curl statements to put and get readings work fine but I can seem to get others to work.
Let's say I want to collect temperature, humidity and pressure readings from more than one location (say 'location1' and 'location2').
1)How would I code a put (or multiple put's) for the three values and for the two locations.
2) how would I code a GET to get the data from one of the locations?
Once I can do that I should be able to work more things out myself.
p.s. I have been looking at the documentation at opentsdb.net/docs but so far it hasn't helped.
Thanks!
The text was updated successfully, but these errors were encountered: