mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-06-04 11:25:52 +08:00

* WIP promql support * forked prometheus and promhouse integrated * removing __debug_bin from git * feat: prometheus config file to load * feat: read prometheus config from args * fix: WIP fixing errors in docker build * feat: added clickhousemetricswrite exporter in metrics * feat: changing otelcol image tag * fix: read prometheus.yml from config flag in docker-compose * fix: WIP clickhouse connection error * fix: used signoz/prometheus tag v1.9.4 * chore: response format as in prometheus * chore: query_range works with clickhouse reader and throws not implemented error for druid * chore: moved ApiError struct to model * feat: enabled instant query api for metrics * chore: parser for instant query api params
126 lines
2.4 KiB
Go
126 lines
2.4 KiB
Go
package model
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
)
|
|
|
|
type ApiError struct {
|
|
Typ ErrorType
|
|
Err error
|
|
}
|
|
type ErrorType string
|
|
|
|
const (
|
|
ErrorNone ErrorType = ""
|
|
ErrorTimeout ErrorType = "timeout"
|
|
ErrorCanceled ErrorType = "canceled"
|
|
ErrorExec ErrorType = "execution"
|
|
ErrorBadData ErrorType = "bad_data"
|
|
ErrorInternal ErrorType = "internal"
|
|
ErrorUnavailable ErrorType = "unavailable"
|
|
ErrorNotFound ErrorType = "not_found"
|
|
ErrorNotImplemented ErrorType = "not_implemented"
|
|
)
|
|
|
|
type InstantQueryMetricsParams struct {
|
|
Time time.Time
|
|
Query string
|
|
Stats string
|
|
}
|
|
|
|
type QueryRangeParams struct {
|
|
Start time.Time
|
|
End time.Time
|
|
Step time.Duration
|
|
Query string
|
|
Stats string
|
|
}
|
|
|
|
type GetTopEndpointsParams struct {
|
|
StartTime string
|
|
EndTime string
|
|
ServiceName string
|
|
Start *time.Time
|
|
End *time.Time
|
|
}
|
|
|
|
type GetUsageParams struct {
|
|
StartTime string
|
|
EndTime string
|
|
ServiceName string
|
|
Period string
|
|
StepHour int
|
|
Start *time.Time
|
|
End *time.Time
|
|
}
|
|
|
|
type GetServicesParams struct {
|
|
StartTime string
|
|
EndTime string
|
|
Period int
|
|
Start *time.Time
|
|
End *time.Time
|
|
}
|
|
|
|
type GetServiceOverviewParams struct {
|
|
StartTime string
|
|
EndTime string
|
|
Start *time.Time
|
|
End *time.Time
|
|
ServiceName string
|
|
Period string
|
|
StepSeconds int
|
|
}
|
|
|
|
type ApplicationPercentileParams struct {
|
|
ServiceName string
|
|
GranOrigin string
|
|
GranPeriod string
|
|
Intervals string
|
|
}
|
|
|
|
func (query *ApplicationPercentileParams) SetGranPeriod(step int) {
|
|
minutes := step / 60
|
|
query.GranPeriod = fmt.Sprintf("PT%dM", minutes)
|
|
}
|
|
|
|
type TagQuery struct {
|
|
Key string
|
|
Value string
|
|
Operator string
|
|
}
|
|
|
|
type SpanSearchAggregatesParams struct {
|
|
ServiceName string
|
|
OperationName string
|
|
Kind string
|
|
MinDuration string
|
|
MaxDuration string
|
|
Tags []TagQuery
|
|
Start *time.Time
|
|
End *time.Time
|
|
GranOrigin string
|
|
GranPeriod string
|
|
Intervals string
|
|
StepSeconds int
|
|
Dimension string
|
|
AggregationOption string
|
|
}
|
|
|
|
type SpanSearchParams struct {
|
|
ServiceName string
|
|
OperationName string
|
|
Kind string
|
|
Intervals string
|
|
Start *time.Time
|
|
End *time.Time
|
|
MinDuration string
|
|
MaxDuration string
|
|
Limit int64
|
|
Order string
|
|
Offset int64
|
|
BatchSize int64
|
|
Tags []TagQuery
|
|
}
|