Added MetricLookback setting (#9045)

* Added MetricLookback setting

* Fixed go mod issue
This commit is contained in:
Pontus Rydin 2021-04-13 17:07:54 -04:00 committed by GitHub
parent 66e12e062d
commit 5f26582582
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 3 deletions

View File

@ -181,6 +181,12 @@ vm_metric_exclude = [ "*" ]
## preserve the full precision when averaging takes place.
# use_int_samples = true
## The number of vSphere 5 minute metric collection cycles to look back for non-realtime metrics. In
## some versions (6.7, 7.0 and possible more), certain metrics, such as cluster metrics, may be reported
## with a significant delay (>30min). If this happens, try increasing this number. Please note that increasing
## it too much may cause performance issues.
# metric_lookback = 3
## Custom attributes from vCenter can be very useful for queries in order to slice the
## metrics along different dimension and for forming ad-hoc relationships. They are disabled
## by default, since they can add a considerable amount of tags to the resulting metrics. To

View File

@ -29,8 +29,6 @@ var isIPv4 = regexp.MustCompile("^(?:[0-9]{1,3}\\.){3}[0-9]{1,3}$")
var isIPv6 = regexp.MustCompile("^(?:[A-Fa-f0-9]{0,4}:){1,7}[A-Fa-f0-9]{1,4}$")
const metricLookback = 3 // Number of time periods to look back at for non-realtime metrics
const maxSampleConst = 10 // Absolute maximum number of samples regardless of period
const maxMetadataSamples = 100 // Number of resources to sample for metric metadata
@ -901,7 +899,7 @@ func (e *Endpoint) chunkify(ctx context.Context, res *resourceKind, now time.Tim
}
start, ok := e.hwMarks.Get(object.ref.Value, metricName)
if !ok {
start = latest.Add(time.Duration(-res.sampling) * time.Second * (metricLookback - 1))
start = latest.Add(time.Duration(-res.sampling) * time.Second * (time.Duration(e.Parent.MetricLookback) - 1))
}
start = start.Truncate(20 * time.Second) // Truncate to maximum resolution

View File

@ -48,6 +48,7 @@ type VSphere struct {
CustomAttributeExclude []string
UseIntSamples bool
IPAddresses []string
MetricLookback int
MaxQueryObjects int
MaxQueryMetrics int
@ -237,6 +238,12 @@ var sampleConfig = `
# custom_attribute_include = []
# custom_attribute_exclude = ["*"]
## The number of vSphere 5 minute metric collection cycles to look back for non-realtime metrics. In
## some versions (6.7, 7.0 and possible more), certain metrics, such as cluster metrics, may be reported
## with a significant delay (>30min). If this happens, try increasing this number. Please note that increasing
## it too much may cause performance issues.
# metric_lookback = 3
## Optional SSL Config
# ssl_ca = "/path/to/cafile"
# ssl_cert = "/path/to/certfile"
@ -363,6 +370,7 @@ func init() {
MaxQueryMetrics: 256,
CollectConcurrency: 1,
DiscoverConcurrency: 1,
MetricLookback: 3,
ForceDiscoverOnInit: true,
ObjectDiscoveryInterval: config.Duration(time.Second * 300),
Timeout: config.Duration(time.Second * 60),