Documentation
¶
Overview ¶
Package providers contains the built-in data providers for the query engine. Each provider self-registers via init(); consumers enable them with a blank import:
import _ "github.com/flanksource/commons-db/query/providers"
Index ¶
- func FilterOpenSearch(body string, filters []query.ColumnFilterValue) (string, error)
- func NeedsOpenSearchTimeFieldMapping(params []esdsl.ParamBinding) bool
- func ReadOpenTelemetrySpans(ctx context.Context, read OpenTelemetryRead, emit func(query.Row)) error
- func ResolveOpenSearchTimeFieldMapping(ctx dbcontext.Context, request OpenSearchTimeFieldMappingRequest) (*esdsl.TimeFieldMapping, error)
- type OpenSearchTimeFieldMappingRequest
- type OpenTelemetryRead
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FilterOpenSearch ¶
func FilterOpenSearch(body string, filters []query.ColumnFilterValue) (string, error)
FilterOpenSearch folds the given selections into an already-rendered query body, for a caller that assembled its own DSL rather than a stored profile — the connection browser.
It exists so there is one clause compiler in the codebase: a second implementation would be a second set of rules for what excluding a value means, and the two would disagree on the day one of them was fixed.
With no active filter it returns the body byte for byte, so turning filtering on cannot change what an unfiltered query sends.
func NeedsOpenSearchTimeFieldMapping ¶
func NeedsOpenSearchTimeFieldMapping(params []esdsl.ParamBinding) bool
NeedsOpenSearchTimeFieldMapping reports whether resolved parameters contain a non-empty time bound.
func ReadOpenTelemetrySpans ¶ added in v0.1.49
func ReadOpenTelemetrySpans(ctx context.Context, read OpenTelemetryRead, emit func(query.Row)) error
ReadOpenTelemetrySpans emits each span read, normalized as the opentelemetry provider's rows are, with source_index and source_id naming its document. It reads in the date field's order with search_after, opening no point in time, so a follow sees what lands after it started.
func ResolveOpenSearchTimeFieldMapping ¶
func ResolveOpenSearchTimeFieldMapping(ctx dbcontext.Context, request OpenSearchTimeFieldMappingRequest) (*esdsl.TimeFieldMapping, error)
Types ¶
type OpenSearchTimeFieldMappingRequest ¶
type OpenSearchTimeFieldMappingRequest struct {
Searcher *opensearch.Searcher
Index string
Search esdsl.Search
Params []esdsl.ParamBinding
Inspection query.InspectionOptions
}
ResolveOpenSearchTimeFieldMapping reads the exact field used by active time-role parameters. The mapping is runtime metadata and never becomes part of the stored profile.
type OpenTelemetryRead ¶ added in v0.1.49
type OpenTelemetryRead struct {
// Connection is the opentelemetry connection, and Options the
// opentelemetry provider's options for its index and fields.
Connection string
Options map[string]any
// From and To bound the read on the date field, as date math such as
// now-1h or RFC3339; empty leaves that side open.
From, To string
// Follow keeps reading the spans indexed after the read caught up, until
// ctx ends; it has no To.
Follow bool
// Poll is how long a caught-up follow waits before asking again; zero is
// two seconds. Lag holds a follow behind now, so spans indexed late still
// land before the read passes their instant.
Poll, Lag time.Duration
}
OpenTelemetryRead is one read of span documents.
Source Files
¶
- aws.go
- azurelogs.go
- bigquery.go
- cloudwatch.go
- gcp.go
- gcplogging.go
- http.go
- jaeger.go
- k8s_diagnostics.go
- k8s_lookup.go
- k8s_target.go
- k8slogs.go
- loki.go
- opensearch.go
- opensearch_column_inspection.go
- opensearch_filter.go
- opensearch_lookup.go
- opensearch_order.go
- opensearch_search.go
- opensearch_tail.go
- opensearch_time.go
- opensearch_walk.go
- opentelemetry.go
- opentelemetry_parser.go
- opentelemetry_read.go
- opentelemetry_search.go
- postgrest.go
- prometheus.go
- sql.go
Directories
¶
| Path | Synopsis |
|---|---|
|
internal
|
|
|
providerkit
Package providerkit holds the helpers shared by the query provider packages, so a provider split into its own package (sqlite) and the bundle (query/providers) use one implementation without importing each other.
|
Package providerkit holds the helpers shared by the query provider packages, so a provider split into its own package (sqlite) and the bundle (query/providers) use one implementation without importing each other. |
|
Package sqlite holds the dialect-generic SQL query provider and registers it under the "sqlite" key.
|
Package sqlite holds the dialect-generic SQL query provider and registers it under the "sqlite" key. |