influxdata / influxdata/influxdb1-client
How to read tags from InfluxDB
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 192
- Forks
- 109
- PR merge metrics
- No merged PRs in 30d
Description
Hi all,
I have an InfluxDB with a measurement called "connections" that keep all the info related to PostgreSQL connections.
The measurement (table) has the following fields:
- active
- idle
- idle-transaction
- total
- waiting
and the following tags in the Grafana dashboard will be used to filter the data:
- env
- instance
- dbname
- hostname
Now I use the influxdb1-client to query these info with the following code:
client, err = client.NewHTTPClient(
client.HTTPConfig{Addr: "http://localhost:8086",
Username: "myuser",
Password: "mypwd",
InsecureSkipVerify: "false"})
if err != nil {
return nil, err
}
q := client.Query{
Command: "select * from backends",
Database: "myinfluxdb",
}
if response, err := client.Query(q); err == nil {
if response.Error() != nil {
return res, response.Error()
}
res = response.Results
} else {
return res, err
}
This code works fine but my problem is that this code only retrieves fields. The field res[0].Series[0].Tags is empty.
How I should change the code to read also, for each row in the measurement, the relative tags?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Query call shown in the issue and inspect the returned Series and Tags fields using the repository's client behavior. No file or test is named, so first locate the response parsing and query examples. Done means documenting how tags are returned for the stated measurement and clarifying the expected response shape.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- databases
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100