Skip to content

Instantly share code, notes, and snippets.

View polarnik's full-sized avatar

Smirnov Vyacheslav polarnik

View GitHub Profile
@polarnik
polarnik / nginx.conf
Created May 3, 2024 07:11
NGinx for InfluxDB 2 and VictoriaMetrics
#user nobody
worker_processes 4;
error_log /var/log/nginx/error.log warn;
events {
worker_connections 1024;
}
http {
@Testcontainers
@Isolated
@Execution(SAME_THREAD)
@Slf4j
@Getter
@Setter
@TestMethodOrder(MethodOrderer.MethodName.class)
@IndicativeSentencesGeneration(separator = " ➡️ ", generator = CostomNameGenerator.class)
public abstract class AbstractTest {
//...
200,browser=chrome,category=sitespeed_board_test,connectivity=cable,db=sitespeed,group=miro_com,origin=pagexray,page=board_small_board,responseCodes=response,summaryType=pageSummary,testName=board_small_board,testtype=firstopen value=344 1693935733386000000
200,browser=chrome,category=sitespeed_board_test,connectivity=cable,db=sitespeed,group=miro_com,origin=pagexray,responseCodes=response,summaryType=summary,testName=board_small_board,testtype=firstopen max=344 1693935733386000000
200,browser=chrome,category=sitespeed_board_test,connectivity=cable,db=sitespeed,group=miro_com,origin=pagexray,responseCodes=response,summaryType=summary,testName=board_small_board,testtype=firstopen mean=344 1693935733386000000
200,browser=chrome,category=sitespeed_board_test,connectivity=cable,db=sitespeed,group=miro_com,origin=pagexray,responseCodes=response,summaryType=summary,testName=board_small_board,testtype=firstopen median=344 1693935733386000000
200,browser=chrome,category=sitespeed_board_test,connectivity=cable,db=site
@polarnik
polarnik / do_handleResponse.js
Created September 18, 2023 08:20
k6.io custom metrics example
import {requestCounter,
requestBodySizeTotal, requestBodySizeTrend,
requestContentLengthTotal, requestContentLengthTrend,
responseCounter,
responseSuccessCounter, responseSuccessRate,
responseSuccessStatusTrend, responseSuccessErrorCodeTrend, responseSuccessDurationTrend,
responseSuccessBodySizeTotal, responseSuccessBodySizeTrend,
responseSuccessContentLengthTotal, responseSuccessContentLengthTrend,
apdexTotal, apdexSatisfied, apdexTolerating, apdexFlustrated,
apdexDuration,
@polarnik
polarnik / browsertime.chrome.Selenium.json
Created August 30, 2023 17:32
sitespeedio/sitespeed.io:29.3.0-plus1 default settings
{
"map_": {},
"options_": {
"prefs": {
"profile.password_manager_enable": false,
"profile.default_content_setting_values.notifications": 2,
"credentials_enable_service": false
},
"args": [
"--no-sandbox",
@polarnik
polarnik / migrate.influxdb2.to.vm.sh
Last active July 10, 2023 17:07
Migrate InfluxDB metrics from InfluxDB2 to VictoriaMetrics
influxd inspect export-lp --bucket-id 5d69c811b871b876 --engine-path /var/lib/influxdb2/engine --output-path /var/lib/influxdb2/ClientMetricsExport.txt
cd /var/lib/influxdb2/
split -d -l 1000 -a 10 ./ClientMetricsExport.txt 1k_lines
files=(1k_lines*)
for ((i=${#files[@]}-1; i>=0; i--)); do
echo "${files[$i]}"
@polarnik
polarnik / nginx.conf
Last active November 15, 2023 17:54
Nginx config for connecting Grafana with InfluxDB (COSR settings problem) with cache (perf improvment)
#user nobody
worker_processes 4;
error_log /var/log/nginx/error.log warn;
events {
worker_connections 1024;
}
http {
@polarnik
polarnik / _src_DebugTest.java
Last active March 11, 2023 12:07
Gatling 3.7 Java-DSL Engine
import io.gatling.app.Gatling;
import org.testng.annotations.Test;
import scala.collection.mutable.HashMap;
@Test(singleThreaded = true)
public class DebugTest {
final private HashMap<String, String> config = new HashMap<>();
{
config.put("gatling.core.directory.resources", IDEPathHelper.resourcesDirectory.toString());
version: '3.0'
services:
mitmproxy:
image: mitmproxy/mitmproxy:9.0.1
hostname: mitmproxy
container_name: mitmproxy_run
restart: "no"
volumes:
- "./build/mitmproxy:/tmp/results"
@polarnik
polarnik / Summary.java
Created December 14, 2022 14:45
Summary for k6
public class Summary {
public HashMap<String, HashMap<String, Object>> metrics;
public Summary readSummary(String path) throws IOException {
Gson gson = new GsonBuilder().setExclusionStrategies(new MyExclusionStrategy()).create();
try(FileReader f = new FileReader(path)) {
Summary summary = gson.fromJson(f, Summary.class);
return summary;
} catch (IOException e) {throw e;}
}