Skip to content

Instantly share code, notes, and snippets.

View hagen1778's full-sized avatar
💭
I may be slow to respond.

Roman Khavronenko hagen1778

💭
I may be slow to respond.
View GitHub Profile
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index 22284b655..34aa04f85 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -32,7 +32,7 @@ See also [LTS releases](https://docs.victoriametrics.com/lts-releases/).
**Update note 1: the `--vm-disable-progress-bar` command-line flag at `vmctl` was deprecated. Use `--disable-progress-bar` instead.**
-* FEATURE: all VictoriaMetrics components: use constant-time comparison for comparing HTTP basic auth credentials and auth keys. This should prevent timing attacks when comparing these credentials. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/6392) for details.
+* FEATURE: all VictoriaMetrics components: use constant-time comparison for comparing HTTP basic auth credentials and auth keys. This should prevent timing attacks when comparing these credentials. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/6392) for details. Thanks to @wasim-nihal for [the pull request](https://github.com/VictoriaMe
@hagen1778
hagen1778 / gist:65603b78d802e1a4f7dbb3b8ae4f9524
Created June 12, 2024 14:09
prometheus log scrape timestamps
index c285f05e3..affb717e5 100644
--- a/scrape/scrape.go
+++ b/scrape/scrape.go
@@ -1241,7 +1241,7 @@ mainLoop:
}
last = sl.scrapeAndReport(last, scrapeTime, errc)
-
+ fmt.Println("scrape timestamp", scrapeTime.UnixMilli(), "actual timestamp:", time.Now())
@hagen1778
hagen1778 / gist:9487f71d9a19e04d521d764b576a0ec2
Last active December 20, 2023 08:57
vmctl trace requests
diff --git a/app/vmctl/main.go b/app/vmctl/main.go
index 95743081f..151e9115b 100644
--- a/app/vmctl/main.go
+++ b/app/vmctl/main.go
@@ -230,7 +230,7 @@ func main() {
if err != nil {
return fmt.Errorf("error initilize auth config for destination: %s", dstAddr)
}
- dstHTTPClient := &http.Client{Transport: &http.Transport{DisableKeepAlives: disableKeepAlive}}
+ dstHTTPClient := &http.Client{Transport: &http.Transport{DisableKeepAlives: disableKeepAlive, ResponseHeaderTimeout: time.Second * 60}}
--- a/app/vmctl/vm_native.go
+++ b/app/vmctl/vm_native.go
@@ -5,8 +5,11 @@ import (
"fmt"
"io"
"log"
+ "net/http/httptrace"
+ "sort"
"strings"
"sync"
@hagen1778
hagen1778 / gist:b073e80374d5b422a9d7687c5274e5ee
Created October 23, 2023 07:33
RW config to send data to multiple destinations
remote_write:
- url: http://<victoriametrics-prod>:8428/api/v1/write
write_relabel_configs:
- source_labels: [env]
regex: "dev"
action: drop
- url: http://<victoriametrics-dev>:8428/api/v1/write
write_relabel_configs:
- source_labels: [env]
regex: "prod"
@hagen1778
hagen1778 / slo_rules.yml
Created January 30, 2023 14:12
Code generated by Sloth for vmalert's replay blogpost
---
# Code generated by Sloth (v0.11.0): https://github.com/slok/sloth.
# DO NOT EDIT.
groups:
- name: sloth-slo-sli-recordings-sandbox-vmcluster-requests-availability
rules:
- record: slo:sli_error:ratio_rate5m
expr: |
# vmtag is a docker image tag for VictoriaMetrics components,
# which run inside the prometheus-benchmark - e.g. vmagent, vmalert, vmsingle.
vmtag: "v1.80.0"
# nodeSelector is the list of key-value pairs for selecting instances
# where benchmark pods should be deployed.
nodeSelector: {}
# targetsCount defines the number of nodeexporter instances to scrape.
# This option allows to configure the number of active time series to push
# vmtag is a docker image tag for VictoriaMetrics components,
# which run inside the prometheus-benchmark - e.g. vmagent, vmalert, vmsingle.
vmtag: "v1.80.0"
nodeSelector:
app: rw-benchmark
# targetsCount defines the number of nodeexporter instances to scrape.
# This option allows to configure the number of active time series to push
# to remoteStorages.
vmselect:
serviceMonitor:
enabled: true
persistentVolume:
enabled: true
size: 15Gi
storageClass: standard-rwo
extraLabels:
cluster: victoria-metrics
extraArgs:
serviceMonitor:
enabled: true
# disabled, external ruler is used
ruler:
enabled: false
# disabled, external alertmanager is used
alertmanager:
enabled: false