influxdata / influxdata/influxdb

schema.tagValues not working properly or ignoring "time" parameter

Open
#23,211 8 comments 12 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
31.7k
Forks
3.7k
Avg merge
13h 37m
Merged PRs (30d)
8

Description

Hello, i'm having issues with `schema.tagValues` function returning to many tags.

Here's env details

- Red Hat Enterprise Linux release 8.5 (Ootpa)

- InfluxDB 2.1.1
Server: [657e183](https://github.com/influxdata/influxdb/tree/657e1839de)
Frontend: [cc65325](https://github.com/influxdata/ui/tree/cc65325)

- Influx installed via official RPM

if I use `schema.tagValues` with -1h (then same happen with any time range) it will return tag values outside that range

```
import "influxdata/influxdb/schema"
schema.tagValues(bucket: "prometheus", tag: "instance", predicate: (r) => r["_measurement"] == "node_cpu_usage_seconds_total", start: -1h)
```
i get

table_RESULT | _valueNO GROUPSTRING
-- | --
0 | 172.242.0.11
0 | 172.242.0.6
0 | 172.242.128.10
0 | 172.242.128.14
0 | 172.242.64.12
0 | 172.242.64.5

In order to verify real tags I run the following query on the same time range

```
from(bucket: "prometheus")
|> range(start: 2022-03-18T15:17:35.987Z, stop: 2022-03-18T16:17:35.987Z)
|> filter(fn: (r) => r["_measurement"] == "node_cpu_usage_seconds_total" )
|> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
|> group()
|> unique(column: "instance")
|> keep(columns: ["instance","_start","_stop"])
```
I get certaing tag values

table_RESULT | instanceNO GROUPSTRING
-- | --
0 | 172.242.0.11
0 | 172.242.128.14
0 | 172.242.64.12

which are correct. I suspect an issue with the function since we do not delete any tag or serie and we don't have a retention policy set.

Contributor guide

Open the contributing guide

Research direction

Start by running the supplied schema.tagValues query against the stated InfluxDB environment, then compare its results with the accompanying range, filter, and unique query. Trace the schema.tagValues entry point to determine why values outside the requested time range are returned; done means the results contain only tag values present in that range.

Written by the indexing model from the issue text.

Assessment

Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.