Query Service: Combine SSE handling in single tenant and multi tenant paths (#108041)

* parse via sse

I need to figure out how to handle the pipeline.execute with our own
client. I think this is important for MT reasons, just like using our
own cache (via legacy) is important.

parsing is done though!

* WIP nonsense

* horrible code but i think it works

* Add support for sql expressions config settings

* Cleanup:
- remove spew from nodes.go
- uncomment out plugin context and use in single tenant flow
- make code more readable and add comments

* Cleanup:
- create separate file for mt ds client builder
- ensure error handling is the same for both expressions and regular queries
- other cleanup

* not working but good thoughts

* WIP, vector not working for non sse

* super hacky but i think vectors work now

* delete delete delete

* Comments for future ref

* break out query handling and start test

* add prom debugger

* clean up: remove comments and commented out bits

* fix query_test

* add prom debugger

* create table-driven tests with testsdata files

* Fix test

* Add test

* go mod??

* idk

* Remove comment

* go enterprise issue maybe

* Fix codeowners

* Delete

* Remove test data

* Clean up

* logger

* Remove go changes hopefully

* idk go man

* sad

* idk i ran go mod tidy and this is what it wants

* Fix readme, with much help from adam

* some linting and testing errors

* lint

* fix lint

* fix lint register.go

* another lint

* address lint in test

* fix dead code and linters for query_test

* Go mod?

* Struggling with go mod

* Fix test

* Fix another test

* Revert headers change

* Its difficult to test this in OSS as it depends on functionality defined in enterprise, let's bring these tests back in some form in enterprise

* Fix codeowners

---------

Co-authored-by: Adam Simpson <adam@adamsimpson.net>
This commit is contained in:
Sarah Zinger
2025-07-17 17:22:55 -04:00
committed by GitHub
co-authored by Adam Simpson
parent 8acdc7e37b
commit 3fad863fd1
34 changed files with 763 additions and 1662 deletions
-29
View File
@@ -1,29 +0,0 @@
{
"description": "self dependencies",
"input": {
"from": "now-6",
"to": "now",
"queries": [
{
"refId": "A",
"datasource": {
"type": "",
"uid": "__expr__"
},
"expression": "$B",
"type": "math"
},
{
"refId": "B",
"datasource": {
"type": "",
"uid": "__expr__"
},
"type": "math",
"expression": "$A"
}
]
},
"expect": {},
"error": "[sse.cyclic] cyclic reference in expression []"
}
@@ -1,60 +0,0 @@
{
"input": {
"from": "now-6",
"to": "now",
"queries": [
{
"refId": "A",
"datasource": {
"type": "plugin-x",
"uid": "123"
}
},
{
"refId": "B",
"datasource": {
"type": "plugin-x",
"uid": "456"
}
}
]
},
"expect": {
"requests": [
{
"pluginId": "plugin-x",
"uid": "123",
"request": {
"from": "now-6",
"to": "now",
"queries": [
{
"refId": "A",
"datasource": {
"type": "plugin-x",
"uid": "123"
}
}
]
}
},
{
"pluginId": "plugin-x",
"uid": "456",
"request": {
"from": "now-6",
"to": "now",
"queries": [
{
"refId": "B",
"datasource": {
"type": "plugin-x",
"uid": "456"
}
}
]
}
}
]
}
}
@@ -0,0 +1,32 @@
{
"results": {
"B": {
"status": 200,
"frames": [
{
"schema": {
"name": "B",
"refId": "B",
"fields": [
{
"name": "Value + 10",
"type": "number",
"typeInfo": {
"frame": "float64",
"nullable": false
}
}
]
},
"data": {
"values": [
[
17
]
]
}
}
]
}
}
}
@@ -0,0 +1,39 @@
{
"results": {
"B": {
"status": 200,
"frames": [
{
"schema": {
"refId": "B",
"fields": [
{
"name": "B",
"type": "number",
"typeInfo": {
"frame": "float64",
"nullable": true
}
}
],
"meta": {
"type": "numeric-multi",
"typeVersion": [
0,
1
]
}
},
"data": {
"values": [
[
21
]
]
}
}
]
}
}
}
-20
View File
@@ -1,20 +0,0 @@
{
"description": "self dependencies",
"input": {
"from": "now-6",
"to": "now",
"queries": [
{
"refId": "A",
"datasource": {
"type": "",
"uid": "__expr__"
},
"type": "math",
"expression": "$A"
}
]
},
"expect": {},
"error": "[sse.cyclic] cyclic reference in expression [A]"
}
@@ -0,0 +1,41 @@
{
"results": {
"A": {
"status": 200,
"frames": [
{
"schema": {
"refId": "A",
"fields": [
{
"name": "Time",
"type": "time",
"typeInfo": {
"frame": "time.Time"
}
},
{
"name": "Value",
"type": "number",
"typeInfo": {
"frame": "float64"
},
"labels": {}
}
]
},
"data": {
"values": [
[
1704067200000
],
[
7
]
]
}
}
]
}
}
}
-79
View File
@@ -1,79 +0,0 @@
{
"description": "one hidden query with two expressions that start out-of-order",
"input": {
"from": "now-6",
"to": "now",
"queries": [
{
"refId": "C",
"datasource": {
"type": "",
"uid": "__expr__"
},
"type": "reduce",
"expression": "$B",
"reducer": "last"
},
{
"refId": "A",
"datasource": {
"type": "sql",
"uid": "123"
},
"hide": true
},
{
"refId": "B",
"datasource": {
"type": "",
"uid": "-100"
},
"type": "math",
"expression": "$A + 10"
}
]
},
"expect": {
"requests": [
{
"pluginId": "sql",
"uid": "123",
"request": {
"from": "now-6",
"to": "now",
"queries": [
{
"refId": "A",
"datasource": {
"type": "sql",
"uid": "123"
}
}
]
}
}
],
"expressions": [
{
"id": 2,
"refId": "B",
"type": "math",
"properties": {
"expression": "$A + 10"
}
},
{
"id": 1,
"refId": "C",
"type": "reduce",
"properties": {
"expression": "$B",
"reducer": "last"
}
}
],
"hide": [
"A"
]
}
}