mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-11 04:39:59 +08:00
chore: changed ttl get response to number of hours in int (#351)
This commit is contained in:
parent
fa11cd651e
commit
f3fb325a13
@ -856,7 +856,7 @@ func (r *ClickHouseReader) SetTTL(ctx context.Context, ttlParams *model.TTLParam
|
||||
|
||||
func (r *ClickHouseReader) GetTTL(ctx context.Context, ttlParams *model.GetTTLParams) (*model.GetTTLResponseItem, *model.ApiError) {
|
||||
|
||||
parseTTL := func(queryResp string) string {
|
||||
parseTTL := func(queryResp string) int {
|
||||
values := strings.Split(queryResp, " ")
|
||||
N := len(values)
|
||||
ttlIdx := -1
|
||||
@ -868,12 +868,17 @@ func (r *ClickHouseReader) GetTTL(ctx context.Context, ttlParams *model.GetTTLPa
|
||||
}
|
||||
}
|
||||
if ttlIdx == -1 {
|
||||
return ""
|
||||
return ttlIdx
|
||||
}
|
||||
|
||||
output := strings.SplitN(values[ttlIdx], "(", 2)
|
||||
timePart := strings.Trim(output[1], ")")
|
||||
return timePart
|
||||
seconds_int, err := strconv.Atoi(timePart)
|
||||
if err != nil {
|
||||
return -1
|
||||
}
|
||||
ttl_hrs := seconds_int / 3600
|
||||
return ttl_hrs
|
||||
}
|
||||
|
||||
getMetricsTTL := func() (*model.DBResponseTTL, *model.ApiError) {
|
||||
|
@ -53,6 +53,8 @@ github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE
|
||||
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
|
||||
github.com/SigNoz/prometheus v1.9.4 h1:HqMPTM/QXgsjzuG5whSS+9l0mVePuya/uZmrAt2H9HQ=
|
||||
github.com/SigNoz/prometheus v1.9.4/go.mod h1:39/E+7N2hh5Q6NunhoRz9EHCRAyRGj63YK1hE4SiHdk=
|
||||
github.com/SigNoz/prometheus v1.9.5 h1:ITuK/71BFY3Hxv50/Upsvo6KJUdOxT7o6lCXmVxyLF0=
|
||||
github.com/SigNoz/prometheus v1.9.5/go.mod h1:BHEawFYBYkVr9BjPXsz9Ye6QVVQ+2a99m6r/S8hO/lA=
|
||||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
|
||||
|
@ -205,6 +205,6 @@ type DBResponseTTL struct {
|
||||
}
|
||||
|
||||
type GetTTLResponseItem struct {
|
||||
MetricsTime string `json:"metrics_ttl_duration"`
|
||||
TracesTime string `json:"traces_ttl_duration"`
|
||||
MetricsTime int `json:"metrics_ttl_duration_hrs"`
|
||||
TracesTime int `json:"traces_ttl_duration_hrs"`
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user