Skip to content

Commit

Permalink
Really use v2 as the default
Browse files Browse the repository at this point in the history
  • Loading branch information
codebien committed Oct 17, 2023
1 parent 27a02e9 commit 2339ffb
Showing 1 changed file with 24 additions and 16 deletions.
40 changes: 24 additions & 16 deletions cloudapi/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,26 +181,34 @@ func NewConfig() Config {
// The set value (1000) is selected for performance reasons.
// Any change to this value should be first discussed with internal stakeholders.
MaxTimeSeriesInBatch: null.NewInt(1000, false),

// Aggregation is disabled by default for legacy version (v1), since AggregationPeriod has no default value
// but if it's enabled manually or from the cloud service, those are the default values it will use.
AggregationCalcInterval: types.NewNullDuration(3*time.Second, false),
AggregationWaitPeriod: types.NewNullDuration(5*time.Second, false),
AggregationMinSamples: null.NewInt(25, false),
AggregationOutlierAlgoThreshold: null.NewInt(75, false),
AggregationOutlierIqrRadius: null.NewFloat(0.25, false),
// TODO: the following values were used by the previous default version (v1).
// We decided to keep the same values mostly for having a smoother migration to v2.
// Because the previous version's aggregation config, a few lines below, is overwritten
// by the remote service with the same values that we are now setting here for v2.
// When the migration will be completed we may evaluate to re-discuss them
// as we may evaluate to reduce these values - especially the waiting period.
// A more specific request about waiting period is mentioned in the link below:
// https://github.com/grafana/k6/blob/44e1e63aadb66784ff0a12b8d9821a0fdc9e7467/output/cloud/expv2/collect.go#L72-L77
AggregationPeriod: types.NewNullDuration(3*time.Second, false),
AggregationWaitPeriod: types.NewNullDuration(8*time.Second, false),
}

if c.APIVersion.Int64 == 1 {
// Aggregation is disabled by default for legacy version, since AggregationPeriod has no default value
// but if it's enabled manually or from the cloud service and the cloud doesn't override the config then
// those are the default values it will use.
c.AggregationPeriod = types.NewNullDuration(0, false)
c.AggregationCalcInterval = types.NewNullDuration(3*time.Second, false)
c.AggregationWaitPeriod = types.NewNullDuration(5*time.Second, false)
c.AggregationMinSamples = null.NewInt(25, false)
c.AggregationOutlierAlgoThreshold = null.NewInt(75, false)
c.AggregationOutlierIqrRadius = null.NewFloat(0.25, false)

// Since we're measuring durations, the upper coefficient is slightly
// lower, since outliers from that side are more interesting than ones
// close to zero.
AggregationOutlierIqrCoefLower: null.NewFloat(1.5, false),
AggregationOutlierIqrCoefUpper: null.NewFloat(1.3, false),
}

// v2 enables aggregation by default
if c.APIVersion.Int64 == 2 {
c.AggregationPeriod = types.NewNullDuration(3*time.Second, false)
c.AggregationWaitPeriod = types.NewNullDuration(8*time.Second, false)
c.AggregationOutlierIqrCoefLower = null.NewFloat(1.5, false)
c.AggregationOutlierIqrCoefUpper = null.NewFloat(1.3, false)
}

return c
Expand Down

0 comments on commit 2339ffb

Please sign in to comment.