From 9fff48c3e3b8c78795a609a8a81c73a3591cf1a8 Mon Sep 17 00:00:00 2001 From: Oleksandr Redko Date: Mon, 13 Feb 2023 14:27:13 +0200 Subject: [PATCH 01/17] app,lib: fix typos in comments (#3804) --- app/vmalert/notifier/alert.go | 2 +- app/vmalert/notifier/config.go | 2 +- app/vmalert/templates/template.go | 2 +- app/vmauth/auth_config.go | 2 +- app/vmauth/target_url.go | 2 +- app/vminsert/prompush/push.go | 2 +- app/vmselect/graphiteql/parser.go | 2 +- app/vmselect/netstorage/netstorage.go | 4 ++-- app/vmselect/promql/aggr.go | 4 ++-- app/vmselect/promql/eval.go | 2 +- app/vmselect/promql/rollup.go | 6 +++--- lib/awsapi/config.go | 6 +++--- lib/backup/azremote/azblob.go | 2 +- lib/backup/fscommon/fscommon.go | 2 +- lib/backup/s3remote/s3.go | 2 +- lib/fs/fs.go | 2 +- lib/memory/memory_linux.go | 2 +- lib/mergeset/encoding.go | 2 +- lib/mergeset/table.go | 2 +- lib/netutil/proxyprotocol_test.go | 2 +- lib/promrelabel/graphite.go | 2 +- lib/promscrape/discovery/consul/api.go | 6 +++--- lib/promscrape/discovery/dockerswarm/tasks.go | 2 +- lib/promscrape/discovery/http/api.go | 2 +- lib/promscrape/discovery/kubernetes/api_watcher.go | 2 +- lib/promscrape/discovery/kubernetes/node.go | 2 +- lib/promscrape/discovery/nomad/api.go | 4 ++-- lib/promutils/labels.go | 4 ++-- lib/protoparser/common/unmarshal_work.go | 2 +- lib/protoparser/datadog/streamparser.go | 2 +- lib/regexutil/promregex.go | 2 +- lib/storage/block_stream_writer.go | 2 +- lib/storage/dedup.go | 2 +- lib/storage/index_db.go | 4 ++-- lib/storage/partition.go | 4 ++-- lib/storage/raw_row.go | 2 +- lib/storage/search.go | 4 ++-- lib/storage/storage.go | 2 +- lib/storage/table.go | 2 +- lib/storage/time.go | 2 +- lib/streamaggr/streamaggr.go | 2 +- 41 files changed, 54 insertions(+), 54 deletions(-) diff --git a/app/vmalert/notifier/alert.go b/app/vmalert/notifier/alert.go index 35a68c54ce..f26cfcfa32 100644 --- a/app/vmalert/notifier/alert.go +++ b/app/vmalert/notifier/alert.go @@ -41,7 +41,7 @@ type Alert struct { LastSent time.Time // Value stores the value returned from evaluating expression from Expr field Value float64 - // ID is the unique identifer for the Alert + // ID is the unique identifier for the Alert ID uint64 // Restored is true if Alert was restored after restart Restored bool diff --git a/app/vmalert/notifier/config.go b/app/vmalert/notifier/config.go index ac60a49652..d6419b900e 100644 --- a/app/vmalert/notifier/config.go +++ b/app/vmalert/notifier/config.go @@ -29,7 +29,7 @@ type Config struct { // ConsulSDConfigs contains list of settings for service discovery via Consul // see https://prometheus.io/docs/prometheus/latest/configuration/configuration/#consul_sd_config ConsulSDConfigs []consul.SDConfig `yaml:"consul_sd_configs,omitempty"` - // DNSSDConfigs ontains list of settings for service discovery via DNS. + // DNSSDConfigs contains list of settings for service discovery via DNS. // See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#dns_sd_config DNSSDConfigs []dns.SDConfig `yaml:"dns_sd_configs,omitempty"` diff --git a/app/vmalert/templates/template.go b/app/vmalert/templates/template.go index c932b5777b..045a154ffb 100644 --- a/app/vmalert/templates/template.go +++ b/app/vmalert/templates/template.go @@ -225,7 +225,7 @@ func templateFuncs() textTpl.FuncMap { "toLower": strings.ToLower, // crlfEscape replaces '\n' and '\r' chars with `\\n` and `\\r`. - // This funcion is deprectated. + // This function is deprecated. // // It is better to use quotesEscape, jsonEscape, queryEscape or pathEscape instead - // these functions properly escape `\n` and `\r` chars according to their purpose. diff --git a/app/vmauth/auth_config.go b/app/vmauth/auth_config.go index 5031c67a06..0c02a9d1c8 100644 --- a/app/vmauth/auth_config.go +++ b/app/vmauth/auth_config.go @@ -110,7 +110,7 @@ type SrcPath struct { re *regexp.Regexp } -// URLPrefix represents pased `url_prefix` +// URLPrefix represents passed `url_prefix` type URLPrefix struct { n uint32 bus []*backendURL diff --git a/app/vmauth/target_url.go b/app/vmauth/target_url.go index a2849b88ef..b456c554a0 100644 --- a/app/vmauth/target_url.go +++ b/app/vmauth/target_url.go @@ -50,7 +50,7 @@ func normalizeURL(uOrig *url.URL) *url.URL { // Prevent from attacks with using `..` in r.URL.Path u.Path = path.Clean(u.Path) if !strings.HasSuffix(u.Path, "/") && strings.HasSuffix(uOrig.Path, "/") { - // The path.Clean() removes traling slash. + // The path.Clean() removes trailing slash. // Return it back if needed. // This should fix https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1752 u.Path += "/" diff --git a/app/vminsert/prompush/push.go b/app/vminsert/prompush/push.go index a51e77dc09..fdbbb347ba 100644 --- a/app/vminsert/prompush/push.go +++ b/app/vminsert/prompush/push.go @@ -21,7 +21,7 @@ func Push(wr *prompbmarshal.WriteRequest) { tss := wr.Timeseries for len(tss) > 0 { - // Process big tss in smaller blocks in order to reduce maxmimum memory usage + // Process big tss in smaller blocks in order to reduce maximum memory usage samplesCount := 0 i := 0 for i < len(tss) { diff --git a/app/vmselect/graphiteql/parser.go b/app/vmselect/graphiteql/parser.go index f24a2e8bf0..b827c0f0e1 100644 --- a/app/vmselect/graphiteql/parser.go +++ b/app/vmselect/graphiteql/parser.go @@ -164,7 +164,7 @@ func (p *parser) parseString() (*StringExpr, error) { return se, nil } -// StringExpr represents string contant. +// StringExpr represents string constant. type StringExpr struct { // S contains unquoted string contents. S string diff --git a/app/vmselect/netstorage/netstorage.go b/app/vmselect/netstorage/netstorage.go index ed43a12e3c..b96f3d60d9 100644 --- a/app/vmselect/netstorage/netstorage.go +++ b/app/vmselect/netstorage/netstorage.go @@ -193,7 +193,7 @@ func getTmpResult() *result { func putTmpResult(r *result) { currentTime := fasttime.UnixTimestamp() if cap(r.rs.Values) > 1024*1024 && 4*len(r.rs.Values) < cap(r.rs.Values) && currentTime-r.lastResetTime > 10 { - // Reset r.rs in order to preseve memory usage after processing big time series with millions of rows. + // Reset r.rs in order to preserve memory usage after processing big time series with millions of rows. r.rs = Result{} r.lastResetTime = currentTime } @@ -936,7 +936,7 @@ func TagValueSuffixes(qt *querytracer.Tracer, tr storage.TimeRange, tagKey, tagV // TSDBStatus returns tsdb status according to https://prometheus.io/docs/prometheus/latest/querying/api/#tsdb-stats // -// It accepts aribtrary filters on time series in sq. +// It accepts arbitrary filters on time series in sq. func TSDBStatus(qt *querytracer.Tracer, sq *storage.SearchQuery, focusLabel string, topN int, deadline searchutils.Deadline) (*storage.TSDBStatus, error) { qt = qt.NewChild("get tsdb stats: %s, focusLabel=%q, topN=%d", sq, focusLabel, topN) defer qt.Done() diff --git a/app/vmselect/promql/aggr.go b/app/vmselect/promql/aggr.go index 84c459915b..d432e58068 100644 --- a/app/vmselect/promql/aggr.go +++ b/app/vmselect/promql/aggr.go @@ -901,7 +901,7 @@ func quantileSorted(phi float64, values []float64) float64 { func aggrFuncMAD(tss []*timeseries) []*timeseries { // Calculate medians for each point across tss. medians := getPerPointMedians(tss) - // Calculate MAD values multipled by tolerance for each point across tss. + // Calculate MAD values multiplied by tolerance for each point across tss. // See https://en.wikipedia.org/wiki/Median_absolute_deviation mads := getPerPointMADs(tss, medians) tss[0].Values = append(tss[0].Values[:0], mads...) @@ -920,7 +920,7 @@ func aggrFuncOutliersMAD(afa *aggrFuncArg) ([]*timeseries, error) { afe := func(tss []*timeseries, modifier *metricsql.ModifierExpr) []*timeseries { // Calculate medians for each point across tss. medians := getPerPointMedians(tss) - // Calculate MAD values multipled by tolerance for each point across tss. + // Calculate MAD values multiplied by tolerance for each point across tss. // See https://en.wikipedia.org/wiki/Median_absolute_deviation mads := getPerPointMADs(tss, medians) for n := range mads { diff --git a/app/vmselect/promql/eval.go b/app/vmselect/promql/eval.go index ac364adbe5..37bdaed025 100644 --- a/app/vmselect/promql/eval.go +++ b/app/vmselect/promql/eval.go @@ -466,7 +466,7 @@ func execBinaryOpArgs(qt *querytracer.Tracer, ec *EvalConfig, exprFirst, exprSec // 1) execute the exprFirst // 2) get common label filters for series returned at step 1 // 3) push down the found common label filters to exprSecond. This filters out unneeded series - // during exprSecond exection instead of spending compute resources on extracting and processing these series + // during exprSecond execution instead of spending compute resources on extracting and processing these series // before they are dropped later when matching time series according to https://prometheus.io/docs/prometheus/latest/querying/operators/#vector-matching // 4) execute the exprSecond with possible additional filters found at step 3 // diff --git a/app/vmselect/promql/rollup.go b/app/vmselect/promql/rollup.go index 993c247614..2b6dfe6b49 100644 --- a/app/vmselect/promql/rollup.go +++ b/app/vmselect/promql/rollup.go @@ -385,7 +385,7 @@ func getRollupFunc(funcName string) newRollupFunc { } type rollupFuncArg struct { - // The value preceeding values if it fits staleness interval. + // The value preceding values if it fits staleness interval. prevValue float64 // The timestamp for prevValue. @@ -397,7 +397,7 @@ type rollupFuncArg struct { // Timestamps for values. timestamps []int64 - // Real value preceeding values without restrictions on staleness interval. + // Real value preceding values without restrictions on staleness interval. realPrevValue float64 // Real value which goes after values. @@ -587,7 +587,7 @@ func (rc *rollupConfig) doInternal(dstValues []float64, tsm *timeseriesMap, valu if window <= 0 { window = rc.Step if rc.MayAdjustWindow && window < maxPrevInterval { - // Adjust lookbehind window only if it isn't set explicilty, e.g. rate(foo). + // Adjust lookbehind window only if it isn't set explicitly, e.g. rate(foo). // In the case of missing lookbehind window it should be adjusted in order to return non-empty graph // when the window doesn't cover at least two raw samples (this is what most users expect). // diff --git a/lib/awsapi/config.go b/lib/awsapi/config.go index 51290f243a..4dc93327f5 100644 --- a/lib/awsapi/config.go +++ b/lib/awsapi/config.go @@ -239,7 +239,7 @@ func (cfg *Config) getAPICredentials() (*credentials, error) { } // getECSRoleCredentialsByPath makes request to ecs metadata service -// and retrieves instances credentails +// and retrieves instances credentials // https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-iam-roles.html func getECSRoleCredentialsByPath(client *http.Client, path string) (*credentials, error) { resp, err := client.Get(path) @@ -329,7 +329,7 @@ func getMetadataByPath(client *http.Client, apiPath string) ([]byte, error) { return readResponseBody(resp, apiURL) } -// getRoleWebIdentityCredentials obtains credentials fo the given roleARN with webToken. +// getRoleWebIdentityCredentials obtains credentials for the given roleARN with webToken. // https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRoleWithWebIdentity.html // aws IRSA for kubernetes. // https://aws.amazon.com/blogs/opensource/introducing-fine-grained-iam-roles-service-accounts/ @@ -365,7 +365,7 @@ func (cfg *Config) getSTSAPIResponse(action string, reqBuilder func(apiURL strin return readResponseBody(resp, apiURL) } -// getRoleARNCredentials obtains credentials fo the given roleARN. +// getRoleARNCredentials obtains credentials for the given roleARN. func (cfg *Config) getRoleARNCredentials(creds *credentials) (*credentials, error) { data, err := cfg.getSTSAPIResponse("AssumeRole", func(apiURL string) (*http.Request, error) { return newSignedGetRequest(apiURL, "sts", cfg.region, creds) diff --git a/lib/backup/azremote/azblob.go b/lib/backup/azremote/azblob.go index 22f9649d4c..b96df99fbc 100644 --- a/lib/backup/azremote/azblob.go +++ b/lib/backup/azremote/azblob.go @@ -309,7 +309,7 @@ func (fs *FS) CreateFile(filePath string, data []byte) error { return nil } -// HasFile returns ture if filePath exists at fs. +// HasFile returns true if filePath exists at fs. func (fs *FS) HasFile(filePath string) (bool, error) { path := fs.Dir + filePath diff --git a/lib/backup/fscommon/fscommon.go b/lib/backup/fscommon/fscommon.go index 37d688aeb9..bee044290c 100644 --- a/lib/backup/fscommon/fscommon.go +++ b/lib/backup/fscommon/fscommon.go @@ -250,7 +250,7 @@ func removeEmptyDirsInternal(d *os.File) (bool, error) { return false, nil } // Use os.RemoveAll() instead of os.Remove(), since the dir may contain special files such as flock.lock and restore-in-progress, - // which must be ingored. + // which must be ignored. if err := os.RemoveAll(dir); err != nil { return false, fmt.Errorf("cannot remove %q: %w", dir, err) } diff --git a/lib/backup/s3remote/s3.go b/lib/backup/s3remote/s3.go index a5aac8532d..741ea7144b 100644 --- a/lib/backup/s3remote/s3.go +++ b/lib/backup/s3remote/s3.go @@ -33,7 +33,7 @@ type FS struct { // Directory in the bucket to write to. Dir string - // Set for using S3-compatible enpoint such as MinIO etc. + // Set for using S3-compatible endpoint such as MinIO etc. CustomEndpoint string // Force to use path style for s3, true by default. diff --git a/lib/fs/fs.go b/lib/fs/fs.go index 92ae1e67d5..ba61caed4c 100644 --- a/lib/fs/fs.go +++ b/lib/fs/fs.go @@ -40,7 +40,7 @@ func WriteFileAndSync(path string, data []byte) error { } if _, err := f.Write(data); err != nil { f.MustClose() - // Do not call MustRemoveAll(path), so the user could inpsect + // Do not call MustRemoveAll(path), so the user could inspect // the file contents during investigation of the issue. return fmt.Errorf("cannot write %d bytes to %q: %w", len(data), path, err) } diff --git a/lib/memory/memory_linux.go b/lib/memory/memory_linux.go index 05b2c190a5..ed811b03bd 100644 --- a/lib/memory/memory_linux.go +++ b/lib/memory/memory_linux.go @@ -20,7 +20,7 @@ func sysTotalMemory() int { } mem := cgroup.GetMemoryLimit() if mem <= 0 || int64(int(mem)) != mem || int(mem) > totalMem { - // Try reading hierachical memory limit. + // Try reading hierarchical memory limit. // See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/699 mem = cgroup.GetHierarchicalMemoryLimit() if mem <= 0 || int64(int(mem)) != mem || int(mem) > totalMem { diff --git a/lib/mergeset/encoding.go b/lib/mergeset/encoding.go index b93383e817..a4935d4e66 100644 --- a/lib/mergeset/encoding.go +++ b/lib/mergeset/encoding.go @@ -157,7 +157,7 @@ func commonPrefixLen(a, b []byte) int { // Add adds x to the end of ib. // -// false is returned if x isn't added to ib due to block size contraints. +// false is returned if x isn't added to ib due to block size constraints. func (ib *inmemoryBlock) Add(x []byte) bool { data := ib.data if len(x)+len(data) > maxInmemoryBlockSize { diff --git a/lib/mergeset/table.go b/lib/mergeset/table.go index 9ca34650b4..0a25506d38 100644 --- a/lib/mergeset/table.go +++ b/lib/mergeset/table.go @@ -1665,7 +1665,7 @@ func runTransaction(txnLock *sync.RWMutex, pathPrefix, txnPath string) error { srcPath, dstPath) } - // Flush pathPrefix directory metadata to the underying storage. + // Flush pathPrefix directory metadata to the underlying storage. fs.MustSyncPath(pathPrefix) pendingTxnDeletionsWG.Add(1) diff --git a/lib/netutil/proxyprotocol_test.go b/lib/netutil/proxyprotocol_test.go index 0e86b21cd9..0e9e6913c8 100644 --- a/lib/netutil/proxyprotocol_test.go +++ b/lib/netutil/proxyprotocol_test.go @@ -89,7 +89,7 @@ func TestParseProxyProtocolFail(t *testing.T) { // unsupported command f([]byte{0x0D, 0x0A, 0x0D, 0x0A, 0x00, 0x0D, 0x0A, 0x51, 0x55, 0x49, 0x54, 0x0A, 0x22, 0x11, 0x00, 0x0C, 0x7F, 0x00, 0x00, 0x01, 0, 0, 0, 0, 0, 80, 0, 0}) - // mimatch ipv6 and ipv4 + // mismatch ipv6 and ipv4 f([]byte{0x0D, 0x0A, 0x0D, 0x0A, 0x00, 0x0D, 0x0A, 0x51, 0x55, 0x49, 0x54, 0x0A, 0x21, 0x21, 0x00, 0x0C, // ip data srcid,dstip,srcport 0x7F, 0x00, 0x00, 0x01, 0, 0, 0, 0, 0, 80, 0, 0}) diff --git a/lib/promrelabel/graphite.go b/lib/promrelabel/graphite.go index de39634b2e..e962dcdea2 100644 --- a/lib/promrelabel/graphite.go +++ b/lib/promrelabel/graphite.go @@ -76,7 +76,7 @@ func appendGraphiteMatchTemplateParts(dst []string, s string) []string { // Match matches s against gmt. // // On success it adds matched captures to dst and returns it with true. -// Of failre it returns false. +// On failure it returns false. func (gmt *graphiteMatchTemplate) Match(dst []string, s string) ([]string, bool) { dst = append(dst, s) parts := gmt.parts diff --git a/lib/promscrape/discovery/consul/api.go b/lib/promscrape/discovery/consul/api.go index 5f9d7e2246..07c68297c9 100644 --- a/lib/promscrape/discovery/consul/api.go +++ b/lib/promscrape/discovery/consul/api.go @@ -119,7 +119,7 @@ func getToken(token *promauth.Secret) (string, error) { return string(data), nil } t := os.Getenv("CONSUL_HTTP_TOKEN") - // Allow empty token - it shouls work if authorization is disabled in Consul + // Allow empty token - it should work if authorization is disabled in Consul return t, nil } @@ -145,7 +145,7 @@ func maxWaitTime() time.Duration { // Consul adds random delay up to wait/16, so reduce the timeout in order to keep it below BlockingClientReadTimeout. // See https://www.consul.io/api-docs/features/blocking d -= d / 8 - // The timeout cannot exceed 10 minuntes. See https://www.consul.io/api-docs/features/blocking + // The timeout cannot exceed 10 minutes. See https://www.consul.io/api-docs/features/blocking if d > 10*time.Minute { d = 10 * time.Minute } @@ -155,7 +155,7 @@ func maxWaitTime() time.Duration { return d } -// getBlockingAPIResponse perfoms blocking request to Consul via client and returns response. +// getBlockingAPIResponse performs blocking request to Consul via client and returns response. // // See https://www.consul.io/api-docs/features/blocking . func getBlockingAPIResponse(ctx context.Context, client *discoveryutils.Client, path string, index int64) ([]byte, int64, error) { diff --git a/lib/promscrape/discovery/dockerswarm/tasks.go b/lib/promscrape/discovery/dockerswarm/tasks.go index d9d25a9241..82cb009e42 100644 --- a/lib/promscrape/discovery/dockerswarm/tasks.go +++ b/lib/promscrape/discovery/dockerswarm/tasks.go @@ -150,7 +150,7 @@ func addTasksLabels(tasks []task, nodesLabels, servicesLabels []*promutils.Label return ms } -// addLabels adds lables from src to dst if they contain the given `key: value` pair. +// addLabels adds labels from src to dst if they contain the given `key: value` pair. func addLabels(dst *promutils.Labels, src []*promutils.Labels, key, value string) { for _, m := range src { if m.Get(key) != value { diff --git a/lib/promscrape/discovery/http/api.go b/lib/promscrape/discovery/http/api.go index 22d4b4ef30..d8ed5adbf2 100644 --- a/lib/promscrape/discovery/http/api.go +++ b/lib/promscrape/discovery/http/api.go @@ -22,7 +22,7 @@ type apiConfig struct { parseErrors *metrics.Counter } -// httpGroupTarget respresent prometheus GroupTarget +// httpGroupTarget represent prometheus GroupTarget // https://prometheus.io/docs/prometheus/latest/http_sd/ type httpGroupTarget struct { Targets []string `json:"targets"` diff --git a/lib/promscrape/discovery/kubernetes/api_watcher.go b/lib/promscrape/discovery/kubernetes/api_watcher.go index 932264f89e..b50edcefae 100644 --- a/lib/promscrape/discovery/kubernetes/api_watcher.go +++ b/lib/promscrape/discovery/kubernetes/api_watcher.go @@ -408,7 +408,7 @@ func (gw *groupWatcher) doRequest(requestURL string) (*http.Response, error) { requestURL = strings.Replace(requestURL, "/apis/networking.k8s.io/v1/", "/apis/networking.k8s.io/v1beta1/", 1) } if strings.Contains(requestURL, "/apis/discovery.k8s.io/v1/") && atomic.LoadUint32(&gw.useDiscoveryV1Beta1) == 1 { - // Update discovery URL for old Kuberentes API, which supports only v1beta1 path. + // Update discovery URL for old Kubernetes API, which supports only v1beta1 path. requestURL = strings.Replace(requestURL, "/apis/discovery.k8s.io/v1/", "/apis/discovery.k8s.io/v1beta1/", 1) } req, err := http.NewRequest("GET", requestURL, nil) diff --git a/lib/promscrape/discovery/kubernetes/node.go b/lib/promscrape/discovery/kubernetes/node.go index c5d5938cd8..038c39d96c 100644 --- a/lib/promscrape/discovery/kubernetes/node.go +++ b/lib/promscrape/discovery/kubernetes/node.go @@ -82,7 +82,7 @@ type NodeDaemonEndpoints struct { KubeletEndpoint DaemonEndpoint } -// getTargetLabels returs labels for the given n. +// getTargetLabels returns labels for the given n. // // See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#node func (n *Node) getTargetLabels(gw *groupWatcher) []*promutils.Labels { diff --git a/lib/promscrape/discovery/nomad/api.go b/lib/promscrape/discovery/nomad/api.go index 6c5efcc731..577bca36ee 100644 --- a/lib/promscrape/discovery/nomad/api.go +++ b/lib/promscrape/discovery/nomad/api.go @@ -104,7 +104,7 @@ func maxWaitTime() time.Duration { // Nomad adds random delay up to wait/16, so reduce the timeout in order to keep it below BlockingClientReadTimeout. // See https://developer.hashicorp.com/nomad/api-docs#blocking-queries d -= d / 16 - // The timeout cannot exceed 10 minuntes. See https://developer.hashicorp.com/nomad/api-docs#blocking-queries + // The timeout cannot exceed 10 minutes. See https://developer.hashicorp.com/nomad/api-docs#blocking-queries if d > 10*time.Minute { d = 10 * time.Minute @@ -115,7 +115,7 @@ func maxWaitTime() time.Duration { return d } -// getBlockingAPIResponse perfoms blocking request to Nomad via client and returns response. +// getBlockingAPIResponse performs blocking request to Nomad via client and returns response. // See https://developer.hashicorp.com/nomad/api-docs#blocking-queries . func getBlockingAPIResponse(ctx context.Context, client *discoveryutils.Client, path string, index int64) ([]byte, int64, error) { path += "&index=" + strconv.FormatInt(index, 10) diff --git a/lib/promutils/labels.go b/lib/promutils/labels.go index c16ba51003..10a254e402 100644 --- a/lib/promutils/labels.go +++ b/lib/promutils/labels.go @@ -49,7 +49,7 @@ func (x *Labels) UnmarshalYAML(unmarshal func(interface{}) error) error { return nil } -// MarshalJSON returns JSON respresentation for x. +// MarshalJSON returns JSON representation for x. func (x *Labels) MarshalJSON() ([]byte, error) { m := x.ToMap() return json.Marshal(m) @@ -235,7 +235,7 @@ func (x *Labels) RemoveDuplicates() { // RemoveMetaLabels removes all the `__meta_` labels from x. // -// See https://www.robustperception.io/life-of-a-label fo details. +// See https://www.robustperception.io/life-of-a-label for details. func (x *Labels) RemoveMetaLabels() { src := x.Labels dst := x.Labels[:0] diff --git a/lib/protoparser/common/unmarshal_work.go b/lib/protoparser/common/unmarshal_work.go index 773489a412..22bb8c9996 100644 --- a/lib/protoparser/common/unmarshal_work.go +++ b/lib/protoparser/common/unmarshal_work.go @@ -40,7 +40,7 @@ func StartUnmarshalWorkers() { // StopUnmarshalWorkers stops unmarshal workers. // -// No more calles to ScheduleUnmarshalWork are allowed after calling stopUnmarshalWorkers +// No more calls to ScheduleUnmarshalWork are allowed after calling stopUnmarshalWorkers func StopUnmarshalWorkers() { close(unmarshalWorkCh) unmarshalWorkersWG.Wait() diff --git a/lib/protoparser/datadog/streamparser.go b/lib/protoparser/datadog/streamparser.go index bdc1ad4d6d..6337139266 100644 --- a/lib/protoparser/datadog/streamparser.go +++ b/lib/protoparser/datadog/streamparser.go @@ -157,7 +157,7 @@ func putRequest(req *Request) { var requestPool sync.Pool -// sanitizeName performs DataDog-compatible santizing for metric names +// sanitizeName performs DataDog-compatible sanitizing for metric names // // See https://docs.datadoghq.com/metrics/custom_metrics/#naming-custom-metrics func sanitizeName(name string) string { diff --git a/lib/regexutil/promregex.go b/lib/regexutil/promregex.go index cf196b8cd1..eafc422fed 100644 --- a/lib/regexutil/promregex.go +++ b/lib/regexutil/promregex.go @@ -65,7 +65,7 @@ func NewPromRegex(expr string) (*PromRegex, error) { return pr, nil } -// MatchString retruns true if s matches pr. +// MatchString returns true if s matches pr. // // The pr is automatically anchored to the beginning and to the end // of the matching string with '^' and '$'. diff --git a/lib/storage/block_stream_writer.go b/lib/storage/block_stream_writer.go index ff43aa3cd2..ff3cb26ed8 100644 --- a/lib/storage/block_stream_writer.go +++ b/lib/storage/block_stream_writer.go @@ -79,7 +79,7 @@ func (bsw *blockStreamWriter) reset() { bsw.prevTimestampsBlockOffset = 0 } -// InitFromInmemoryPart initialzes bsw from inmemory part. +// InitFromInmemoryPart initializes bsw from inmemory part. func (bsw *blockStreamWriter) InitFromInmemoryPart(mp *inmemoryPart, compressLevel int) { bsw.reset() diff --git a/lib/storage/dedup.go b/lib/storage/dedup.go index ce886702c0..9f8e453698 100644 --- a/lib/storage/dedup.go +++ b/lib/storage/dedup.go @@ -24,7 +24,7 @@ func isDedupEnabled() bool { return globalDedupInterval > 0 } -// DeduplicateSamples removes samples from src* if they are closer to each other than dedupInterval in millseconds. +// DeduplicateSamples removes samples from src* if they are closer to each other than dedupInterval in milliseconds. func DeduplicateSamples(srcTimestamps []int64, srcValues []float64, dedupInterval int64) ([]int64, []float64) { if !needsDedup(srcTimestamps, dedupInterval) { // Fast path - nothing to deduplicate diff --git a/lib/storage/index_db.go b/lib/storage/index_db.go index cdaaece1a3..a035ab4ead 100644 --- a/lib/storage/index_db.go +++ b/lib/storage/index_db.go @@ -650,7 +650,7 @@ func generateTSID(dst *TSID, mn *MetricName) { // This assumption is true because mn.Tags must be sorted with mn.sortTags() before calling generateTSID() function. // This allows grouping data blocks for the same (job, instance) close to each other on disk. // This reduces disk seeks and disk read IO when data blocks are read from disk for the same job and/or instance. - // For example, data blocks for time series matching `process_resident_memory_bytes{job="vmstorage"}` are physically adjancent on disk. + // For example, data blocks for time series matching `process_resident_memory_bytes{job="vmstorage"}` are physically adjacent on disk. if len(mn.Tags) > 0 { dst.JobID = uint32(xxhash.Sum64(mn.Tags[0].Value)) } @@ -2754,7 +2754,7 @@ func (is *indexSearch) getMetricIDsForDateAndFilters(qt *querytracer.Tracer, dat // Intersect metricIDs with the rest of filters. // // Do not run these tag filters in parallel, since this may result in CPU and RAM waste - // when the intial tag filters significantly reduce the number of found metricIDs, + // when the initial tag filters significantly reduce the number of found metricIDs, // so the remaining filters could be performed via much faster metricName matching instead // of slow selecting of matching metricIDs. qtChild = qt.NewChild("intersect the remaining %d filters with the found %d metric ids", len(tfws), metricIDs.Len()) diff --git a/lib/storage/partition.go b/lib/storage/partition.go index 15b9e1a0ea..01c3a7d7dc 100644 --- a/lib/storage/partition.go +++ b/lib/storage/partition.go @@ -57,7 +57,7 @@ const finalPartsToMerge = 3 // Higher number of shards reduces CPU contention and increases the max bandwidth on multi-core systems. var rawRowsShardsPerPartition = (cgroup.AvailableCPUs() + 1) / 2 -// The interval for flushing bufferred rows into parts, so they become visible to search. +// The interval for flushing buffered rows into parts, so they become visible to search. const pendingRowsFlushInterval = time.Second // The interval for guaranteed flush of recently ingested data from memory to on-disk parts, @@ -2144,7 +2144,7 @@ func runTransaction(txnLock *sync.RWMutex, pathPrefix1, pathPrefix2, txnPath str } } - // Flush pathPrefix* directory metadata to the underying storage, + // Flush pathPrefix* directory metadata to the underlying storage, // so the moved files become visible there. fs.MustSyncPath(pathPrefix1) fs.MustSyncPath(pathPrefix2) diff --git a/lib/storage/raw_row.go b/lib/storage/raw_row.go index 206805d628..86aeb0533a 100644 --- a/lib/storage/raw_row.go +++ b/lib/storage/raw_row.go @@ -8,7 +8,7 @@ import ( "github.com/VictoriaMetrics/VictoriaMetrics/lib/logger" ) -// rawRow reperesents raw timeseries row. +// rawRow represents raw timeseries row. type rawRow struct { // TSID is time series id. TSID TSID diff --git a/lib/storage/search.go b/lib/storage/search.go index 29a4b5b90e..1873939f55 100644 --- a/lib/storage/search.go +++ b/lib/storage/search.go @@ -100,7 +100,7 @@ type Search struct { ts tableSearch - // tr contains time range used in the serach. + // tr contains time range used in the search. tr TimeRange // tfss contains tag filters used in the search. @@ -165,7 +165,7 @@ func (s *Search) Init(qt *querytracer.Tracer, storage *Storage, tfss []*TagFilte } // It is ok to call Init on non-nil err. // Init must be called before returning because it will fail - // on Seach.MustClose otherwise. + // on Search.MustClose otherwise. s.ts.Init(storage.tb, tsids, tr) qt.Printf("search for parts with data for %d series", len(tsids)) if err != nil { diff --git a/lib/storage/storage.go b/lib/storage/storage.go index 1a14f470dc..3ebbd4a25b 100644 --- a/lib/storage/storage.go +++ b/lib/storage/storage.go @@ -1972,7 +1972,7 @@ func (s *Storage) updatePerDateData(rows []rawRow, mrs []*MetricRow) error { s.pendingHourEntriesLock.Unlock() } if len(pendingDateMetricIDs) == 0 { - // Fast path - there are no new (date, metricID) entires in rows. + // Fast path - there are no new (date, metricID) entries in rows. return nil } diff --git a/lib/storage/table.go b/lib/storage/table.go index 690d21715f..855cc41001 100644 --- a/lib/storage/table.go +++ b/lib/storage/table.go @@ -425,7 +425,7 @@ func (tb *table) retentionWatcher() { continue } - // There are paritions to drop. Drop them. + // There are partitions to drop. Drop them. // Remove table references from partitions, so they will be eventually // closed and dropped after all the pending searches are done. diff --git a/lib/storage/time.go b/lib/storage/time.go index 9be28b2414..e3d013ad33 100644 --- a/lib/storage/time.go +++ b/lib/storage/time.go @@ -51,7 +51,7 @@ func timestampToPartitionName(timestamp int64) string { return t.Format("2006_01") } -// fromPartitionName initializes tr from the given parition name. +// fromPartitionName initializes tr from the given partition name. func (tr *TimeRange) fromPartitionName(name string) error { t, err := time.Parse("2006_01", name) if err != nil { diff --git a/lib/streamaggr/streamaggr.go b/lib/streamaggr/streamaggr.go index a31dd0e16c..3e6199350b 100644 --- a/lib/streamaggr/streamaggr.go +++ b/lib/streamaggr/streamaggr.go @@ -199,7 +199,7 @@ type aggregator struct { // suffix contains a suffix, which should be added to aggregate metric names // - // It contains the interval, lables in (by, without), plus output name. + // It contains the interval, labels in (by, without), plus output name. // For example, foo_bar metric name is transformed to foo_bar:1m_by_job // for `interval: 1m`, `by: [job]` suffix string From 2e2b1ba87ec7f6c3b80bdc9e73d95d7e771cdd07 Mon Sep 17 00:00:00 2001 From: Artem Navoiev Date: Mon, 13 Feb 2023 14:29:03 +0200 Subject: [PATCH 02/17] change docs for VictoriaMetrics Managed (#3803) * change docs for VictoriaMetrics Managedd Signed-off-by: Artem Navoiev * Update docs/managed-victoriametrics/user-managment.md Co-authored-by: Max Golionko <8kirk8@gmail.com> --------- Signed-off-by: Artem Navoiev Co-authored-by: Max Golionko <8kirk8@gmail.com> --- docs/managed-victoriametrics/README.md | 32 ++++----------- .../how-to-monitor-k8s.md | 9 +++++ docs/managed-victoriametrics/overview.md | 40 +++++++++++++++++++ docs/managed-victoriametrics/quickstart.md | 9 +++++ .../managed-victoriametrics/user-managment.md | 9 +++++ 5 files changed, 74 insertions(+), 25 deletions(-) create mode 100644 docs/managed-victoriametrics/overview.md diff --git a/docs/managed-victoriametrics/README.md b/docs/managed-victoriametrics/README.md index 19ff896d2a..15fb34f1b3 100644 --- a/docs/managed-victoriametrics/README.md +++ b/docs/managed-victoriametrics/README.md @@ -4,37 +4,19 @@ sort: 28 # Managed VictoriaMetrics -VictoriaMetrics is a fast and easy-to-use monitoring solution and time series database. -It integrates well with existing monitoring systems such as Grafana, Prometheus, Graphite, -InfluxDB, OpenTSDB and DataDog - see [these docs](https://docs.victoriametrics.com/#how-to-import-time-series-data) for details. +Product information: -The most common use cases for VictoriaMetrics are: -* Long-term remote storage for Prometheus; -* More efficient drop-in replacement for Prometheus and Graphite -* Replacement for InfluxDB and OpenTSDB, which uses lower amounts of RAM, CPU and disk; -* Cost-efficient alternative for DataDog. +* [Overview of Managed VictoriaMetrics](/managed-victoriametrics/overview.html) +* [User Management](/managed-victoriametrics/user-managment.html) -We are glad to announce the availability of Managed VictoriaMetrics -at AWS Marketplace - [try it right now](https://aws.amazon.com/marketplace/pp/prodview-4tbfq5icmbmyc)! +Guides: -Managed VictoriaMetrics allows users running VictoriaMetrics at AWS without the need to perform typical -DevOps tasks such as proper configuration, monitoring, logs collection, access protection, software updates, -backups, etc. +* [Quick Start](/managed-victoriametrics/quickstart.html) +* [Kubernetes Monitoring with Managed VictoriaMetrics](/managed-victoriametrics/how-to-monitor-k8s.html) +* [Understand Your Setup Size](/guides/understand-your-setup-size.html) -We run Managed VictoriaMetrics instances in our environment at AWS while providing easy-to-use endpoints -for data ingestion and querying. And the VictoriaMetrics team takes care of optimal configuration and software -maintenance. - -Managed VictoriaMetrics comes with the following features: - -* It can be used as a Managed Prometheus - just configure Prometheus or vmagent to write data to Managed VictoriaMetrics and then use the provided endpoint as a Prometheus datasource in Grafana; -* Every Managed VictoriaMetrics instance runs in an isolated environment, so instances cannot interfere with each other; -* Managed VictoriaMetrics instance can be scaled up or scaled down in a few clicks; -* Automated backups; -* Pay only for the actually used compute resources - instance type, disk and network. See more about Managed VictoriaMetrics in the following articles: * [Managed VictoriaMetrics announcement](https://victoriametrics.com/blog/managed-victoriametrics-announcement) * [Pricing comparison for Managed Prometheus](https://victoriametrics.com/blog/managed-prometheus-pricing/) * [Monitoring Proxmox VE via Managed VictoriaMetrics and vmagent](https://victoriametrics.com/blog/proxmox-monitoring-with-dbaas/) - diff --git a/docs/managed-victoriametrics/how-to-monitor-k8s.md b/docs/managed-victoriametrics/how-to-monitor-k8s.md index a92ef7532e..11fa37a4dd 100644 --- a/docs/managed-victoriametrics/how-to-monitor-k8s.md +++ b/docs/managed-victoriametrics/how-to-monitor-k8s.md @@ -1,3 +1,12 @@ +--- +sort: 3 +weight: 3 +title: Kubernetes Monitoring with Managed VictoriaMetrics +menu: + docs: + parent: "managed" + weight: 3 +--- # Kubernetes Monitoring with Managed VictoriaMetrics Monitoring kubernetes cluster is necessary to build SLO/SLI, to analyze performance and cost-efficiency of your workloads. diff --git a/docs/managed-victoriametrics/overview.md b/docs/managed-victoriametrics/overview.md new file mode 100644 index 0000000000..101324896a --- /dev/null +++ b/docs/managed-victoriametrics/overview.md @@ -0,0 +1,40 @@ +--- +sort: 1 +weight: 1 +title: Overview of Managed VictoriaMetrics +menu: + docs: + parent: "managed" + weight: 1 +--- + +# Overview of Managed VictoriaMetrics + +VictoriaMetrics is a fast and easy-to-use monitoring solution and time series database. +It integrates well with existing monitoring systems such as Grafana, Prometheus, Graphite, +InfluxDB, OpenTSDB and DataDog - see [these docs](https://docs.victoriametrics.com/#how-to-import-time-series-data) for details. + +The most common use cases for VictoriaMetrics are: +* Long-term remote storage for Prometheus; +* More efficient drop-in replacement for Prometheus and Graphite +* Replacement for InfluxDB and OpenTSDB, which uses lower amounts of RAM, CPU and disk; +* Cost-efficient alternative for DataDog. + +We are glad to announce the availability of Managed VictoriaMetrics +at AWS Marketplace - [try it right now](https://aws.amazon.com/marketplace/pp/prodview-4tbfq5icmbmyc)! + +Managed VictoriaMetrics allows users running VictoriaMetrics at AWS without the need to perform typical +DevOps tasks such as proper configuration, monitoring, logs collection, access protection, software updates, +backups, etc. + +We run Managed VictoriaMetrics instances in our environment at AWS while providing easy-to-use endpoints +for data ingestion and querying. And the VictoriaMetrics team takes care of optimal configuration and software +maintenance. + +Managed VictoriaMetrics comes with the following features: + +* It can be used as a Managed Prometheus - just configure Prometheus or vmagent to write data to Managed VictoriaMetrics and then use the provided endpoint as a Prometheus datasource in Grafana; +* Every Managed VictoriaMetrics instance runs in an isolated environment, so instances cannot interfere with each other; +* Managed VictoriaMetrics instance can be scaled up or scaled down in a few clicks; +* Automated backups; +* Pay only for the actually used compute resources - instance type, disk and network. diff --git a/docs/managed-victoriametrics/quickstart.md b/docs/managed-victoriametrics/quickstart.md index 67d0989922..3d51ae8533 100644 --- a/docs/managed-victoriametrics/quickstart.md +++ b/docs/managed-victoriametrics/quickstart.md @@ -1,3 +1,12 @@ +--- +sort: 2 +weight: 2 +title: Quick Start +menu: + docs: + parent: "managed" + weight: 2 +--- # Quick Start Managed VictoriaMetrics - is a database-as-a-service platform, where users can run the VictoriaMetrics diff --git a/docs/managed-victoriametrics/user-managment.md b/docs/managed-victoriametrics/user-managment.md index 94d51d7e44..94e3dabc17 100644 --- a/docs/managed-victoriametrics/user-managment.md +++ b/docs/managed-victoriametrics/user-managment.md @@ -1,3 +1,12 @@ +--- +sort: 4 +weight: 4 +title: User Management in Managed VictoriaMetrics +menu: + docs: + parent: "managed" + weight: 4 +--- # User Management in Managed VictoriaMetrics The user management system enables admins to control user access and onboard and offboard users to the Managed VictoriaMetrics. It organizes users according to their needs and role. From 8ea02eaa8e1243d7cd38d43af984cdbccc287ddc Mon Sep 17 00:00:00 2001 From: Droxenator <125274321+Droxenator@users.noreply.github.com> Date: Mon, 13 Feb 2023 18:07:53 +0300 Subject: [PATCH 03/17] fixed opentsdbListenAddr timestamp conversion (#3810) Co-authored-by: Andrei Ivanov --- lib/protoparser/opentsdb/streamparser.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/protoparser/opentsdb/streamparser.go b/lib/protoparser/opentsdb/streamparser.go index b71babdea3..e094d4d8b6 100644 --- a/lib/protoparser/opentsdb/streamparser.go +++ b/lib/protoparser/opentsdb/streamparser.go @@ -174,9 +174,13 @@ func (uw *unmarshalWork) Unmarshal() { } } - // Convert timestamps from seconds to milliseconds + // Convert timestamps in seconds to milliseconds if needed. + // See http://opentsdb.net/docs/javadoc/net/opentsdb/core/Const.html#SECOND_MASK for i := range rows { - rows[i].Timestamp *= 1e3 + r := &rows[i] + if r.Timestamp&secondMask == 0 { + r.Timestamp *= 1e3 + } } // Trim timestamps if required. @@ -191,6 +195,8 @@ func (uw *unmarshalWork) Unmarshal() { putUnmarshalWork(uw) } +const secondMask int64 = 0x7FFFFFFF00000000 + func getUnmarshalWork() *unmarshalWork { v := unmarshalWorkPool.Get() if v == nil { From 934646ccf7ebad5995adbe394d67a89c0a6ffc3f Mon Sep 17 00:00:00 2001 From: Roman Khavronenko Date: Mon, 13 Feb 2023 16:23:50 +0100 Subject: [PATCH 04/17] follow-up after d1cbc35cf6010204c7267a3d3a5c9d0412a29e90 (#3813) Signed-off-by: hagen1778 --- docs/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index c9eed3b854..e5db78e21b 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -25,6 +25,7 @@ The following tip changes can be tested by building VictoriaMetrics components f * FEATURE: [vmui](https://docs.victoriametrics.com/#vmui): show `median` instead of `avg` in graph tooltip and line legend, since `median` is more tolerant against spikes. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3706). * BUGFIX: prevent from possible data ingestion slowdown and query performance slowdown during [background merges of big parts](https://docs.victoriametrics.com/#storage) on systems with small number of CPU cores (1 or 2 CPU cores). The issue has been introduced in [v1.85.0](https://docs.victoriametrics.com/CHANGELOG.html#v1850) when implementing [this feature](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3337). See also [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3790). +* BUGFIX: fix `opentsdb` endpoint to support both seconds and milliseconds timestamps. Thanks to @Droxenator for the [pull request](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/3810). ## [v1.87.1](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.87.1) From a645a95bd6a42701d937b19a011619b640469538 Mon Sep 17 00:00:00 2001 From: Roman Khavronenko Date: Mon, 13 Feb 2023 17:29:30 +0100 Subject: [PATCH 05/17] docs: improve troubleshooting docs for vmalert (#3812) Signed-off-by: hagen1778 --- app/vmalert/README.md | 45 ++++++++++++++++++++++++++++--------------- docs/keyConcepts.md | 24 +++++++++++++++++++++++ docs/vmalert.md | 45 ++++++++++++++++++++++++++++--------------- 3 files changed, 82 insertions(+), 32 deletions(-) diff --git a/app/vmalert/README.md b/app/vmalert/README.md index b2db420f95..3aee5da5bc 100644 --- a/app/vmalert/README.md +++ b/app/vmalert/README.md @@ -725,31 +725,42 @@ a review to the dashboard. ## Troubleshooting -vmalert executes configured rules within certain intervals. It is expected that at the moment when rule is executed, -the data is already present in configured `-datasource.url`: +### Data delay + +Data delay is one of the most common issues with rules execution. +vmalert executes configured rules within certain intervals at specifics timestamps. +It expects that the data is already present in configured `-datasource.url` at the moment of time when rule is executed: vmalert expected evaluation Usually, troubles start to appear when data in `-datasource.url` is delayed or absent. In such cases, evaluations -may get empty response from datasource and produce empty recording rules or reset alerts state: +may get empty response from the datasource and produce empty recording rules or reset alerts state: vmalert evaluation when data is delayed -By default, recently written samples to VictoriaMetrics aren't visible for queries for up to 30s. -This behavior is controlled by `-search.latencyOffset` command-line flag and the `latency_offset` query ag at `vmselect`. -Usually, this results into a 30s shift for recording rules results. -Note that too small value passed to `-search.latencyOffset` or to `latency_offest` query arg may lead to incomplete query results. +Try the following recommendations to reduce the chance of hitting the data delay issue: -Try the following recommendations in such cases: - -* Always configure group's `evaluationInterval` to be bigger or equal to `scrape_interval` at which metrics -are delivered to the datasource; +* Always configure group's `evaluationInterval` to be bigger or at least equal to +[time series resolution](https://docs.victoriametrics.com/keyConcepts.html#time-series-resolution); +* Ensure that `[duration]` value is at least twice bigger than +[time series resolution](https://docs.victoriametrics.com/keyConcepts.html#time-series-resolution). For example, +if expression is `rate(my_metric[2m]) > 0` then ensure that `my_metric` resolution is at least `1m` or better `30s`. +If you use VictoriaMetrics as datasource, `[duration]` can be omitted and VictoriaMetrics will adjust it automatically. * If you know in advance, that data in datasource is delayed - try changing vmalert's `-datasource.lookback` -command-line flag to add a time shift for evaluations; -* If time intervals between datapoints in datasource are irregular or `>=5min` - try changing vmalert's -`-datasource.queryStep` command-line flag to specify how far search query can lookback for the recent datapoint. -The recommendation is to have the step at least two times bigger than `scrape_interval`, since -there are no guarantees that scrape will not fail. +command-line flag to add a time shift for evaluations. Or extend `[duration]` to tolerate the delay. +For example, `max_over_time(errors_total[10m]) > 0` will be active even if there is no data in datasource for last `9m`. +* If [time series resolution](https://docs.victoriametrics.com/keyConcepts.html#time-series-resolution) +in datasource is inconsistent or `>=5min` - try changing vmalert's `-datasource.queryStep` command-line flag to specify +how far search query can lookback for the recent datapoint. The recommendation is to have the step +at least two times bigger than the resolution. + +> Please note, data delay is inevitable in distributed systems. And it is better to account for it instead of ignoring. + +By default, recently written samples to VictoriaMetrics aren't visible for queries for up to 30s +(see `-search.latencyOffset` command-line flag at vmselect). Such delay is needed to eliminate risk of incomplete +data on the moment of querying, since metrics collectors won't be able to deliver the data in time. + +### Alerts state Sometimes, it is not clear why some specific alert fired or didn't fire. It is very important to remember, that alerts with `for: 0` fire immediately when their expression becomes true. And alerts with `for > 0` will fire only @@ -772,6 +783,8 @@ HTTP request sent by vmalert to the `-datasource.url` during evaluation. If spec no samples returned and curl command returns data - then it is very likely there was no data in datasource on the moment when rule was evaluated. +### Debug mode + vmalert allows configuring more detailed logging for specific alerting rule. Just set `debug: true` in rule's configuration and vmalert will start printing additional log messages: ```terminal diff --git a/docs/keyConcepts.md b/docs/keyConcepts.md index 3673ef6798..d4d13aabc0 100644 --- a/docs/keyConcepts.md +++ b/docs/keyConcepts.md @@ -79,6 +79,30 @@ requests_total{path="/", code="200"} 123 4567890 - The `4567890` is an optional timestamp for the sample. If it is missing, then the current timestamp is used when storing the sample in VictoriaMetrics. +#### Time series resolution + +Resolution is the minimum interval between [raw samples](https://docs.victoriametrics.com/keyConcepts.html#raw-samples) +of the [time series](https://docs.victoriametrics.com/keyConcepts.html#time-series). Consider the following example: +``` +---------------------------------------------------------------------- +|