2022-07-04 17:13:36 +05:30
|
|
|
package interfaces
|
2021-05-22 19:51:56 +05:30
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
2024-02-21 14:49:33 +05:30
|
|
|
"time"
|
2021-05-22 19:51:56 +05:30
|
|
|
|
2022-07-14 11:59:06 +05:30
|
|
|
"github.com/ClickHouse/clickhouse-go/v2"
|
2021-08-29 10:28:40 +05:30
|
|
|
"github.com/prometheus/prometheus/promql"
|
2022-09-12 12:30:36 +05:30
|
|
|
"github.com/prometheus/prometheus/storage"
|
2021-08-29 10:28:40 +05:30
|
|
|
"github.com/prometheus/prometheus/util/stats"
|
2022-10-06 20:13:30 +05:30
|
|
|
am "go.signoz.io/signoz/pkg/query-service/integrations/alertManager"
|
|
|
|
|
"go.signoz.io/signoz/pkg/query-service/model"
|
2023-03-04 00:05:16 +05:30
|
|
|
v3 "go.signoz.io/signoz/pkg/query-service/model/v3"
|
2021-05-22 19:51:56 +05:30
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type Reader interface {
|
2021-11-22 16:15:58 +05:30
|
|
|
GetChannel(id string) (*model.ChannelItem, *model.ApiError)
|
|
|
|
|
GetChannels() (*[]model.ChannelItem, *model.ApiError)
|
|
|
|
|
DeleteChannel(id string) *model.ApiError
|
2022-03-28 21:01:57 +05:30
|
|
|
CreateChannel(receiver *am.Receiver) (*am.Receiver, *model.ApiError)
|
|
|
|
|
EditChannel(receiver *am.Receiver, id string) (*am.Receiver, *model.ApiError)
|
2021-11-22 16:15:58 +05:30
|
|
|
|
2021-08-29 10:28:40 +05:30
|
|
|
GetInstantQueryMetricsResult(ctx context.Context, query *model.InstantQueryMetricsParams) (*promql.Result, *stats.QueryStats, *model.ApiError)
|
|
|
|
|
GetQueryRangeResult(ctx context.Context, query *model.QueryRangeParams) (*promql.Result, *stats.QueryStats, *model.ApiError)
|
2023-06-30 06:58:22 +05:30
|
|
|
GetServiceOverview(ctx context.Context, query *model.GetServiceOverviewParams, skipConfig *model.SkipConfig) (*[]model.ServiceOverviewItem, *model.ApiError)
|
2024-03-12 17:22:48 +05:30
|
|
|
GetTopLevelOperations(ctx context.Context, skipConfig *model.SkipConfig, start, end time.Time) (*map[string][]string, *map[string][]string, *model.ApiError)
|
2023-06-30 06:58:22 +05:30
|
|
|
GetServices(ctx context.Context, query *model.GetServicesParams, skipConfig *model.SkipConfig) (*[]model.ServiceItem, *model.ApiError)
|
2022-08-04 11:57:05 +05:30
|
|
|
GetTopOperations(ctx context.Context, query *model.GetTopOperationsParams) (*[]model.TopOperationsItem, *model.ApiError)
|
2021-05-31 11:14:11 +05:30
|
|
|
GetUsage(ctx context.Context, query *model.GetUsageParams) (*[]model.UsageItem, error)
|
|
|
|
|
GetServicesList(ctx context.Context) (*[]string, error)
|
2022-08-04 12:38:53 +05:30
|
|
|
GetDependencyGraph(ctx context.Context, query *model.GetServicesParams) (*[]model.ServiceMapDependencyResponseItem, error)
|
|
|
|
|
|
2021-10-20 13:18:19 +05:30
|
|
|
GetTTL(ctx context.Context, ttlParams *model.GetTTLParams) (*model.GetTTLResponseItem, *model.ApiError)
|
2022-03-21 23:58:56 +05:30
|
|
|
|
|
|
|
|
// GetDisks returns a list of disks configured in the underlying DB. It is supported by
|
|
|
|
|
// clickhouse only.
|
|
|
|
|
GetDisks(ctx context.Context) (*[]model.DiskItem, *model.ApiError)
|
2022-01-26 20:41:59 +05:30
|
|
|
GetSpanFilters(ctx context.Context, query *model.SpanFilterParams) (*model.SpanFiltersResponse, *model.ApiError)
|
2023-04-13 15:33:08 +05:30
|
|
|
GetTraceAggregateAttributes(ctx context.Context, req *v3.AggregateAttributeRequest) (*v3.AggregateAttributeResponse, error)
|
2023-06-08 15:46:18 +05:30
|
|
|
GetTraceAttributeKeys(ctx context.Context, req *v3.FilterAttributeKeyRequest) (*v3.FilterAttributeKeyResponse, error)
|
2023-04-13 15:33:08 +05:30
|
|
|
GetTraceAttributeValues(ctx context.Context, req *v3.FilterAttributeValueRequest) (*v3.FilterAttributeValueResponse, error)
|
2023-06-08 15:46:18 +05:30
|
|
|
GetSpanAttributeKeys(ctx context.Context) (map[string]v3.AttributeKey, error)
|
2023-01-25 12:35:44 +05:30
|
|
|
GetTagFilters(ctx context.Context, query *model.TagFilterParams) (*model.TagFilters, *model.ApiError)
|
|
|
|
|
GetTagValues(ctx context.Context, query *model.TagFilterParams) (*model.TagValues, *model.ApiError)
|
2022-01-26 20:41:59 +05:30
|
|
|
GetFilteredSpans(ctx context.Context, query *model.GetFilteredSpansParams) (*model.GetFilterSpansResponse, *model.ApiError)
|
|
|
|
|
GetFilteredSpansAggregates(ctx context.Context, query *model.GetFilteredSpanAggregatesParams) (*model.GetFilteredSpansAggregatesResponse, *model.ApiError)
|
|
|
|
|
|
2022-07-13 15:55:43 +05:30
|
|
|
ListErrors(ctx context.Context, params *model.ListErrorsParams) (*[]model.Error, *model.ApiError)
|
|
|
|
|
CountErrors(ctx context.Context, params *model.CountErrorsParams) (uint64, *model.ApiError)
|
|
|
|
|
GetErrorFromErrorID(ctx context.Context, params *model.GetErrorParams) (*model.ErrorWithSpan, *model.ApiError)
|
|
|
|
|
GetErrorFromGroupID(ctx context.Context, params *model.GetErrorParams) (*model.ErrorWithSpan, *model.ApiError)
|
|
|
|
|
GetNextPrevErrorIDs(ctx context.Context, params *model.GetErrorParams) (*model.NextPrevErrorIDs, *model.ApiError)
|
|
|
|
|
|
2021-10-20 13:18:19 +05:30
|
|
|
// Search Interfaces
|
2022-11-24 18:18:19 +05:30
|
|
|
SearchTraces(ctx context.Context, traceID string, spanId string, levelUp int, levelDown int, spanLimit int, smartTraceAlgorithm func(payload []model.SearchSpanResponseItem, targetSpanId string, levelUp int, levelDown int, spanLimit int) ([]model.SearchSpansResult, error)) (*[]model.SearchSpansResult, error)
|
2021-10-20 13:18:19 +05:30
|
|
|
|
|
|
|
|
// Setter Interfaces
|
|
|
|
|
SetTTL(ctx context.Context, ttlParams *model.TTLParams) (*model.SetTTLResponseItem, *model.ApiError)
|
2022-05-03 11:20:57 +05:30
|
|
|
|
2023-07-13 18:50:19 +05:30
|
|
|
FetchTemporality(ctx context.Context, metricNames []string) (map[string]map[v3.Temporality]bool, error)
|
2022-06-24 14:52:11 +05:30
|
|
|
GetMetricAutocompleteMetricNames(ctx context.Context, matchText string, limit int) (*[]string, *model.ApiError)
|
2022-05-03 11:20:57 +05:30
|
|
|
GetMetricAutocompleteTagKey(ctx context.Context, params *model.MetricAutocompleteTagParams) (*[]string, *model.ApiError)
|
|
|
|
|
GetMetricAutocompleteTagValue(ctx context.Context, params *model.MetricAutocompleteTagParams) (*[]string, *model.ApiError)
|
2022-06-24 14:52:11 +05:30
|
|
|
GetMetricResult(ctx context.Context, query string) ([]*model.Series, error)
|
2022-11-24 18:18:19 +05:30
|
|
|
GetMetricResultEE(ctx context.Context, query string) ([]*model.Series, string, error)
|
2023-03-04 00:05:16 +05:30
|
|
|
GetMetricAggregateAttributes(ctx context.Context, req *v3.AggregateAttributeRequest) (*v3.AggregateAttributeResponse, error)
|
2023-03-10 11:22:34 +05:30
|
|
|
GetMetricAttributeKeys(ctx context.Context, req *v3.FilterAttributeKeyRequest) (*v3.FilterAttributeKeyResponse, error)
|
|
|
|
|
GetMetricAttributeValues(ctx context.Context, req *v3.FilterAttributeValueRequest) (*v3.FilterAttributeValueResponse, error)
|
2023-04-10 19:36:13 +05:30
|
|
|
|
2024-03-18 10:01:53 +05:30
|
|
|
// Returns `MetricStatus` for latest received metric among `metricNames`. Useful for status calculations
|
|
|
|
|
GetLatestReceivedMetric(ctx context.Context, metricNames []string) (*model.MetricStatus, *model.ApiError)
|
|
|
|
|
|
2023-04-10 19:36:13 +05:30
|
|
|
// QB V3 metrics/traces/logs
|
2023-03-23 19:45:15 +05:30
|
|
|
GetTimeSeriesResultV3(ctx context.Context, query string) ([]*v3.Series, error)
|
2023-04-10 19:36:13 +05:30
|
|
|
GetListResultV3(ctx context.Context, query string) ([]*v3.Row, error)
|
2023-07-20 17:53:55 +05:30
|
|
|
LiveTailLogsV3(ctx context.Context, query string, timestampStart uint64, idStart string, client *v3.LogsLiveTailClient)
|
2022-07-04 17:13:36 +05:30
|
|
|
|
2023-12-13 18:14:55 +05:30
|
|
|
GetDashboardsInfo(ctx context.Context) (*model.DashboardsInfo, error)
|
|
|
|
|
GetAlertsInfo(ctx context.Context) (*model.AlertsInfo, error)
|
2024-03-20 19:59:28 +05:30
|
|
|
GetSavedViewsInfo(ctx context.Context) (*model.SavedViewsInfo, error)
|
2022-07-04 17:13:36 +05:30
|
|
|
GetTotalSpans(ctx context.Context) (uint64, error)
|
2024-02-21 14:49:33 +05:30
|
|
|
GetTotalLogs(ctx context.Context) (uint64, error)
|
|
|
|
|
GetTotalSamples(ctx context.Context) (uint64, error)
|
|
|
|
|
GetSpansInLastHeartBeatInterval(ctx context.Context, interval time.Duration) (uint64, error)
|
2022-07-04 17:13:36 +05:30
|
|
|
GetTimeSeriesInfo(ctx context.Context) (map[string]interface{}, error)
|
2024-02-21 14:49:33 +05:30
|
|
|
GetSamplesInfoInLastHeartBeatInterval(ctx context.Context, interval time.Duration) (uint64, error)
|
|
|
|
|
GetLogsInfoInLastHeartBeatInterval(ctx context.Context, interval time.Duration) (uint64, error)
|
|
|
|
|
GetTagsInfoInLastHeartBeatInterval(ctx context.Context, interval time.Duration) (*model.TagsInfo, error)
|
2022-12-26 23:01:54 +05:30
|
|
|
GetDistributedInfoInLastHeartBeatInterval(ctx context.Context) (map[string]interface{}, error)
|
2022-07-12 16:38:26 +05:30
|
|
|
// Logs
|
|
|
|
|
GetLogFields(ctx context.Context) (*model.GetFieldsResponse, *model.ApiError)
|
|
|
|
|
UpdateLogField(ctx context.Context, field *model.UpdateField) *model.ApiError
|
2023-10-09 15:25:13 +05:30
|
|
|
GetLogs(ctx context.Context, params *model.LogsFilterParams) (*[]model.SignozLog, *model.ApiError)
|
2022-07-18 18:55:52 +05:30
|
|
|
TailLogs(ctx context.Context, client *model.LogsTailClient)
|
2022-07-20 12:11:03 +05:30
|
|
|
AggregateLogs(ctx context.Context, params *model.LogsAggregateParams) (*model.GetLogsAggregatesResponse, *model.ApiError)
|
2023-04-06 13:32:24 +05:30
|
|
|
GetLogAttributeKeys(ctx context.Context, req *v3.FilterAttributeKeyRequest) (*v3.FilterAttributeKeyResponse, error)
|
|
|
|
|
GetLogAttributeValues(ctx context.Context, req *v3.FilterAttributeValueRequest) (*v3.FilterAttributeValueResponse, error)
|
|
|
|
|
GetLogAggregateAttributes(ctx context.Context, req *v3.AggregateAttributeRequest) (*v3.AggregateAttributeResponse, error)
|
2022-07-18 16:49:04 +05:30
|
|
|
|
2022-07-14 11:59:06 +05:30
|
|
|
// Connection needed for rules, not ideal but required
|
|
|
|
|
GetConn() clickhouse.Conn
|
2022-09-12 12:30:36 +05:30
|
|
|
GetQueryEngine() *promql.Engine
|
|
|
|
|
GetFanoutStorage() *storage.Storage
|
2022-09-11 03:34:02 +05:30
|
|
|
|
|
|
|
|
QueryDashboardVars(ctx context.Context, query string) (*model.DashboardVar, error)
|
2023-02-15 00:37:57 +05:30
|
|
|
CheckClickHouse(ctx context.Context) error
|
2023-07-26 12:27:46 +05:30
|
|
|
|
2024-01-19 13:50:51 +05:30
|
|
|
GetLatencyMetricMetadata(context.Context, string, string, bool) (*v3.LatencyMetricMetadataResponse, error)
|
2024-02-11 00:31:47 +05:30
|
|
|
GetMetricMetadata(context.Context, string, string) (*v3.MetricMetadataResponse, error)
|
2021-05-22 19:51:56 +05:30
|
|
|
}
|
2023-06-08 15:46:18 +05:30
|
|
|
|
|
|
|
|
type Querier interface {
|
2023-09-17 10:40:45 +05:30
|
|
|
QueryRange(context.Context, *v3.QueryRangeParamsV3, map[string]v3.AttributeKey) ([]*v3.Result, error, map[string]string)
|
2023-06-08 15:46:18 +05:30
|
|
|
|
|
|
|
|
// test helpers
|
|
|
|
|
QueriesExecuted() []string
|
|
|
|
|
}
|