influxdbinfluxql

Fetching data from influxDB using tag value returning null values


From my script I am sending all my telemetry data to influx DB and fetching them from Grafana. I am trying filter the values using a variable which I am creating using tag values. But it is fetching 0 values but it is working for other. Please check below details.

Fetching all the telemetry data using : http://localhost:8086/query?db=ApiGatewayManagement&q=SELECT * FROM JMeter_Result

Output from above query:

{
    "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"
                        ]
                    ]
                }
            ]
        }
    ]
}

And I am trying to create a filter variable using http://localhost:8086/query?db=ApiGatewayManagement&q=SHOW TAG VALUES FROM "JMeter_Result" WITH KEY=" ScenarioID"

I am getting null value: (output of the above)

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

But same work for requestName

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

O/P:

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

What I am missing here ?


Solution

  • Don't see issue with any of your query, but it seems ScenarioID is not associated with tag, because of which you are getting null value.

    if you query the following and if it return ScenarioID in the list then you will get the result but if it not then you will observe the result which you posted. And in second case you need to change the input logic influx DB and make ScenarioID as the tag.

    http://localhost:8086/query?db=ApiGatewayManagement&q=SHOW TAG KEYS