This commit is contained in:
Aditya Ujeniya 2024-09-17 10:49:32 +02:00
parent 545c176974
commit 4ac6cef01f
7 changed files with 26 additions and 8 deletions

2
.gitignore vendored
View File

@ -19,6 +19,8 @@
/var
/configs
sample.txt
migrateTimestamps.pl
test_ccms_api.sh
test_ccms_free_api.sh

View File

@ -75,7 +75,7 @@
}
},
"/free/": {
"get": {
"post": {
"security": [
{
"ApiKeyAuth": []
@ -273,6 +273,9 @@
"min": {
"type": "number"
},
"resolution": {
"type": "integer"
},
"to": {
"type": "integer"
}
@ -290,6 +293,9 @@
"metric": {
"type": "string"
},
"resolution": {
"type": "integer"
},
"scale-by": {
"type": "number"
},

View File

@ -16,6 +16,8 @@ definitions:
type: number
min:
type: number
resolution:
type: integer
to:
type: integer
type: object
@ -27,6 +29,8 @@ definitions:
type: string
metric:
type: string
resolution:
type: integer
scale-by:
type: number
subtype:
@ -137,7 +141,7 @@ paths:
tags:
- debug
/free/:
get:
post:
parameters:
- description: up to timestamp
in: query

View File

@ -136,7 +136,7 @@ func (data *ApiMetricData) PadDataWithNull(ms *memorystore.MemoryStore, from, to
// @failure 403 {object} api.ErrorResponse "Forbidden"
// @failure 500 {object} api.ErrorResponse "Internal Server Error"
// @security ApiKeyAuth
// @router /free/ [get]
// @router /free/ [post]
func handleFree(rw http.ResponseWriter, r *http.Request) {
rawTo := r.URL.Query().Get("to")
if rawTo == "" {

View File

@ -81,7 +81,7 @@ const docTemplate = `{
}
},
"/free/": {
"get": {
"post": {
"security": [
{
"ApiKeyAuth": []
@ -279,6 +279,9 @@ const docTemplate = `{
"min": {
"type": "number"
},
"resolution": {
"type": "integer"
},
"to": {
"type": "integer"
}
@ -296,6 +299,9 @@ const docTemplate = `{
"metric": {
"type": "string"
},
"resolution": {
"type": "integer"
},
"scale-by": {
"type": "number"
},

View File

@ -255,7 +255,8 @@ func decodeLine(dec *lineprotocol.Decoder,
if len(subTypeBuf) == 0 {
subTypeBuf = append(subTypeBuf, val...)
} else {
subTypeBuf = reorder(typeBuf, val)
subTypeBuf = reorder(subTypeBuf, val)
// subTypeBuf = reorder(typeBuf, val)
}
case "stype-id":
subTypeBuf = append(subTypeBuf, val...)
@ -308,7 +309,7 @@ func decodeLine(dec *lineprotocol.Decoder,
}
if t, err = dec.Time(lineprotocol.Second, t); err != nil {
return err
return fmt.Errorf("timestamp : %#v with error : %#v", lineprotocol.Second, err.Error())
}
if err := ms.WriteToLevel(lvl, selector, t.Unix(), []memorystore.Metric{metric}); err != nil {

View File

@ -42,7 +42,7 @@ func LargestTriangleThreeBucket(data []util.Float, old_frequency int64, new_freq
}
if new_frequency%old_frequency != 0 {
return nil, 0, errors.New(fmt.Sprintf("new sampling frequency : %d should be multiple of the old frequency : %d", new_frequency, old_frequency))
return nil, 0, fmt.Errorf("new sampling frequency : %d should be multiple of the old frequency : %d", new_frequency, old_frequency)
}
var step int = int(new_frequency / old_frequency)
@ -100,7 +100,6 @@ func LargestTriangleThreeBucket(data []util.Float, old_frequency int64, new_freq
}
if math.IsNaN(float64(avgPointY)) {
flag_ = 1
}
}