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
|
|
|
|
2025-03-20 21:01:41 +05:30
|
|
|
"github.com/SigNoz/signoz/pkg/query-service/model"
|
|
|
|
|
"github.com/SigNoz/signoz/pkg/query-service/model/metrics_explorer"
|
|
|
|
|
v3 "github.com/SigNoz/signoz/pkg/query-service/model/v3"
|
|
|
|
|
"github.com/SigNoz/signoz/pkg/query-service/querycache"
|
2025-05-03 18:30:07 +05:30
|
|
|
"github.com/SigNoz/signoz/pkg/valuer"
|
2021-08-29 10:28:40 +05:30
|
|
|
"github.com/prometheus/prometheus/promql"
|
|
|
|
|
"github.com/prometheus/prometheus/util/stats"
|
2021-05-22 19:51:56 +05:30
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type Reader interface {
|
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)
|
2025-04-28 14:57:26 +05:30
|
|
|
GetTopLevelOperations(ctx context.Context, start, end time.Time, services []string) (*map[string][]string, *model.ApiError)
|
2025-05-20 11:28:40 +05:30
|
|
|
GetEntryPointOperations(ctx context.Context, query *model.GetTopOperationsParams) (*[]model.TopOperationsItem, error)
|
2025-04-28 14:57:26 +05:30
|
|
|
GetServices(ctx context.Context, query *model.GetServicesParams) (*[]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)
|
|
|
|
|
|
2025-04-04 01:36:47 +05:30
|
|
|
GetTTL(ctx context.Context, orgID string, ttlParams *model.GetTTLParams) (*model.GetTTLResponseItem, *model.ApiError)
|
2025-09-01 13:00:57 +05:30
|
|
|
GetCustomRetentionTTL(ctx context.Context, orgID string) (*model.GetCustomRetentionTTLResponse, error)
|
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)
|
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)
|
2025-06-25 18:29:22 +05:30
|
|
|
GetSpanAttributeKeysByNames(ctx context.Context, names []string) (map[string]v3.AttributeKey, error)
|
2022-01-26 20:41:59 +05:30
|
|
|
|
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
|
2025-04-07 22:49:39 +05:30
|
|
|
SearchTraces(ctx context.Context, params *model.SearchTracesParams) (*[]model.SearchSpansResult, error)
|
2025-06-15 13:39:39 +03:00
|
|
|
GetWaterfallSpansForTraceWithMetadata(ctx context.Context, orgID valuer.UUID, traceID string, req *model.GetWaterfallSpansForTraceWithMetadataParams) (*model.GetWaterfallSpansForTraceWithMetadataResponse, error)
|
|
|
|
|
GetFlamegraphSpansForTrace(ctx context.Context, orgID valuer.UUID, traceID string, req *model.GetFlamegraphSpansForTraceParams) (*model.GetFlamegraphSpansForTraceResponse, error)
|
2021-10-20 13:18:19 +05:30
|
|
|
|
|
|
|
|
// Setter Interfaces
|
2025-04-04 01:36:47 +05:30
|
|
|
SetTTL(ctx context.Context, orgID string, ttlParams *model.TTLParams) (*model.SetTTLResponseItem, *model.ApiError)
|
2025-09-01 13:00:57 +05:30
|
|
|
SetTTLV2(ctx context.Context, orgID string, params *model.CustomRetentionTTLParams) (*model.CustomRetentionTTLResponse, error)
|
2022-05-03 11:20:57 +05:30
|
|
|
|
2025-05-03 18:30:07 +05:30
|
|
|
FetchTemporality(ctx context.Context, orgID valuer.UUID, metricNames []string) (map[string]map[v3.Temporality]bool, error)
|
2025-05-30 15:57:29 +05:30
|
|
|
GetMetricAggregateAttributes(ctx context.Context, orgID valuer.UUID, req *v3.AggregateAttributeRequest, skipSignozMetrics bool) (*v3.AggregateAttributeResponse, error)
|
2025-08-07 16:50:37 +05:30
|
|
|
GetMeterAggregateAttributes(ctx context.Context, orgID valuer.UUID, req *v3.AggregateAttributeRequest) (*v3.AggregateAttributeResponse, error)
|
2023-03-10 11:22:34 +05:30
|
|
|
GetMetricAttributeKeys(ctx context.Context, req *v3.FilterAttributeKeyRequest) (*v3.FilterAttributeKeyResponse, error)
|
2025-08-07 16:50:37 +05:30
|
|
|
GetMeterAttributeKeys(ctx context.Context, req *v3.FilterAttributeKeyRequest) (*v3.FilterAttributeKeyResponse, error)
|
2023-03-10 11:22:34 +05:30
|
|
|
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
|
2025-02-06 13:08:47 +05:30
|
|
|
GetLatestReceivedMetric(
|
|
|
|
|
ctx context.Context, metricNames []string, labelValues map[string]string,
|
|
|
|
|
) (*model.MetricStatus, *model.ApiError)
|
2024-03-18 10:01:53 +05:30
|
|
|
|
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)
|
2022-07-12 16:38:26 +05:30
|
|
|
// Logs
|
|
|
|
|
GetLogFields(ctx context.Context) (*model.GetFieldsResponse, *model.ApiError)
|
2025-06-21 10:07:57 +05:30
|
|
|
GetLogFieldsFromNames(ctx context.Context, fieldNames []string) (*model.GetFieldsResponse, *model.ApiError)
|
2022-07-12 16:38:26 +05:30
|
|
|
UpdateLogField(ctx context.Context, field *model.UpdateField) *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)
|
2024-08-08 09:27:41 +05:30
|
|
|
GetQBFilterSuggestionsForLogs(
|
|
|
|
|
ctx context.Context,
|
|
|
|
|
req *v3.QBFilterSuggestionsRequest,
|
|
|
|
|
) (*v3.QBFilterSuggestionsResponse, *model.ApiError)
|
2022-07-18 16:49:04 +05:30
|
|
|
|
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
|
|
|
|
2025-05-03 18:30:07 +05:30
|
|
|
GetMetricMetadata(context.Context, valuer.UUID, string, string) (*v3.MetricMetadataResponse, error)
|
2024-07-31 16:00:57 +05:30
|
|
|
|
2024-09-13 18:10:49 +05:30
|
|
|
AddRuleStateHistory(ctx context.Context, ruleStateHistory []model.RuleStateHistory) error
|
|
|
|
|
GetOverallStateTransitions(ctx context.Context, ruleID string, params *model.QueryRuleStateHistory) ([]model.ReleStateItem, error)
|
|
|
|
|
ReadRuleStateHistoryByRuleID(ctx context.Context, ruleID string, params *model.QueryRuleStateHistory) (*model.RuleStateTimeline, error)
|
|
|
|
|
GetTotalTriggers(ctx context.Context, ruleID string, params *model.QueryRuleStateHistory) (uint64, error)
|
|
|
|
|
GetTriggersByInterval(ctx context.Context, ruleID string, params *model.QueryRuleStateHistory) (*v3.Series, error)
|
|
|
|
|
GetAvgResolutionTime(ctx context.Context, ruleID string, params *model.QueryRuleStateHistory) (float64, error)
|
|
|
|
|
GetAvgResolutionTimeByInterval(ctx context.Context, ruleID string, params *model.QueryRuleStateHistory) (*v3.Series, error)
|
|
|
|
|
ReadRuleStateHistoryTopContributorsByRuleID(ctx context.Context, ruleID string, params *model.QueryRuleStateHistory) ([]model.RuleStateHistoryContributor, error)
|
|
|
|
|
GetLastSavedRuleStateHistory(ctx context.Context, ruleID string) ([]model.RuleStateHistory, error)
|
2024-09-09 13:06:09 +05:30
|
|
|
|
2024-07-31 16:00:57 +05:30
|
|
|
GetMinAndMaxTimestampForTraceID(ctx context.Context, traceID []string) (int64, int64, error)
|
2024-08-14 19:53:36 +05:30
|
|
|
|
|
|
|
|
// Query Progress tracking helpers.
|
|
|
|
|
ReportQueryStartForProgressTracking(queryId string) (reportQueryFinished func(), err *model.ApiError)
|
2024-09-13 18:10:49 +05:30
|
|
|
SubscribeToQueryProgress(queryId string) (<-chan model.QueryProgress, func(), *model.ApiError)
|
2024-11-25 23:23:42 +05:30
|
|
|
|
|
|
|
|
GetCountOfThings(ctx context.Context, query string) (uint64, error)
|
2024-12-19 11:52:20 +07:00
|
|
|
|
|
|
|
|
//trace
|
|
|
|
|
GetTraceFields(ctx context.Context) (*model.GetFieldsResponse, *model.ApiError)
|
|
|
|
|
UpdateTraceField(ctx context.Context, field *model.UpdateField) *model.ApiError
|
2025-02-20 13:49:44 +05:30
|
|
|
|
|
|
|
|
GetAllMetricFilterAttributeValues(ctx context.Context, req *metrics_explorer.FilterValueRequest) ([]string, *model.ApiError)
|
|
|
|
|
GetAllMetricFilterUnits(ctx context.Context, req *metrics_explorer.FilterValueRequest) ([]string, *model.ApiError)
|
|
|
|
|
GetAllMetricFilterTypes(ctx context.Context, req *metrics_explorer.FilterValueRequest) ([]string, *model.ApiError)
|
2025-05-30 15:57:29 +05:30
|
|
|
GetAllMetricFilterAttributeKeys(ctx context.Context, req *metrics_explorer.FilterKeyRequest) (*[]v3.AttributeKey, *model.ApiError)
|
2025-02-20 13:49:44 +05:30
|
|
|
|
2025-02-27 12:25:58 +05:30
|
|
|
GetMetricsDataPoints(ctx context.Context, metricName string) (uint64, *model.ApiError)
|
|
|
|
|
GetMetricsLastReceived(ctx context.Context, metricName string) (int64, *model.ApiError)
|
2025-02-20 13:49:44 +05:30
|
|
|
GetTotalTimeSeriesForMetricName(ctx context.Context, metricName string) (uint64, *model.ApiError)
|
|
|
|
|
GetActiveTimeSeriesForMetricName(ctx context.Context, metricName string, duration time.Duration) (uint64, *model.ApiError)
|
2025-05-06 12:36:12 +05:30
|
|
|
GetAttributesForMetricName(ctx context.Context, metricName string, start, end *int64, set *v3.FilterSet) (*[]metrics_explorer.Attribute, *model.ApiError)
|
2025-02-20 13:49:44 +05:30
|
|
|
|
2025-05-03 18:30:07 +05:30
|
|
|
ListSummaryMetrics(ctx context.Context, orgID valuer.UUID, req *metrics_explorer.SummaryListMetricsRequest) (*metrics_explorer.SummaryListMetricsResponse, *model.ApiError)
|
2025-02-20 13:49:44 +05:30
|
|
|
|
|
|
|
|
GetMetricsTimeSeriesPercentage(ctx context.Context, request *metrics_explorer.TreeMapMetricsRequest) (*[]metrics_explorer.TreeMapResponseItem, *model.ApiError)
|
|
|
|
|
GetMetricsSamplesPercentage(ctx context.Context, req *metrics_explorer.TreeMapMetricsRequest) (*[]metrics_explorer.TreeMapResponseItem, *model.ApiError)
|
2025-02-28 13:06:41 +05:30
|
|
|
|
|
|
|
|
GetNameSimilarity(ctx context.Context, req *metrics_explorer.RelatedMetricsRequest) (map[string]metrics_explorer.RelatedMetricsScore, *model.ApiError)
|
|
|
|
|
GetAttributeSimilarity(ctx context.Context, req *metrics_explorer.RelatedMetricsRequest) (map[string]metrics_explorer.RelatedMetricsScore, *model.ApiError)
|
2025-03-13 14:57:27 +05:30
|
|
|
|
|
|
|
|
GetMetricsAllResourceAttributes(ctx context.Context, start int64, end int64) (map[string]uint64, *model.ApiError)
|
|
|
|
|
GetInspectMetricsFingerprints(ctx context.Context, attributes []string, req *metrics_explorer.InspectMetricsRequest) ([]string, *model.ApiError)
|
|
|
|
|
GetInspectMetrics(ctx context.Context, req *metrics_explorer.InspectMetricsRequest, fingerprints []string) (*metrics_explorer.InspectMetricsResponse, *model.ApiError)
|
2025-03-18 16:09:34 +05:30
|
|
|
|
2025-05-03 18:30:07 +05:30
|
|
|
DeleteMetricsMetadata(ctx context.Context, orgID valuer.UUID, metricName string) *model.ApiError
|
|
|
|
|
UpdateMetricsMetadata(ctx context.Context, orgID valuer.UUID, req *model.UpdateMetricsMetadata) *model.ApiError
|
|
|
|
|
GetUpdatedMetricsMetadata(ctx context.Context, orgID valuer.UUID, metricNames ...string) (map[string]*model.UpdateMetricsMetadata, *model.ApiError)
|
2025-03-18 16:09:34 +05:30
|
|
|
|
|
|
|
|
CheckForLabelsInMetric(ctx context.Context, metricName string, labels []string) (bool, *model.ApiError)
|
2025-07-23 14:57:31 +05:30
|
|
|
GetNormalizedStatus(ctx context.Context, orgID valuer.UUID, metricNames []string) (map[string]bool, error)
|
2021-05-22 19:51:56 +05:30
|
|
|
}
|
2023-06-08 15:46:18 +05:30
|
|
|
|
|
|
|
|
type Querier interface {
|
2025-05-03 18:30:07 +05:30
|
|
|
QueryRange(context.Context, valuer.UUID, *v3.QueryRangeParamsV3) ([]*v3.Result, map[string]error, error)
|
2023-06-08 15:46:18 +05:30
|
|
|
|
|
|
|
|
// test helpers
|
|
|
|
|
QueriesExecuted() []string
|
2024-07-15 18:06:39 +05:30
|
|
|
TimeRanges() [][]int
|
2023-06-08 15:46:18 +05:30
|
|
|
}
|
2024-09-20 19:23:01 +05:30
|
|
|
|
|
|
|
|
type QueryCache interface {
|
2025-05-03 18:30:07 +05:30
|
|
|
FindMissingTimeRanges(orgID valuer.UUID, start, end int64, step int64, cacheKey string) []querycache.MissInterval
|
|
|
|
|
FindMissingTimeRangesV2(orgID valuer.UUID, start, end int64, step int64, cacheKey string) []querycache.MissInterval
|
|
|
|
|
MergeWithCachedSeriesData(orgID valuer.UUID, cacheKey string, newData []querycache.CachedSeriesData) []querycache.CachedSeriesData
|
|
|
|
|
StoreSeriesInCache(orgID valuer.UUID, cacheKey string, series []querycache.CachedSeriesData)
|
|
|
|
|
MergeWithCachedSeriesDataV2(orgID valuer.UUID, cacheKey string, series []querycache.CachedSeriesData) []querycache.CachedSeriesData
|
2024-09-20 19:23:01 +05:30
|
|
|
}
|