influxdata / influxdata/influxdb

[v3] Query fails when filtering on a tag with an "@" in the key

Open
#24,081 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/flux kind/bug v3 v3/core
Dominant language
Rust
Stars
31.7k
Forks
3.7k
Avg merge
13h 37m
Merged PRs (30d)
8

Description

Steps to reproduce:
List the minimal actions needed to reproduce the behavior.

  1. using telegraf and the jti_openconfig plugin, retrieve some metrics from a juniper device
  2. attempt to select some data points by filtering on the /interfaces/interface/@name tag

A couple significant sample queries that should show the issue:
This gives no results:
from(bucket: "jti_metrics_2")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "/interfaces/interface/state/counters_jti")
|> filter(fn: (r) => r["/interfaces/interface/@name"] == "em1")

This works:
import "influxdata/influxdb/schema"
schema.measurementTagValues(bucket: "jti_metrics_2",measurement: "/interfaces/interface/state/counters_jti",tag: "/interfaces/interface/@name")
|> filter(fn: (r) => r["_value"] == "em1")

So: Tag value seems to be indeed “em1”, but using this string in a filter doesn’t find any lines. Removing the filter on the interface name tag show data lines. It seems to be the same thing for all tag names that contain an “@” symbol, but the symbol in itself isn’t the issue. More importantly, using a preprocessor in telegraf to rename the tag actually works.

Sample preprocessor configuration:
[[processors.rename]]
namepass = ["/interfaces/interface/subinterfaces/subinterface/state/counters/_jti"]
[[processors.rename.replace]]
tag = "/interfaces/interface/@name"
dest = "interface_name"

Expected behavior:
Results are returned

Actual behavior:
No results are returned

Environment info:

  • System info: Linux 5.15.0-58-generic x86_64
  • InfluxDB version: Influx CLI 2.6.1 (git: 61c5b4d) build_date: 2022-12-29T15:41:09Z

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the two Flux queries against the Telegraf and jti_openconfig data described in the issue, comparing the failing tag filter with schema.measurementTagValues. Investigate how the /interfaces/interface/@name tag is handled during filtering; done means the original query returns the expected em1 data points without renaming the tag.

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
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.