-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: update cabonapi to c2229eabd094 #1074
base: master
Are you sure you want to change the base?
Conversation
/build |
/build |
Build and push Docker images with tag: feature-update-cabonapi-to-c2229eabd094.2024-09-10.2e1a3e6 |
2 similar comments
Build and push Docker images with tag: feature-update-cabonapi-to-c2229eabd094.2024-09-10.2e1a3e6 |
Build and push Docker images with tag: feature-update-cabonapi-to-c2229eabd094.2024-09-10.2e1a3e6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Надушниль
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Поправь пж godoc для IsAvailable
if err != nil { | ||
return err | ||
return merry.Unwrap(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Эта штука deprecated
. Заменим на что-нибудь другое?
} | ||
|
||
// It returns a map of only the data requested in the current invocation, scaled to a common step. | ||
func (eval *evaluator) Fetch( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Поправишь godoc?
|
||
metrics := make([]string, 0) | ||
metricsMap := make(map[parser.MetricRequest][]*types.MetricData) | ||
func NewFetchCtx(from, until int64) *fetchCtx { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Мб сделать её приватной?
@@ -93,12 +155,24 @@ func (ctx *evalCtx) parse(target string) (parser.Expr, error) { | |||
return parsedExpr, nil | |||
} | |||
|
|||
func (ctx *evalCtx) getMetricsData(database moira.Database, parsedExpr parser.Expr) (*fetchedMetrics, error) { | |||
metricRequests := parsedExpr.Metrics() | |||
type fetchCtx struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Мб эту структуру и её методы в отдельный файл унесём?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Поправь, пожалуйста, godoc
-и в этом файле.
@@ -9,7 +9,21 @@ type Timer struct { | |||
|
|||
// Rounds start and stop time in a specific manner requered by carbonapi. | |||
func RoundTimestamps(startTime, stopTime, retention int64) (roundedStart, roundedStop int64) { | |||
return ceilToMultiplier(startTime, retention), floorToMultiplier(stopTime, retention) + retention | |||
// var until int64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не забудь убрать комменты)
until int64 | ||
type evaluator struct { | ||
database moira.Database | ||
metrics []string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
почему решил добавить метрики внутрь этой структуры, а не возвращать из Fetch? Можно было бы использовать структуру fetchedMetrics
, там как раз оба нужных поля есть
} | ||
|
||
for _, metricData := range metricsData { | ||
md := newMetricDataFromGraphit(metricData, len(result.Metrics) != len(result.Patterns)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newMetricDataFromGraphit
-> newMetricDataFromGraphite
@@ -12,7 +12,8 @@ type MetricData struct { | |||
StopTime int64 | |||
StepTime int64 | |||
Values []float64 | |||
Wildcard bool | |||
// TODO(Tetrergeru) Wtf is a wildcard in this context |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Судя по коду параметр определяет были ли вайлдкард в запросе, проверка на то равно ли количество паттерном количеству метрик
database.EXPECT().GetMetricsValues(metrics, int64(0), retentionUntil-1).Return(metricList, nil) | ||
database.EXPECT().GetMetricsTTLSeconds().Return(metricsTTL) | ||
|
||
result, err := localSource.Fetch("alias(movingMin(apps.*.process.cpu.usage, '20s'), 'min')", from, until, true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не очень много тестов на функции, которые были изменены в ходе релиза. Как будто бы точно стоит покрыть тестами moving* функции с числовым и не числовым параметрами, hitcount, smartSummarize, keepLastValue и тд. Это точно будет не лишним, тк лучше будем понимать и видеть в тестах, какие функции изменились и как это может сказаться на уже существующих триггерах
@@ -15,7 +15,7 @@ require ( | |||
github.com/dustin/go-humanize v1.0.1 | |||
github.com/go-chi/chi v4.1.2+incompatible | |||
github.com/go-chi/render v1.0.1 | |||
github.com/go-graphite/carbonapi v0.16.0 | |||
github.com/go-graphite/carbonapi v0.16.2-0.20240530091606-c2229eabd094 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
а почему на коммит еще?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
я прост может забыла, давай просто где-нибудь напишем, чего мы так решили сделать)
Обновил карбонапи, важные изменения: