Skip to content

Instantly share code, notes, and snippets.

View kylebrandt's full-sized avatar
🦥
🛠️

Kyle Brandt kylebrandt

🦥
🛠️
View GitHub Profile
@kylebrandt
kylebrandt / notes.md
Created November 7, 2024 16:20
SQL Expression Notes

SQL Expression Notes

Getting some thoughts down...

PoC Outline (with go-mysql-server)

  • Goals
    • Main Goal: go-mysql-server end-to-end inside SSE over completion for discovery, supporting some subset of cases of combining other datasources
    • Run go-mysql-server without "server"
  • Use SDK for response
@kylebrandt
kylebrandt / README.md
Created September 12, 2024 15:11
Recorded Query Multi-Dimensions - Dataplane + SSE

Recorded Queries and Multiple Dimensions, The Ugly Details

Docs (https://grafana.com/docs/grafana/latest/administration/recorded-queries/#how-recorded-queries-work):

Recorded queries only work with backend data source plugins. Refer to Backend data source plugin for more information about backend data source plugins. You can recorded four types of queries:

  • single row and column - A query that returns a single row and column.
  • row count - A query that returns meaningful rows to be counted.
  • expression - Any expression. To learn more about creating and using expressions, see Write expression queries.
  • dataplane numeric - A query that returns dataplane numeric kind data.
@kylebrandt
kylebrandt / README.md
Last active June 7, 2024 12:55
ScopeNodes Example

Notes

  • NB" The "name" (id) fields are named using the path in these examples. This is not part of the API itself currently
  • e.g. http://localhost:3000/swagger?urls.primaryName=scope.grafana.app%2Fv0alpha1 for Swagger definitions.

Files

  • example.http: VSCode REST Client Extension HTTP Calls
  • scopesnodes.json: JSON output of ScopeNode kind items created in example.http
  • scopes.json: JSON output of Scope kind items created in example.http
  • find_no_param_response.json and find_parent_param_is_applications_response.json: The responses to the two calls to the find/scope_node_children endpoint that are in the example.http file
@kylebrandt
kylebrandt / README.md
Last active June 6, 2024 14:11
ScopeDashboardBinding Summary and Examples

Scopes API Summary

We have created an alpha version of the API for scopes and scope/dashboard relationships. This is an OpenAPI and kubernetes style API.

Object Summary

There are two main objects (kinds):

  • Scope: Each Scope's spec includes an array of ScopeFilter and the string properties title and description.
  • ScopeFilter has key, operator (enum), and value
@kylebrandt
kylebrandt / peakq.http
Last active February 6, 2024 14:20
peakq http
### Render a Basic template with POST
POST http://admin:admin@localhost:3000/apis/peakq.grafana.app/v0alpha1/render?var-metricName=up
Content-Type: application/json
Accept: application/json
{
"title": "Test",
"vars": [
{
"key": "metricName",
@kylebrandt
kylebrandt / example commands.md
Last active January 22, 2024 20:11
Prom Query Label Matcher Replacement
# ./pp <query> <scope> <aggregate_group_by> <func_string_replacements:funcName,argIdx,currentValue,newValue>...
# aggregate_group_by is optional

$ ./pp  'up{foo="baz",a="q"}' '{a=~"z"}'
up{a=~"z",foo="baz"}

$ ./pp 'up{foo="baz",a="q"}' '{a=~"z",c="z"}' 
up{a=~"z",c="z",foo="baz"}
@kylebrandt
kylebrandt / pr.diff
Created October 13, 2023 14:24
pr.diff
diff --git a/go.mod b/go.mod
index 7534de9cfc..41d10ed8b3 100644
--- a/go.mod
+++ b/go.mod
@@ -124,7 +124,7 @@ require (
gopkg.in/mail.v2 v2.3.1 // @grafana/backend-platform
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // @grafana/alerting-squad-backend
- xorm.io/builder v0.3.6 // @grafana/backend-platform
+ xorm.io/builder v0.3.6 // indirect; @grafana/backend-platform

Record Queries Multi

Recorded Queries will record multiple metrics, identified by labels, if the input data is numeric dataplane data.

Numeric dataplane data comes:

  • directly from a datasource, prometheus instant queries are an example
  • Server Side Expressions Reduce operation results (which can takes various forms of time series data as input)

Example 1

@kylebrandt
kylebrandt / images.md
Created August 28, 2023 18:15
Benchmark executedQueryString

Before (left), After (Right) image

image