Comments (12)
for unix := 1680742861; unix < 1681261261; unix += 10 {
// cpu params
CpuS := CpuParams()
// write cpu data
uT := int64(unix)
date := time.Unix(uT, 0)
wc.AddPoint(context.TODO(), api.NewPoint("cpu").
SetTimestamp(date). // <= set timestamp
AddTag("host", "host1").
AddField(api.NewLast("free", CpuS.free)).
AddField(api.NewLast("usage", CpuS.usedPer)).
AddField(api.NewLast("core1", CpuS.core1)).
AddField(api.NewLast("core2", CpuS.core2)).
AddField(api.NewLast("core3", CpuS.core3)).
AddField(api.NewLast("core4", CpuS.core4)).
AddField(api.NewLast("core5", CpuS.core5)).
AddField(api.NewLast("core6", CpuS.core6)).
AddField(api.NewLast("core7", CpuS.core7)).
AddField(api.NewLast("core8", CpuS.core8)).
AddField(api.NewLast("MHz", CpuS.usedMHz)))
}
from client_go.
You my best friend!!!!!))))))
from client_go.
Currently, reading data through the client is not supported.
LinDB provides a Restful API, data and status can be read through HTTP.
Ref:
A version can be released this week to support reading data and status through the client.
from client_go.
@SerjZimmer v0.0.2, reading metric data and metadata is supported.
example: https://github.com/lindb/client_go/blob/main/example/read_data.go
from client_go.
Great, thank you ! Could you add more early examples of linQL?
from client_go.
Great, thank you ! Could you add more early examples of linQL?
Ref: https://lindb.io/guide/lin-ql.html#metric-query
from client_go.
Thank you so much, sorry for the interrogations) Is there a way to download demo metrics for the period I need? Or just real-time metrics?
from client_go.
Do you mean to periodically query related metrics and save them? If yes, you can periodically query the corresponding metric data and save the results to a file.
Steps:
- invoke data query api, you can set query time range, for example:
select load from system.cpu where time>'2023-04-10 20:00:00' and time<'2023-04-10 20:05:00' - marshal result set as json format;
- save json data to a file;
from client_go.
I mean the need in my case to write down the data for the past week. For example. I make a request for certain metrics from 2023.04.04 to 2023.04.11 and the result is that there is no data in this time interval. So, can I add randomly generated data to this interval?
from client_go.
You can specify the time range that can be written in the new database(https://lindb.io/guide/lin-ql.html#create-database), and the data within this time range can be written.
Can set timestamp of data point(https://github.com/lindb/client_go/blob/main/api/point.go#L59).
For example: now => 2023.04.11 02:00:00
- database config: behead => 7d , ahead => 1h , data can be written in (now-7d ~ now+1h)
- data point => 2023.04.08 12:02:00 can be written
- data point => 2023.04.03 22:00:02 will be rejected
- data point => 2023.04.11 03:02:02 will be rejected
from client_go.
Thank you so much!
from client_go.
where should i put the new date?
for unix := 1680742861; unix < 1681261261; unix += 10 {
// cpu params
CpuS := CpuParams()
// write cpu data
uT := int64(unix)
date := time.Unix(uT, 0)
point := api.Point{}
point.SetTimestamp(date)
wc.AddPoint(context.TODO(), api.NewPoint("cpu").
AddTag("host", "host1").
AddField(api.NewLast("free", CpuS.free)).
AddField(api.NewLast("usage", CpuS.usedPer)).
AddField(api.NewLast("core1", CpuS.core1)).
AddField(api.NewLast("core2", CpuS.core2)).
AddField(api.NewLast("core3", CpuS.core3)).
AddField(api.NewLast("core4", CpuS.core4)).
AddField(api.NewLast("core5", CpuS.core5)).
AddField(api.NewLast("core6", CpuS.core6)).
AddField(api.NewLast("core7", CpuS.core7)).
AddField(api.NewLast("core8", CpuS.core8)).
AddField(api.NewLast("MHz", CpuS.usedMHz)))
}
from client_go.
Related Issues (7)
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 client_go.