refactor: use, not mount — one verb for composition

cloud renamed its composition verb to zip own word, and this module publishes
the other half of that seam.
This commit is contained in:
2026-08-29 14:08:33 -07:00
parent 12b414f972
commit f0ad9f2321
70 changed files with 166 additions and 167 deletions
+1 -1
View File
@@ -314,7 +314,7 @@ func TestAccessTheRestOfTheFaceStillReachesTheRuntime(t *testing.T) {
w.Header().Set("Content-Type", "application/json")
_, _ = io.WriteString(w, `{"door":"wildcard","path":"`+r.URL.Path+`"}`)
})))
if err := o11y.Mount(app); err != nil {
if err := o11y.Use(app); err != nil {
t.Fatalf("Mount: %v", err)
}
answers(t, http.StatusOK, `{"status":"success","data":[]}`)
+3 -3
View File
@@ -120,9 +120,9 @@ func TestTenantOpsStayGated(t *testing.T) {
"GET /v1/o11y/public/dashboards", // the collection is not a share
"GET /v1/o11y/public/dashboards//", // an empty share id
"GET /v1/o11y/public/dashboards/d1/widgets/0/query_rangex",
"GET /v1/event/proj/envelope/", // ingest is a WRITE; a GET is not it
"POST /v1/o11y/api/v3/issues", // a read API under the DSN prefix
"POST /v1/o11y/sentinel/issues", // the face is a face, whatever the suffix
"GET /v1/event/proj/envelope/", // ingest is a WRITE; a GET is not it
"POST /v1/o11y/api/v3/issues", // a read API under the DSN prefix
"POST /v1/o11y/sentinel/issues", // the face is a face, whatever the suffix
// Ingest moved off the face. The old spelling must buy nothing, or
// the move left an unauthenticated hole where the route used to be.
"POST /v1/o11y/sentinel/proj/envelope/",
+1 -1
View File
@@ -39,7 +39,7 @@ func declaredAt(t *testing.T, app *zip.App, method, target string) bool {
func mountClaiming(t *testing.T, opts ...o11y.Option) *zip.App {
t.Helper()
app := zip.New(zip.Config{DisableStartupMessage: true})
if err := o11y.Mount(app, opts...); err != nil {
if err := o11y.Use(app, opts...); err != nil {
t.Fatalf("Mount: %v", err)
}
o11y.SetRuntime(nil)
+1 -1
View File
@@ -342,7 +342,7 @@ func TestDashboardTypedPathsWinOverWildcard(t *testing.T) {
w.Header().Set("Content-Type", "application/json")
_, _ = io.WriteString(w, `{"door":"wildcard","path":"`+r.URL.Path+`"}`)
})))
if err := o11y.Mount(app); err != nil {
if err := o11y.Use(app); err != nil {
t.Fatalf("Mount: %v", err)
}
runtime(t, o11y.O11yDashboardList{})
+1 -1
View File
@@ -34,7 +34,7 @@ func (f fakeHealth) Livez(w http.ResponseWriter, r *http.Request) {
func newMounted(t *testing.T) *zip.App {
t.Helper()
app := zip.New(zip.Config{DisableStartupMessage: true})
if err := o11y.Mount(app); err != nil {
if err := o11y.Use(app); err != nil {
t.Fatalf("Mount: %v", err)
}
return app
+2 -2
View File
@@ -1,7 +1,7 @@
// HIP-1241 metrics capability — one native store, three signals.
//
// import "github.com/hanzoai/o11y/metrics"
// metrics.Mount(app, metrics.Deps{Logger: log, DataDir: dir, Brand: brand, Org: principal.Org})
// metrics.Use(app, metrics.Deps{Logger: log, DataDir: dir, Brand: brand, Org: principal.Org})
//
// This code was github.com/hanzoai/metrics, whose NOTICE names this module its
// successor. It arrived here whole — store, WAL, ZAP receiver, routes, tests —
@@ -110,7 +110,7 @@ func tenant(c *zip.Ctx) (*tenantSet, bool) {
}
// Mount registers the native observability routes on the shared cloud App.
func Mount(app *zip.App, deps Deps) error {
func Use(app *zip.App, deps Deps) error {
// Fail closed, and fail at BOOT. A nil decision could only default to
// something, and every default here is a tenant an unauthenticated caller
// gets to name. Refusing to mount is the one outcome that cannot ship a
+2 -2
View File
@@ -22,7 +22,7 @@ func newTestApp(t *testing.T) *zip.App {
t.Helper()
log := luxlog.NewNoOpLogger()
app := zip.New(zip.Config{AppName: "metrics-test", Logger: log})
if err := Mount(app, Deps{Logger: log, DataDir: t.TempDir(), Brand: "hanzo", Org: testOrg}); err != nil {
if err := Use(app, Deps{Logger: log, DataDir: t.TempDir(), Brand: "hanzo", Org: testOrg}); err != nil {
t.Fatalf("Mount: %v", err)
}
return app
@@ -266,7 +266,7 @@ func TestAnonymousCallerCannotNameATenant(t *testing.T) {
func TestMountRefusesWithoutATenantDecision(t *testing.T) {
log := luxlog.NewNoOpLogger()
app := zip.New(zip.Config{AppName: "metrics-test", Logger: log})
if err := Mount(app, Deps{Logger: log, DataDir: t.TempDir(), Brand: "hanzo"}); err == nil {
if err := Use(app, Deps{Logger: log, DataDir: t.TempDir(), Brand: "hanzo"}); err == nil {
t.Fatal("Mount with no Org decision succeeded — it must refuse, not pick a default tenant")
}
}
+1 -1
View File
@@ -318,7 +318,7 @@ func TestMetricsRestStillReachesTheWildcard(t *testing.T) {
w.Header().Set("Content-Type", "application/json")
_, _ = io.WriteString(w, `{"door":"wildcard","path":"`+r.URL.Path+`"}`)
})))
if err := o11y.Mount(app); err != nil {
if err := o11y.Use(app); err != nil {
t.Fatalf("Mount: %v", err)
}
runtime(t, map[string]any{"metrics": []any{}})
+1 -1
View File
@@ -57,7 +57,7 @@ import (
// addresses itself has to say so with [Claimed] — see claim.go for why that is a
// statement of ownership rather than a filter. Without one, nothing changes and
// the whole table is declared.
func Mount(app *zip.App, opts ...Option) error {
func Use(app *zip.App, opts ...Option) error {
c := new(conf)
for _, o := range opts {
o(c)
+2 -2
View File
@@ -20,7 +20,7 @@ import (
// was not.
func TestMountTakesOnlyTheRouter(t *testing.T) {
app := zip.New(zip.Config{DisableStartupMessage: true})
if err := o11y.Mount(app); err != nil {
if err := o11y.Use(app); err != nil {
t.Fatalf("Mount: %v", err)
}
}
@@ -36,7 +36,7 @@ func TestMountTakesOnlyTheRouter(t *testing.T) {
// that actually exist — one hatch and one typed op.
func TestNamedRouteWithoutRuntimeReturns503(t *testing.T) {
app := zip.New(zip.Config{DisableStartupMessage: true})
if err := o11y.Mount(app); err != nil {
if err := o11y.Use(app); err != nil {
t.Fatalf("Mount: %v", err)
}
o11y.SetRuntime(nil)
@@ -11,6 +11,7 @@ import (
"time"
"github.com/DATA-DOG/go-sqlmock"
"github.com/go-openapi/strfmt"
"github.com/hanzoai/o11y/pkg/alertmanager/alertmanagerstore/sqlalertmanagerstore"
"github.com/hanzoai/o11y/pkg/alertmanager/nfmanager/nfmanagertest"
"github.com/hanzoai/o11y/pkg/factory/factorytest"
@@ -18,7 +19,6 @@ import (
"github.com/hanzoai/o11y/pkg/sqlstore/sqlstoretest"
"github.com/hanzoai/o11y/pkg/types/alertmanagertypes"
"github.com/hanzoai/o11y/pkg/types/alertmanagertypes/alertmanagertypestest"
"github.com/go-openapi/strfmt"
"github.com/prometheus/alertmanager/api/v2/models"
"github.com/prometheus/alertmanager/config"
"github.com/prometheus/client_golang/prometheus"
@@ -5,9 +5,9 @@ import (
"reflect"
"strings"
"github.com/go-viper/mapstructure/v2"
"github.com/hanzoai/o11y/pkg/errors"
"github.com/hanzoai/o11y/pkg/types/alertmanagertypes"
"github.com/go-viper/mapstructure/v2"
)
// fieldPath is a dotted mapstructure path into the templating data map,
@@ -5,10 +5,10 @@ import (
"log/slog"
"sync"
"github.com/expr-lang/expr"
"github.com/hanzoai/o11y/pkg/alertmanager/nfmanager"
"github.com/hanzoai/o11y/pkg/errors"
"github.com/hanzoai/o11y/pkg/types/alertmanagertypes"
"github.com/expr-lang/expr"
"github.com/prometheus/common/model"
"github.com/hanzoai/o11y/pkg/factory"
+1 -1
View File
@@ -52,7 +52,7 @@ func TestEveryRegisteredAddressIsDeclaredAndResolves(t *testing.T) {
func declared(t *testing.T) map[string]bool {
t.Helper()
d := zip.New(zip.Config{DisableStartupMessage: true})
if err := o11y.Mount(d); err != nil {
if err := o11y.Use(d); err != nil {
t.Fatalf("Mount: %v", err)
}
out := map[string]bool{}
+1 -1
View File
@@ -6,12 +6,12 @@ import (
"strings"
"time"
"github.com/dgraph-io/ristretto/v2"
"github.com/hanzoai/o11y/pkg/cache"
"github.com/hanzoai/o11y/pkg/errors"
"github.com/hanzoai/o11y/pkg/factory"
"github.com/hanzoai/o11y/pkg/types/cachetypes"
"github.com/hanzoai/o11y/pkg/valuer"
"github.com/dgraph-io/ristretto/v2"
semconv "go.opentelemetry.io/collector/semconv/v1.6.1"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/metric"
+1 -1
View File
@@ -5,8 +5,8 @@ import (
"slices"
"strings"
parser "github.com/hanzoai/o11y/pkg/parser/filterquery/grammar"
"github.com/antlr4-go/antlr/v4"
parser "github.com/hanzoai/o11y/pkg/parser/filterquery/grammar"
"golang.org/x/exp/maps"
qbtypes "github.com/hanzoai/o11y/pkg/types/querybuildertypes/querybuildertypesv5"
+1 -1
View File
@@ -5,9 +5,9 @@ import (
"net/http"
"time"
"github.com/hanzoai/o11y/pkg/http/client/plugin"
"github.com/gojek/heimdall/v7"
"github.com/gojek/heimdall/v7/httpclient"
"github.com/hanzoai/o11y/pkg/http/client/plugin"
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
"go.opentelemetry.io/otel/metric"
"go.opentelemetry.io/otel/trace"
@@ -5,13 +5,13 @@ import (
"strings"
"time"
"github.com/antlr4-go/antlr/v4"
sqlbuilder "github.com/hanzo-ds/sqlbuilder"
"github.com/hanzoai/o11y/pkg/parser/filterquery"
grammar "github.com/hanzoai/o11y/pkg/parser/filterquery/grammar"
"github.com/hanzoai/o11y/pkg/sqlstore"
"github.com/hanzoai/o11y/pkg/types/dashboardtypes"
qbtypesv5 "github.com/hanzoai/o11y/pkg/types/querybuildertypes/querybuildertypesv5"
"github.com/antlr4-go/antlr/v4"
sqlbuilder "github.com/hanzo-ds/sqlbuilder"
)
// bunPlaceholderFlavor is any flavor that renders `?` placeholders, which bun
@@ -8,6 +8,7 @@ import (
"github.com/hanzoai/o11y/pkg/datastoresql"
"github.com/hanzo-ds/sqlbuilder"
"github.com/hanzoai/o11y/pkg/errors"
"github.com/hanzoai/o11y/pkg/flagger"
"github.com/hanzoai/o11y/pkg/querybuilder"
@@ -17,7 +18,6 @@ import (
qbtypes "github.com/hanzoai/o11y/pkg/types/querybuildertypes/querybuildertypesv5"
"github.com/hanzoai/o11y/pkg/types/telemetrytypes"
"github.com/hanzoai/o11y/pkg/valuer"
"github.com/hanzo-ds/sqlbuilder"
)
// quoteIdentifier wraps s in backticks for use as a Datastore identifier,
@@ -8,13 +8,13 @@ import (
"github.com/hanzoai/o11y/pkg/datastoresql"
"github.com/hanzo-ds/sqlbuilder"
"github.com/hanzoai/o11y/pkg/flagger"
"github.com/hanzoai/o11y/pkg/telemetrymetrics"
"github.com/hanzoai/o11y/pkg/types/featuretypes"
"github.com/hanzoai/o11y/pkg/types/inframonitoringtypes"
qbtypes "github.com/hanzoai/o11y/pkg/types/querybuildertypes/querybuildertypesv5"
"github.com/hanzoai/o11y/pkg/valuer"
"github.com/hanzo-ds/sqlbuilder"
)
// getPerGroupHostStatusCounts computes the number of active and inactive hosts per group
@@ -8,12 +8,12 @@ import (
"github.com/hanzoai/o11y/pkg/datastoresql"
"github.com/hanzo-ds/sqlbuilder"
"github.com/hanzoai/o11y/pkg/querybuilder"
"github.com/hanzoai/o11y/pkg/telemetrymetrics"
"github.com/hanzoai/o11y/pkg/types/inframonitoringtypes"
qbtypes "github.com/hanzoai/o11y/pkg/types/querybuildertypes/querybuildertypesv5"
"github.com/hanzoai/o11y/pkg/valuer"
"github.com/hanzo-ds/sqlbuilder"
)
// buildNodeRecords assembles the page records. Condition counts come from
@@ -9,12 +9,12 @@ import (
"github.com/hanzoai/o11y/pkg/datastoresql"
"github.com/hanzo-ds/sqlbuilder"
"github.com/hanzoai/o11y/pkg/querybuilder"
"github.com/hanzoai/o11y/pkg/telemetrymetrics"
"github.com/hanzoai/o11y/pkg/types/inframonitoringtypes"
qbtypes "github.com/hanzoai/o11y/pkg/types/querybuildertypes/querybuildertypesv5"
"github.com/hanzoai/o11y/pkg/valuer"
"github.com/hanzo-ds/sqlbuilder"
)
// buildPodRecords assembles the page records. Phase counts come from
@@ -7,7 +7,6 @@ import (
"github.com/DATA-DOG/go-sqlmock"
dsmock "github.com/hanzo-ds/mock"
"github.com/hanzoai/o11y/pkg/telemetrystore/datastoremock"
"github.com/hanzoai/o11y/pkg/cache"
"github.com/hanzoai/o11y/pkg/cache/cachetest"
"github.com/hanzoai/o11y/pkg/errors"
@@ -17,6 +16,7 @@ import (
"github.com/hanzoai/o11y/pkg/modules/metricsexplorer"
"github.com/hanzoai/o11y/pkg/modules/metricsexplorer/implmetricsexplorer"
"github.com/hanzoai/o11y/pkg/telemetrystore"
"github.com/hanzoai/o11y/pkg/telemetrystore/datastoremock"
"github.com/hanzoai/o11y/pkg/telemetrystore/telemetrystoretest"
"github.com/hanzoai/o11y/pkg/types/metricsexplorertypes"
qbtypes "github.com/hanzoai/o11y/pkg/types/querybuildertypes/querybuildertypesv5"
@@ -13,7 +13,7 @@ const (
MaxExportBytesLimit = 10 * 1024 * 1024 * 1024 // 10 GB
// Query Limits.
ChunkSize = 5_000 // 5k
ChunkSize = 5_000 // 5k
DatastoreExportRawDataMaxThreads = 2
DatastoreExportRawDataTimeout = 10 * time.Minute
)
@@ -5,11 +5,11 @@ import (
"fmt"
"slices"
"github.com/hanzo-ds/sqlbuilder"
"github.com/hanzoai/o11y/pkg/errors"
"github.com/hanzoai/o11y/pkg/querybuilder"
qbtypes "github.com/hanzoai/o11y/pkg/types/querybuildertypes/querybuildertypesv5"
"github.com/hanzoai/o11y/pkg/types/telemetrytypes"
"github.com/hanzo-ds/sqlbuilder"
)
type conditionBuilder struct {
@@ -5,10 +5,10 @@ import (
"fmt"
"strings"
"github.com/hanzo-ds/sqlbuilder"
qbtypes "github.com/hanzoai/o11y/pkg/types/querybuildertypes/querybuildertypesv5"
"github.com/hanzoai/o11y/pkg/types/telemetrytypes"
schema "github.com/hanzoai/otel-collector/cmd/o11yschemamigrator/schema_migrator"
"github.com/hanzo-ds/sqlbuilder"
)
var ruleStateHistoryColumns = map[string]*schema.Column{
@@ -9,13 +9,13 @@ import (
"github.com/hanzoai/o11y/pkg/datastoresql"
sqlbuilder "github.com/hanzo-ds/sqlbuilder"
"github.com/hanzoai/o11y/pkg/querybuilder"
"github.com/hanzoai/o11y/pkg/telemetrystore"
qbtypes "github.com/hanzoai/o11y/pkg/types/querybuildertypes/querybuildertypesv5"
"github.com/hanzoai/o11y/pkg/types/rulestatehistorytypes"
"github.com/hanzoai/o11y/pkg/types/ruletypes"
"github.com/hanzoai/o11y/pkg/types/telemetrytypes"
sqlbuilder "github.com/hanzo-ds/sqlbuilder"
)
const (
+1 -1
View File
@@ -3,8 +3,8 @@ package filterquery
import (
"fmt"
grammar "github.com/hanzoai/o11y/pkg/parser/filterquery/grammar"
"github.com/antlr4-go/antlr/v4"
grammar "github.com/hanzoai/o11y/pkg/parser/filterquery/grammar"
)
func Parse(query string) (antlr.ParseTree, *antlr.CommonTokenStream, *ErrorCollector) {
+1 -1
View File
@@ -116,7 +116,7 @@ func TestEveryRegisteredAddressIsDeclaredAndResolves(t *testing.T) {
aH.RegisterTraceFunnelsRoutes(r, am)
d := zip.New(zip.Config{DisableStartupMessage: true})
if err := published.Mount(d); err != nil {
if err := published.Use(d); err != nil {
t.Fatalf("Mount: %v", err)
}
declared := map[string]bool{}
@@ -415,16 +415,16 @@ func buildCompositeQuery(chq *v3.DatastoreQuery, queryContext string) (*v3.Compo
if queryContext == "producer-consumer-eval" {
return &v3.CompositeQuery{
QueryType: v3.QueryTypeDatastoreSQL,
QueryType: v3.QueryTypeDatastoreSQL,
DatastoreQueries: map[string]*v3.DatastoreQuery{queryContext: chq},
PanelType: v3.PanelTypeList,
PanelType: v3.PanelTypeList,
}, nil
}
return &v3.CompositeQuery{
QueryType: v3.QueryTypeDatastoreSQL,
QueryType: v3.QueryTypeDatastoreSQL,
DatastoreQueries: map[string]*v3.DatastoreQuery{queryContext: chq},
PanelType: v3.PanelTypeTable,
PanelType: v3.PanelTypeTable,
}, nil
}
@@ -8,12 +8,12 @@ import (
)
var testGetJSONFilterKeyData = []struct {
Name string
Key v3.AttributeKey
IsArray bool
Name string
Key v3.AttributeKey
IsArray bool
DatastoreKey string
Operator v3.FilterOperator
Error bool
Operator v3.FilterOperator
Error bool
}{
{
Name: "Incorrect Key",
@@ -42,7 +42,7 @@ var testGetJSONFilterKeyData = []struct {
DataType: "array(string)",
IsJSON: true,
},
IsArray: true,
IsArray: true,
DatastoreKey: "JSONExtract(JSON_QUERY(body, '$.\"requestor_list\"[*]'), '" + ARRAY_STRING + "')",
},
{
@@ -52,7 +52,7 @@ var testGetJSONFilterKeyData = []struct {
DataType: "array(string)",
IsJSON: true,
},
IsArray: true,
IsArray: true,
DatastoreKey: "JSONExtract(JSON_QUERY(body, '$.\"nested\"[*].\"key\"[*]'), '" + ARRAY_STRING + "')",
},
{
@@ -62,7 +62,7 @@ var testGetJSONFilterKeyData = []struct {
DataType: "array(int64)",
IsJSON: true,
},
IsArray: true,
IsArray: true,
DatastoreKey: "JSONExtract(JSON_QUERY(body, '$.\"int_numbers\"[*]'), '" + ARRAY_INT64 + "')",
},
{
@@ -72,7 +72,7 @@ var testGetJSONFilterKeyData = []struct {
DataType: "array(float64)",
IsJSON: true,
},
IsArray: true,
IsArray: true,
DatastoreKey: "JSONExtract(JSON_QUERY(body, '$.\"nested_num\"[*].\"float_nums\"[*]'), '" + ARRAY_FLOAT64 + "')",
},
{
@@ -82,7 +82,7 @@ var testGetJSONFilterKeyData = []struct {
DataType: "array(bool)",
IsJSON: true,
},
IsArray: true,
IsArray: true,
DatastoreKey: "JSONExtract(JSON_QUERY(body, '$.\"boolarray\"[*]'), '" + ARRAY_BOOL + "')",
},
{
@@ -92,7 +92,7 @@ var testGetJSONFilterKeyData = []struct {
DataType: "string",
IsJSON: true,
},
IsArray: false,
IsArray: false,
DatastoreKey: "JSON_VALUE(body, '$.\"message\"')",
},
{
@@ -102,7 +102,7 @@ var testGetJSONFilterKeyData = []struct {
DataType: "int64",
IsJSON: true,
},
IsArray: false,
IsArray: false,
DatastoreKey: "JSONExtract(JSON_VALUE(body, '$.\"status\"'), '" + INT64 + "')",
},
{
@@ -112,7 +112,7 @@ var testGetJSONFilterKeyData = []struct {
DataType: "float64",
IsJSON: true,
},
IsArray: false,
IsArray: false,
DatastoreKey: "JSONExtract(JSON_VALUE(body, '$.\"fraction\"'), '" + FLOAT64 + "')",
},
{
@@ -122,7 +122,7 @@ var testGetJSONFilterKeyData = []struct {
DataType: "bool",
IsJSON: true,
},
IsArray: false,
IsArray: false,
DatastoreKey: "JSONExtract(JSON_VALUE(body, '$.\"boolkey\"'), '" + BOOL + "')",
},
{
@@ -132,7 +132,7 @@ var testGetJSONFilterKeyData = []struct {
DataType: "bool",
IsJSON: true,
},
IsArray: false,
IsArray: false,
DatastoreKey: "JSONExtract(JSON_VALUE(body, '$.\"bool-key\"'), '" + BOOL + "')",
},
}
+2 -2
View File
@@ -5,12 +5,12 @@ import (
"log"
"net"
"github.com/google/uuid"
"github.com/hanzoai/o11y/pkg/types/opamptypes"
"github.com/hanzoai/o11y/pkg/valuer"
"github.com/google/uuid"
"github.com/knadh/koanf/v2"
"github.com/knadh/koanf/parsers/yaml"
"github.com/knadh/koanf/providers/rawbytes"
"github.com/knadh/koanf/v2"
"github.com/open-telemetry/opamp-go/protobufs"
"github.com/pkg/errors"
)
+1 -1
View File
@@ -346,7 +346,7 @@ func (s *Server) createPublicServer(api *APIHandler, web web.Web) (*zip.App, err
// meant an invalid program started anyway and its routes were simply missing.
func declaration() (*zip.App, error) {
d := zip.New(zip.Config{AppName: "o11y", DisableStartupMessage: true})
if err := published.Mount(d); err != nil {
if err := published.Use(d); err != nil {
return nil, err
}
if err := d.Build(); err != nil {
+4 -4
View File
@@ -223,10 +223,10 @@ type PromQueryDashboard struct {
}
type Query struct {
Datastore []DatastoreQueryDashboard `json:"datastore"`
PromQL []PromQueryDashboard `json:"promQL"`
MetricsBuilder MetricsBuilder `json:"metricsBuilder"`
QueryType int `json:"queryType"`
Datastore []DatastoreQueryDashboard `json:"datastore"`
PromQL []PromQueryDashboard `json:"promQL"`
MetricsBuilder MetricsBuilder `json:"metricsBuilder"`
QueryType int `json:"queryType"`
}
type Widget struct {
+1 -1
View File
@@ -570,7 +570,7 @@ type AlertsInfo struct {
EmailChannels int `json:"emailChannels"`
MSTeamsChannels int `json:"microsoftTeamsChannels"`
MetricsBuilderQueries int `json:"metricsBuilderQueries"`
MetricsDatastoreQueries int `json:"metricsDatastoreQueries"`
MetricsDatastoreQueries int `json:"metricsDatastoreQueries"`
MetricsPrometheusQueries int `json:"metricsPrometheusQueries"`
SpanMetricsPrometheusQueries int `json:"spanMetricsPrometheusQueries"`
AlertNames []string `json:"alertNames"`
@@ -7,9 +7,9 @@ import (
"log/slog"
expr "github.com/expr-lang/expr"
"github.com/hanzoai/o11y/pkg/errors"
v3 "github.com/hanzoai/o11y/pkg/query-service/model/v3"
expr "github.com/expr-lang/expr"
)
var (
+2 -2
View File
@@ -59,8 +59,8 @@ func NewPromRuleTask(name, file string, frequency time.Duration, rules []Rule, o
seriesInPreviousEval: make([]map[string]plabels.Labels, len(rules)),
done: make(chan struct{}),
terminated: make(chan struct{}),
notify: notify,
logger: opts.Logger,
notify: notify,
logger: opts.Logger,
}
}
+1 -1
View File
@@ -9,8 +9,8 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
pql "github.com/prometheus/prometheus/promql"
dsmock "github.com/hanzo-ds/mock"
pql "github.com/prometheus/prometheus/promql"
"github.com/hanzoai/o11y/pkg/instrumentation/instrumentationtest"
"github.com/hanzoai/o11y/pkg/prometheus"
@@ -7,9 +7,9 @@ import (
"github.com/hanzoai/o11y/pkg/datastoresql"
"github.com/antlr4-go/antlr/v4"
"github.com/hanzo-ds/sqlbuilder"
"github.com/hanzoai/o11y/pkg/errors"
grammar "github.com/hanzoai/o11y/pkg/parser/havingexpression/grammar"
"github.com/hanzo-ds/sqlbuilder"
)
// havingExpressionRewriteVisitor walks the parse tree of a HavingExpression in a single
+1 -1
View File
@@ -5,10 +5,10 @@ import (
"strconv"
"strings"
"github.com/antlr4-go/antlr/v4"
"github.com/hanzoai/o11y/pkg/errors"
grammar "github.com/hanzoai/o11y/pkg/parser/filterquery/grammar"
qbtypes "github.com/hanzoai/o11y/pkg/types/querybuildertypes/querybuildertypesv5"
"github.com/antlr4-go/antlr/v4"
)
// FieldConstraint represents a constraint on a field.
+1 -1
View File
@@ -1,9 +1,9 @@
package querybuilder
import (
"github.com/antlr4-go/antlr/v4"
grammar "github.com/hanzoai/o11y/pkg/parser/filterquery/grammar"
"github.com/hanzoai/o11y/pkg/types/telemetrytypes"
"github.com/antlr4-go/antlr/v4"
)
// QueryStringToKeysSelectors converts a query string to a list of field key selectors
@@ -8,10 +8,10 @@ import (
"testing"
"github.com/antlr4-go/antlr/v4"
sqlbuilder "github.com/hanzo-ds/sqlbuilder"
grammar "github.com/hanzoai/o11y/pkg/parser/filterquery/grammar"
qbtypes "github.com/hanzoai/o11y/pkg/types/querybuildertypes/querybuildertypesv5"
"github.com/hanzoai/o11y/pkg/types/telemetrytypes"
sqlbuilder "github.com/hanzo-ds/sqlbuilder"
"github.com/stretchr/testify/assert"
)
+1 -1
View File
@@ -5,12 +5,12 @@ import (
"slices"
"strings"
"github.com/hanzo-ds/sqlbuilder"
"github.com/hanzoai/o11y/pkg/errors"
"github.com/hanzoai/o11y/pkg/querybuilder"
qbtypes "github.com/hanzoai/o11y/pkg/types/querybuildertypes/querybuildertypesv5"
"github.com/hanzoai/o11y/pkg/types/telemetrytypes"
schemamigrator "github.com/hanzoai/otel-collector/cmd/o11yschemamigrator/schema_migrator"
"github.com/hanzo-ds/sqlbuilder"
)
var (
+1 -1
View File
@@ -11,6 +11,7 @@ import (
"github.com/hanzoai/o11y/pkg/datastoresql"
"github.com/hanzo-ds/go/lib/col"
"github.com/hanzo-ds/sqlbuilder"
"github.com/hanzoai/o11y/pkg/errors"
"github.com/hanzoai/o11y/pkg/querybuilder"
"github.com/hanzoai/o11y/pkg/telemetrylogs"
@@ -19,7 +20,6 @@ import (
"github.com/hanzoai/o11y/pkg/types/telemetrytypes"
schemamigrator "github.com/hanzoai/otel-collector/cmd/o11yschemamigrator/schema_migrator"
"github.com/hanzoai/otel-collector/constants"
"github.com/hanzo-ds/sqlbuilder"
)
var (
@@ -6,9 +6,9 @@ import (
"github.com/hanzoai/o11y/pkg/datastoresql"
"github.com/hanzo-ds/sqlbuilder"
qbtypes "github.com/hanzoai/o11y/pkg/types/querybuildertypes/querybuildertypesv5"
"github.com/hanzoai/o11y/pkg/types/telemetrytypes"
"github.com/hanzo-ds/sqlbuilder"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
@@ -6,9 +6,9 @@ import (
"github.com/hanzoai/o11y/pkg/datastoresql"
"github.com/hanzo-ds/sqlbuilder"
qbtypes "github.com/hanzoai/o11y/pkg/types/querybuildertypes/querybuildertypesv5"
"github.com/hanzoai/o11y/pkg/types/telemetrytypes"
"github.com/hanzo-ds/sqlbuilder"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
@@ -4,11 +4,11 @@ import (
"context"
"fmt"
"github.com/hanzo-ds/sqlbuilder"
"github.com/hanzoai/o11y/pkg/errors"
"github.com/hanzoai/o11y/pkg/querybuilder"
qbtypes "github.com/hanzoai/o11y/pkg/types/querybuildertypes/querybuildertypesv5"
"github.com/hanzoai/o11y/pkg/types/telemetrytypes"
"github.com/hanzo-ds/sqlbuilder"
)
type defaultConditionBuilder struct {
@@ -6,9 +6,9 @@ import (
"github.com/hanzoai/o11y/pkg/datastoresql"
"github.com/hanzo-ds/sqlbuilder"
qbtypes "github.com/hanzoai/o11y/pkg/types/querybuildertypes/querybuildertypesv5"
"github.com/hanzoai/o11y/pkg/types/telemetrytypes"
"github.com/hanzo-ds/sqlbuilder"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
@@ -7,6 +7,7 @@ import (
"github.com/hanzoai/o11y/pkg/datastoresql"
"github.com/hanzo-ds/sqlbuilder"
"github.com/hanzoai/o11y/pkg/factory"
"github.com/hanzoai/o11y/pkg/flagger"
"github.com/hanzoai/o11y/pkg/querybuilder"
@@ -14,7 +15,6 @@ import (
qbtypes "github.com/hanzoai/o11y/pkg/types/querybuildertypes/querybuildertypesv5"
"github.com/hanzoai/o11y/pkg/types/telemetrytypes"
"github.com/hanzoai/o11y/pkg/valuer"
"github.com/hanzo-ds/sqlbuilder"
)
// resourceFilterStatementBuilder builds resource fingerprint filter CTEs.
@@ -4,10 +4,10 @@ import (
"context"
"github.com/DATA-DOG/go-sqlmock"
dsmock "github.com/hanzo-ds/mock"
"github.com/hanzoai/o11y/pkg/telemetrystore/datastoremock"
"github.com/hanzo-ds/go"
dsmock "github.com/hanzo-ds/mock"
"github.com/hanzoai/o11y/pkg/telemetrystore"
"github.com/hanzoai/o11y/pkg/telemetrystore/datastoremock"
"github.com/hanzoai/o11y/pkg/telemetrystore/datastoretelemetrystore"
"github.com/hanzoai/o11y/pkg/types/telemetrystoretypes"
)
+1 -1
View File
@@ -3,8 +3,8 @@ package telemetrytraces
import (
"strings"
grammar "github.com/hanzoai/o11y/pkg/parser/filterquery/grammar"
"github.com/antlr4-go/antlr/v4"
grammar "github.com/hanzoai/o11y/pkg/parser/filterquery/grammar"
)
type traceIDExtractor struct {
+1 -1
View File
@@ -1,8 +1,8 @@
package jwttokenizer
import (
"github.com/hanzoai/o11y/pkg/errors"
"github.com/golang-jwt/jwt/v5"
"github.com/hanzoai/o11y/pkg/errors"
)
var _ jwt.ClaimsValidator = (*Claims)(nil)
+3 -3
View File
@@ -13,9 +13,9 @@ type PostableProfile struct {
// PostableHost is the body for PUT /v2/billing/hosts.
type PostableHost struct {
Hostname string `json:"hostname,omitempty"`
IPv4 string `json:"ipv4,omitempty"`
IPv6 string `json:"ipv6,omitempty"`
Hostname string `json:"hostname,omitempty"`
IPv4 string `json:"ipv4,omitempty"`
IPv6 string `json:"ipv6,omitempty"`
Tags []string `json:"tags,omitempty"`
}
+40 -40
View File
@@ -104,49 +104,49 @@ var (
AzureRegionWestUS3 = CloudProviderRegion{valuer.NewString("westus3")} // West US 3.
// GCP regions.
GCPRegionAfricaSouth1 = CloudProviderRegion{valuer.NewString("africa-south1")} // Johannesburg, South Africa. Africa.
GCPRegionAsiaEast1 = CloudProviderRegion{valuer.NewString("asia-east1")} // Changhua County, Taiwan. APAC.
GCPRegionAsiaEast2 = CloudProviderRegion{valuer.NewString("asia-east2")} // Hong Kong. APAC.
GCPRegionAsiaNortheast1 = CloudProviderRegion{valuer.NewString("asia-northeast1")} // Tokyo, Japan. APAC.
GCPRegionAsiaNortheast2 = CloudProviderRegion{valuer.NewString("asia-northeast2")} // Osaka, Japan. APAC.
GCPRegionAsiaNortheast3 = CloudProviderRegion{valuer.NewString("asia-northeast3")} // Seoul, South Korea. APAC.
GCPRegionAsiaSouth1 = CloudProviderRegion{valuer.NewString("asia-south1")} // Mumbai, India. APAC.
GCPRegionAsiaSouth2 = CloudProviderRegion{valuer.NewString("asia-south2")} // Delhi, India. APAC.
GCPRegionAsiaSoutheast1 = CloudProviderRegion{valuer.NewString("asia-southeast1")} // Jurong West, Singapore. APAC.
GCPRegionAsiaSoutheast2 = CloudProviderRegion{valuer.NewString("asia-southeast2")} // Jakarta, Indonesia. APAC.
GCPRegionAsiaSoutheast3 = CloudProviderRegion{valuer.NewString("asia-southeast3")} // Bangkok, Thailand. APAC.
GCPRegionAustraliaSoutheast1 = CloudProviderRegion{valuer.NewString("australia-southeast1")} // Sydney, Australia. APAC.
GCPRegionAustraliaSoutheast2 = CloudProviderRegion{valuer.NewString("australia-southeast2")} // Melbourne, Australia. APAC.
GCPRegionEuropeCentral2 = CloudProviderRegion{valuer.NewString("europe-central2")} // Warsaw, Poland. Europe.
GCPRegionEuropeNorth1 = CloudProviderRegion{valuer.NewString("europe-north1")} // Hamina, Finland. Europe.
GCPRegionEuropeNorth2 = CloudProviderRegion{valuer.NewString("europe-north2")} // Stockholm, Sweden. Europe.
GCPRegionEuropeSouthwest1 = CloudProviderRegion{valuer.NewString("europe-southwest1")} // Madrid, Spain. Europe.
GCPRegionEuropeWest1 = CloudProviderRegion{valuer.NewString("europe-west1")} // St. Ghislain, Belgium. Europe.
GCPRegionEuropeWest2 = CloudProviderRegion{valuer.NewString("europe-west2")} // London, England. Europe.
GCPRegionEuropeWest3 = CloudProviderRegion{valuer.NewString("europe-west3")} // Frankfurt, Germany. Europe.
GCPRegionEuropeWest4 = CloudProviderRegion{valuer.NewString("europe-west4")} // Eemshaven, Netherlands. Europe.
GCPRegionEuropeWest6 = CloudProviderRegion{valuer.NewString("europe-west6")} // Zurich, Switzerland. Europe.
GCPRegionEuropeWest8 = CloudProviderRegion{valuer.NewString("europe-west8")} // Milan, Italy. Europe.
GCPRegionEuropeWest9 = CloudProviderRegion{valuer.NewString("europe-west9")} // Paris, France. Europe.
GCPRegionEuropeWest10 = CloudProviderRegion{valuer.NewString("europe-west10")} // Berlin, Germany. Europe.
GCPRegionEuropeWest12 = CloudProviderRegion{valuer.NewString("europe-west12")} // Turin, Italy. Europe.
GCPRegionMECentral1 = CloudProviderRegion{valuer.NewString("me-central1")} // Doha, Qatar. Middle East.
GCPRegionMECentral2 = CloudProviderRegion{valuer.NewString("me-central2")} // Dammam, Saudi Arabia. Middle East.
GCPRegionMEWest1 = CloudProviderRegion{valuer.NewString("me-west1")} // Tel Aviv, Israel. Middle East.
GCPRegionAfricaSouth1 = CloudProviderRegion{valuer.NewString("africa-south1")} // Johannesburg, South Africa. Africa.
GCPRegionAsiaEast1 = CloudProviderRegion{valuer.NewString("asia-east1")} // Changhua County, Taiwan. APAC.
GCPRegionAsiaEast2 = CloudProviderRegion{valuer.NewString("asia-east2")} // Hong Kong. APAC.
GCPRegionAsiaNortheast1 = CloudProviderRegion{valuer.NewString("asia-northeast1")} // Tokyo, Japan. APAC.
GCPRegionAsiaNortheast2 = CloudProviderRegion{valuer.NewString("asia-northeast2")} // Osaka, Japan. APAC.
GCPRegionAsiaNortheast3 = CloudProviderRegion{valuer.NewString("asia-northeast3")} // Seoul, South Korea. APAC.
GCPRegionAsiaSouth1 = CloudProviderRegion{valuer.NewString("asia-south1")} // Mumbai, India. APAC.
GCPRegionAsiaSouth2 = CloudProviderRegion{valuer.NewString("asia-south2")} // Delhi, India. APAC.
GCPRegionAsiaSoutheast1 = CloudProviderRegion{valuer.NewString("asia-southeast1")} // Jurong West, Singapore. APAC.
GCPRegionAsiaSoutheast2 = CloudProviderRegion{valuer.NewString("asia-southeast2")} // Jakarta, Indonesia. APAC.
GCPRegionAsiaSoutheast3 = CloudProviderRegion{valuer.NewString("asia-southeast3")} // Bangkok, Thailand. APAC.
GCPRegionAustraliaSoutheast1 = CloudProviderRegion{valuer.NewString("australia-southeast1")} // Sydney, Australia. APAC.
GCPRegionAustraliaSoutheast2 = CloudProviderRegion{valuer.NewString("australia-southeast2")} // Melbourne, Australia. APAC.
GCPRegionEuropeCentral2 = CloudProviderRegion{valuer.NewString("europe-central2")} // Warsaw, Poland. Europe.
GCPRegionEuropeNorth1 = CloudProviderRegion{valuer.NewString("europe-north1")} // Hamina, Finland. Europe.
GCPRegionEuropeNorth2 = CloudProviderRegion{valuer.NewString("europe-north2")} // Stockholm, Sweden. Europe.
GCPRegionEuropeSouthwest1 = CloudProviderRegion{valuer.NewString("europe-southwest1")} // Madrid, Spain. Europe.
GCPRegionEuropeWest1 = CloudProviderRegion{valuer.NewString("europe-west1")} // St. Ghislain, Belgium. Europe.
GCPRegionEuropeWest2 = CloudProviderRegion{valuer.NewString("europe-west2")} // London, England. Europe.
GCPRegionEuropeWest3 = CloudProviderRegion{valuer.NewString("europe-west3")} // Frankfurt, Germany. Europe.
GCPRegionEuropeWest4 = CloudProviderRegion{valuer.NewString("europe-west4")} // Eemshaven, Netherlands. Europe.
GCPRegionEuropeWest6 = CloudProviderRegion{valuer.NewString("europe-west6")} // Zurich, Switzerland. Europe.
GCPRegionEuropeWest8 = CloudProviderRegion{valuer.NewString("europe-west8")} // Milan, Italy. Europe.
GCPRegionEuropeWest9 = CloudProviderRegion{valuer.NewString("europe-west9")} // Paris, France. Europe.
GCPRegionEuropeWest10 = CloudProviderRegion{valuer.NewString("europe-west10")} // Berlin, Germany. Europe.
GCPRegionEuropeWest12 = CloudProviderRegion{valuer.NewString("europe-west12")} // Turin, Italy. Europe.
GCPRegionMECentral1 = CloudProviderRegion{valuer.NewString("me-central1")} // Doha, Qatar. Middle East.
GCPRegionMECentral2 = CloudProviderRegion{valuer.NewString("me-central2")} // Dammam, Saudi Arabia. Middle East.
GCPRegionMEWest1 = CloudProviderRegion{valuer.NewString("me-west1")} // Tel Aviv, Israel. Middle East.
GCPRegionNorthamericaNortheast1 = CloudProviderRegion{valuer.NewString("northamerica-northeast1")} // Montréal, Québec, Canada. North America.
GCPRegionNorthamericaNortheast2 = CloudProviderRegion{valuer.NewString("northamerica-northeast2")} // Toronto, Ontario, Canada. North America.
GCPRegionNorthamericaSouth1 = CloudProviderRegion{valuer.NewString("northamerica-south1")} // Querétaro, Mexico. North America.
GCPRegionSouthamericaEast1 = CloudProviderRegion{valuer.NewString("southamerica-east1")} // Osasco, São Paulo, Brazil. South America.
GCPRegionSouthamericaWest1 = CloudProviderRegion{valuer.NewString("southamerica-west1")} // Santiago, Chile. South America.
GCPRegionUSCentral1 = CloudProviderRegion{valuer.NewString("us-central1")} // Council Bluffs, Iowa. North America.
GCPRegionUSEast1 = CloudProviderRegion{valuer.NewString("us-east1")} // Moncks Corner, South Carolina. North America.
GCPRegionUSEast4 = CloudProviderRegion{valuer.NewString("us-east4")} // Ashburn, Virginia. North America.
GCPRegionUSEast5 = CloudProviderRegion{valuer.NewString("us-east5")} // Columbus, Ohio. North America.
GCPRegionUSSouth1 = CloudProviderRegion{valuer.NewString("us-south1")} // Dallas, Texas. North America.
GCPRegionUSWest1 = CloudProviderRegion{valuer.NewString("us-west1")} // The Dalles, Oregon. North America.
GCPRegionUSWest2 = CloudProviderRegion{valuer.NewString("us-west2")} // Los Angeles, California. North America.
GCPRegionUSWest3 = CloudProviderRegion{valuer.NewString("us-west3")} // Salt Lake City, Utah. North America.
GCPRegionUSWest4 = CloudProviderRegion{valuer.NewString("us-west4")} // Las Vegas, Nevada. North America.
GCPRegionSouthamericaEast1 = CloudProviderRegion{valuer.NewString("southamerica-east1")} // Osasco, São Paulo, Brazil. South America.
GCPRegionSouthamericaWest1 = CloudProviderRegion{valuer.NewString("southamerica-west1")} // Santiago, Chile. South America.
GCPRegionUSCentral1 = CloudProviderRegion{valuer.NewString("us-central1")} // Council Bluffs, Iowa. North America.
GCPRegionUSEast1 = CloudProviderRegion{valuer.NewString("us-east1")} // Moncks Corner, South Carolina. North America.
GCPRegionUSEast4 = CloudProviderRegion{valuer.NewString("us-east4")} // Ashburn, Virginia. North America.
GCPRegionUSEast5 = CloudProviderRegion{valuer.NewString("us-east5")} // Columbus, Ohio. North America.
GCPRegionUSSouth1 = CloudProviderRegion{valuer.NewString("us-south1")} // Dallas, Texas. North America.
GCPRegionUSWest1 = CloudProviderRegion{valuer.NewString("us-west1")} // The Dalles, Oregon. North America.
GCPRegionUSWest2 = CloudProviderRegion{valuer.NewString("us-west2")} // Los Angeles, California. North America.
GCPRegionUSWest3 = CloudProviderRegion{valuer.NewString("us-west3")} // Salt Lake City, Utah. North America.
GCPRegionUSWest4 = CloudProviderRegion{valuer.NewString("us-west4")} // Las Vegas, Nevada. North America.
)
func Enum() []any {
+2 -2
View File
@@ -380,8 +380,8 @@ func (dashboard *Dashboard) GetWidgetQuery(startTime, endTime, widgetIndex uint6
QueryTraceOperator []map[string]any `json:"queryTraceOperator"`
} `json:"builder"`
DatastoreSQL []map[string]any `json:"datastore_sql"`
PromQL []map[string]any `json:"promql"`
QueryType string `json:"queryType"`
PromQL []map[string]any `json:"promql"`
QueryType string `json:"queryType"`
} `json:"query"`
FillGaps bool `json:"fillSpans"`
} `json:"widgets"`
@@ -109,7 +109,7 @@ func validateQueryAllowedForPanel(plugin QueryPlugin, allowed []QueryPluginKind,
qb.QueryTypeFormula: QueryKindFormula,
qb.QueryTypeTraceOperator: QueryKindTraceOperator,
qb.QueryTypePromQL: QueryKindPromQL,
qb.QueryTypeDatastoreSQL: QueryKindDatastoreSQL,
qb.QueryTypeDatastoreSQL: QueryKindDatastoreSQL,
}
if !slices.Contains(allowed, plugin.Kind) {
return errors.NewInvalidInputf(ErrCodeDashboardInvalidInput,
@@ -3,9 +3,9 @@ package dashboardtypes
import (
"encoding/json"
jsonpatch "github.com/evanphx/json-patch/v5"
"github.com/hanzoai/o11y/pkg/errors"
"github.com/hanzoai/o11y/pkg/valuer"
jsonpatch "github.com/evanphx/json-patch/v5"
"github.com/swaggest/jsonschema-go"
)
@@ -53,7 +53,7 @@ const (
QueryKindComposite QueryPluginKind = "o11y/CompositeQuery"
QueryKindFormula QueryPluginKind = "o11y/Formula"
QueryKindPromQL QueryPluginKind = "o11y/PromQLQuery"
QueryKindDatastoreSQL QueryPluginKind = "o11y/DatastoreSQL"
QueryKindDatastoreSQL QueryPluginKind = "o11y/DatastoreSQL"
QueryKindTraceOperator QueryPluginKind = "o11y/TraceOperator"
)
@@ -62,12 +62,12 @@ func (QueryPluginKind) Enum() []any {
}
type (
CompositeQuerySpec = qb.CompositeQuery
QueryEnvelope = qb.QueryEnvelope
FormulaSpec = qb.QueryBuilderFormula
PromQLQuerySpec = qb.PromQuery
CompositeQuerySpec = qb.CompositeQuery
QueryEnvelope = qb.QueryEnvelope
FormulaSpec = qb.QueryBuilderFormula
PromQLQuerySpec = qb.PromQuery
DatastoreSQLQuerySpec = qb.DatastoreQuery
TraceOperatorSpec = qb.QueryBuilderTraceOperator
TraceOperatorSpec = qb.QueryBuilderTraceOperator
)
// BuilderQuerySpec dispatches to the correct generic QueryBuilderQuery type
@@ -91,7 +91,7 @@ func (QueryPlugin) PrepareJSONSchema(s *jsonschema.Schema) error {
string(QueryKindComposite): schemaRef("DashboardtypesQueryPluginVariantGithubComO11yO11yPkgTypesQuerybuildertypesQuerybuildertypesv5CompositeQuery"),
string(QueryKindFormula): schemaRef("DashboardtypesQueryPluginVariantGithubComO11yO11yPkgTypesQuerybuildertypesQuerybuildertypesv5QueryBuilderFormula"),
string(QueryKindPromQL): schemaRef("DashboardtypesQueryPluginVariantGithubComO11yO11yPkgTypesQuerybuildertypesQuerybuildertypesv5PromQuery"),
string(QueryKindDatastoreSQL): schemaRef("DashboardtypesQueryPluginVariantGithubComO11yO11yPkgTypesQuerybuildertypesQuerybuildertypesv5DatastoreQuery"),
string(QueryKindDatastoreSQL): schemaRef("DashboardtypesQueryPluginVariantGithubComO11yO11yPkgTypesQuerybuildertypesQuerybuildertypesv5DatastoreQuery"),
string(QueryKindTraceOperator): schemaRef("DashboardtypesQueryPluginVariantGithubComO11yO11yPkgTypesQuerybuildertypesQuerybuildertypesv5QueryBuilderTraceOperator"),
})
}
@@ -253,7 +253,7 @@ var (
QueryKindComposite: func() any { return new(CompositeQuerySpec) },
QueryKindFormula: func() any { return new(FormulaSpec) },
QueryKindPromQL: func() any { return new(PromQLQuerySpec) },
QueryKindDatastoreSQL: func() any { return new(DatastoreSQLQuerySpec) },
QueryKindDatastoreSQL: func() any { return new(DatastoreSQLQuerySpec) },
QueryKindTraceOperator: func() any { return new(TraceOperatorSpec) },
}
variablePluginSpecs = map[VariablePluginKind]func() any{
+2 -2
View File
@@ -111,8 +111,8 @@ func NewPublicDashboardDataFromDashboard(dashboard *Dashboard, publicDashboard *
QueryTraceOperator []map[string]any `json:"queryTraceOperator"`
} `json:"builder"`
DatastoreSQL []map[string]any `json:"datastore_sql"`
PromQL []map[string]any `json:"promql"`
QueryType string `json:"queryType"`
PromQL []map[string]any `json:"promql"`
QueryType string `json:"queryType"`
} `json:"query"`
} `json:"widgets"`
}
+7 -7
View File
@@ -17,13 +17,13 @@ type DaemonSets struct {
}
type DaemonSetRecord struct {
DaemonSetName string `json:"daemonSetName" required:"true"`
DaemonSetCPU float64 `json:"daemonSetCPU" required:"true"`
DaemonSetCPURequest float64 `json:"daemonSetCPURequest" required:"true"`
DaemonSetCPULimit float64 `json:"daemonSetCPULimit" required:"true"`
DaemonSetMemory float64 `json:"daemonSetMemory" required:"true"`
DaemonSetMemoryRequest float64 `json:"daemonSetMemoryRequest" required:"true"`
DaemonSetMemoryLimit float64 `json:"daemonSetMemoryLimit" required:"true"`
DaemonSetName string `json:"daemonSetName" required:"true"`
DaemonSetCPU float64 `json:"daemonSetCPU" required:"true"`
DaemonSetCPURequest float64 `json:"daemonSetCPURequest" required:"true"`
DaemonSetCPULimit float64 `json:"daemonSetCPULimit" required:"true"`
DaemonSetMemory float64 `json:"daemonSetMemory" required:"true"`
DaemonSetMemoryRequest float64 `json:"daemonSetMemoryRequest" required:"true"`
DaemonSetMemoryLimit float64 `json:"daemonSetMemoryLimit" required:"true"`
DesiredNodes int `json:"desiredNodes" required:"true"`
CurrentNodes int `json:"currentNodes" required:"true"`
PodCountsByPhase PodCountsByPhase `json:"podCountsByPhase" required:"true"`
@@ -95,15 +95,15 @@ type GettableReductionRule struct {
types.TimeAuditable
types.UserAuditable
MetricName string `json:"metricName" required:"true"`
MatchType MatchType `json:"matchType" required:"true"`
Labels []string `json:"labels" required:"true" nullable:"true"`
EffectiveFrom time.Time `json:"effectiveFrom" required:"true"`
Active bool `json:"active" required:"true"`
IngestedSeries uint64 `json:"ingestedSeries" required:"true"`
RetainedSeries uint64 `json:"retainedSeries" required:"true"`
IngestedSamples uint64 `json:"ingestedSamples" required:"true"`
RetainedSamples uint64 `json:"retainedSamples" required:"true"`
MetricName string `json:"metricName" required:"true"`
MatchType MatchType `json:"matchType" required:"true"`
Labels []string `json:"labels" required:"true" nullable:"true"`
EffectiveFrom time.Time `json:"effectiveFrom" required:"true"`
Active bool `json:"active" required:"true"`
IngestedSeries uint64 `json:"ingestedSeries" required:"true"`
RetainedSeries uint64 `json:"retainedSeries" required:"true"`
IngestedSamples uint64 `json:"ingestedSamples" required:"true"`
RetainedSamples uint64 `json:"retainedSamples" required:"true"`
}
type GettableReductionRules struct {
@@ -3,10 +3,10 @@ package querybuildertypesv5
import (
"context"
"github.com/hanzo-ds/sqlbuilder"
"github.com/hanzoai/o11y/pkg/errors"
"github.com/hanzoai/o11y/pkg/types/telemetrytypes"
schema "github.com/hanzoai/otel-collector/cmd/o11yschemamigrator/schema_migrator"
"github.com/hanzo-ds/sqlbuilder"
)
var (
@@ -13,7 +13,7 @@ var (
QueryTypeSubQuery = QueryType{valuer.NewString("builder_sub_query")}
QueryTypeJoin = QueryType{valuer.NewString("builder_join")}
QueryTypeTraceOperator = QueryType{valuer.NewString("builder_trace_operator")}
QueryTypeDatastoreSQL = QueryType{valuer.NewString("datastore_sql")}
QueryTypeDatastoreSQL = QueryType{valuer.NewString("datastore_sql")}
QueryTypePromQL = QueryType{valuer.NewString("promql")}
)
@@ -90,7 +90,7 @@ type queryEnvelopePromQL struct {
// queryEnvelopeDatastoreSQL is the OpenAPI schema for a QueryEnvelope with type=datastore_sql.
type queryEnvelopeDatastoreSQL struct {
Type QueryType `json:"type" required:"true" description:"The type of the query."`
Type QueryType `json:"type" required:"true" description:"The type of the query."`
Spec DatastoreQuery `json:"spec" description:"The Datastore SQL query specification."`
}
@@ -123,7 +123,7 @@ func (QueryEnvelope) PrepareJSONSchema(s *jsonschema.Schema) error {
QueryTypeFormula.StringValue(): "#/components/schemas/Querybuildertypesv5QueryEnvelopeFormula",
QueryTypeTraceOperator.StringValue(): "#/components/schemas/Querybuildertypesv5QueryEnvelopeTraceOperator",
QueryTypePromQL.StringValue(): "#/components/schemas/Querybuildertypesv5QueryEnvelopePromQL",
QueryTypeDatastoreSQL.StringValue(): "#/components/schemas/Querybuildertypesv5QueryEnvelopeDatastoreSQL",
QueryTypeDatastoreSQL.StringValue(): "#/components/schemas/Querybuildertypesv5QueryEnvelopeDatastoreSQL",
},
}
return nil
+2 -3
View File
@@ -85,9 +85,9 @@ type QueryType struct {
}
var (
QueryTypeBuilder = QueryType{String: valuer.NewString("builder")}
QueryTypeBuilder = QueryType{String: valuer.NewString("builder")}
QueryTypeDatastoreSQL = QueryType{valuer.NewString("datastore_sql")}
QueryTypePromQL = QueryType{valuer.NewString("promql")}
QueryTypePromQL = QueryType{valuer.NewString("promql")}
)
// Enum implements jsonschema.Enum; returns the acceptable values for QueryType.
@@ -187,4 +187,3 @@ func (rc *RuleCondition) String() string {
data, _ := json.Marshal(*rc)
return string(data)
}
+1 -1
View File
@@ -5,8 +5,8 @@ import (
"encoding/json"
"reflect"
"github.com/hanzoai/o11y/pkg/errors"
"github.com/google/uuid"
"github.com/hanzoai/o11y/pkg/errors"
)
var _ Valuer = (*UUID)(nil)
+1 -1
View File
@@ -5,10 +5,10 @@ import (
"strconv"
"strings"
"github.com/antlr4-go/antlr/v4"
"github.com/hanzoai/o11y/pkg/errors"
grammar "github.com/hanzoai/o11y/pkg/parser/filterquery/grammar"
qbtypes "github.com/hanzoai/o11y/pkg/types/querybuildertypes/querybuildertypesv5"
"github.com/antlr4-go/antlr/v4"
)
// ErrorListener collects syntax errors during parsing.
+3 -3
View File
@@ -31,9 +31,9 @@ func freePort(t *testing.T) int {
// the OnBatch handler exactly once with the decoded batch.
func TestReceiver_DecodesBatch(t *testing.T) {
var (
mu sync.Mutex
got *MetricBatch
done = make(chan struct{}, 1)
mu sync.Mutex
got *MetricBatch
done = make(chan struct{}, 1)
)
port := freePort(t)
+1 -1
View File
@@ -30,7 +30,7 @@ import (
func mounted(t *testing.T) *zip.App {
t.Helper()
app := zip.New(zip.Config{DisableStartupMessage: true})
if err := o11y.Mount(app); err != nil {
if err := o11y.Use(app); err != nil {
t.Fatalf("Mount: %v", err)
}
return app