添加基础性能测试分析代码

This commit is contained in:
2025-03-05 18:12:26 +08:00
parent 6e2309df2d
commit 736dbff17d
11 changed files with 106 additions and 141 deletions

6
scripts/env/test/vector/Dockerfile vendored Normal file
View File

@@ -0,0 +1,6 @@
FROM timberio/vector:0.45.0-debian
# Copy the configuration file
COPY vector.toml /etc/vector/vector.toml
CMD ["-c", "/etc/vector/vector.toml"]

56
scripts/env/test/vector/vector.toml vendored Normal file
View File

@@ -0,0 +1,56 @@
timezone = "Asia/Shanghai"
[api]
enabled = true
address = "0.0.0.0:8686"
[sources.docker]
type = "docker_logs"
include_containers = ["proxy-server-dev-service"]
[transforms.parse]
inputs = ["docker"]
type = "remap"
source = '''
. = parse_json!(.message)
.time, err = format_timestamp(parse_timestamp!(.time, "%+"), "%Y-%m-%dT%H:%M:%S", "Asia/Shanghai")
if err != null {
log("Unable to parse JSON: " + err, level: "error")
abort
}
'''
# ===============
# 用户访问记录
# ===============
[transforms.destinations]
inputs = ["parse"]
type = "filter"
condition = ".msg == \"用户访问记录\""
[sinks.file_out]
inputs = ["destinations"]
type = "file"
path = "/temp/vector/service-destinations/%Y-%m-%d.log"
encoding.codec = "csv"
encoding.csv.fields = ["time", "uid", "user", "proxy", "node", "proto", "dest", "domain"]
buffer.type = "disk"
buffer.max_size = 268435488
# ===============
# errors
# ===============
[transforms.errors]
inputs = ["parse"]
type = "filter"
condition = ".level == \"ERROR\""
[sinks.file_errors]
inputs = ["errors"]
type = "file"
path = "/temp/vector/service-errors/%Y-%m-%d.log"
encoding.codec = "json"
buffer.type = "disk"
buffer.max_size = 268435488