使用标签值返回空值从 influxDB 中获取数据

问题描述 投票:0回答:1

在我的脚本中,我将所有遥测数据发送到 influx DB 并从 Grafana 获取它们。我正在尝试使用我使用标签值创建的变量来过滤值。但它正在获取

0
值,但它正在为其他值工作。请检查以下详细信息。

使用以下方法获取所有遥测数据:

http://localhost:8086/query?db=ApiGatewayManagement&q=SELECT * FROM JMeter_Result

上述查询的输出:

{
    "results": [
        {
            "statement_id": 0,
            "series": [
                {
                    "name": "JMeter_Result",
                    "columns": [
                        "time",
                        "ScenarioID",
                        "errorCount",
                        "httpstatuscode",
                        "receivedBytes",
                        "requestName",
                        "responseMessage",
                        "responseTime",
                        "responsecode",
                        "samplecount",
                        "sentBytes",
                        "status"
                    ],
                    "values": [
                        [
                            "2023-02-23T15:54:51.529Z",
                            "ambratest_sprint_01",
                            0,
                            "200",
                            7978228,
                            "T01_LaunchApplication",
                            "Number of samples in transaction : 1, number of failing samples : 0",
                            6673,
                            "200",
                            1,
                            7000,
                            "Success"
                        ],
                        [
                            "2023-02-23T15:54:58.315Z",
                            "ambratest_sprint_01",
                            1,
                            "401",
                            1565,
                            "T02_Login",
                            "Number of samples in transaction : 2, number of failing samples : 1",
                            570,
                            "401",
                            1,
                            1168,
                            "Failure"
                        ],
                        [
                            "2023-02-23T16:04:38.904Z",
                            "ambratest_sprint_02",
                            0,
                            "200",
                            7978237,
                            "T01_LaunchApplication",
                            "Number of samples in transaction : 1, number of failing samples : 0",
                            9591,
                            "200",
                            1,
                            7000,
                            "Success"
                        ],
                        [
                            "2023-02-23T16:04:48.635Z",
                            "ambratest_sprint_02",
                            0,
                            "200",
                            10923,
                            "T02_Login",
                            "Number of samples in transaction : 6, number of failing samples : 0",
                            1942,
                            "200",
                            1,
                            3518,
                            "Success"
                        ]
                    ]
                }
            ]
        }
    ]
}

我正在尝试使用创建一个过滤器变量

http://localhost:8086/query?db=ApiGatewayManagement&q=SHOW TAG VALUES FROM "JMeter_Result" WITH KEY=" ScenarioID"

我得到空值:(上面的输出)

{
    "results": [
        {
            "statement_id": 0
        }
    ]
}

但是对于

requestName

同样的工作

http://localhost:8086/query?db=ApiGatewayManagement&q=SHOW TAG VALUES FROM "JMeter_Result" WITH KEY="requestName"

开/关:

{
    "results": [
        {
            "statement_id": 0,
            "series": [
                {
                    "name": "JMeter_Result",
                    "columns": [
                        "key",
                        "value"
                    ],
                    "values": [
                        [
                            "requestName",
                            "T01_LaunchApplication"
                        ],
                        [
                            "requestName",
                            "T02_Login"
                        ]
                    ]
                }
            ]
        }
    ]
}

我在这里缺少什么?

influxdb influxql
1个回答
0
投票

没有看到您的任何查询有问题,但似乎

ScenarioID
与标签无关,因此您获得了
null
值。

如果您查询以下内容并且它在列表中返回

ScenarioID
那么您将得到结果但如果不是那么您将观察到您发布的结果。在第二种情况下,您需要更改输入逻辑 influx DB 并将
ScenarioID
作为标签。

http://localhost:8086/query?db=ApiGatewayManagement&q=SHOW TAG KEYS
© www.soinside.com 2019 - 2024. All rights reserved.