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
@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
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"github.com/VictoriaMetrics/metrics"
)
@hagen1778
hagen1778 / step-1.go
Last active November 29, 2020 14:35
Simple go web app
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
)
func main() {