mirror of
https://github.com/lukaszraczylo/graphql-monitoring-proxy.git
synced 2026-06-05 23:03:48 +00:00
cedee416a8
* General improvements and bug fixes. * Improve tests coverage. * fixup! Improve tests coverage. * Update README.md with latest changes. * Fix the uint32 * Resolve issue with race condition for logging. * fixup! Merge remote-tracking branch 'origin/main' into improvements-mid-apr-2025 * Fix the test of the rate limiter * Add default ratelimit.json file * Update dependencies. * Significant refactor. * fixup! Significant refactor. * fixup! Merge remote-tracking branch 'origin/main' into improvements-mid-apr-2025 * fixup! fixup! Merge remote-tracking branch 'origin/main' into improvements-mid-apr-2025 * fixup! fixup! fixup! Merge remote-tracking branch 'origin/main' into improvements-mid-apr-2025 * fixup! fixup! fixup! fixup! fixup! Merge remote-tracking branch 'origin/main' into improvements-mid-apr-2025 * fixup! fixup! fixup! fixup! fixup! fixup! Merge remote-tracking branch 'origin/main' into improvements-mid-apr-2025 * fixup! fixup! fixup! fixup! fixup! fixup! fixup! Merge remote-tracking branch 'origin/main' into improvements-mid-apr-2025 * fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! Merge remote-tracking branch 'origin/main' into improvements-mid-apr-2025 * fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! Merge remote-tracking branch 'origin/main' into improvements-mid-apr-2025 * fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! Merge remote-tracking branch 'origin/main' into improvements-mid-apr-2025
45 lines
923 B
Go
45 lines
923 B
Go
package libpack_monitoring
|
|
|
|
import (
|
|
"testing"
|
|
|
|
libpack_config "github.com/lukaszraczylo/graphql-monitoring-proxy/config"
|
|
)
|
|
|
|
func BenchmarkGetMetricsName(b *testing.B) {
|
|
// Setup environment
|
|
libpack_config.PKG_NAME = "test_service"
|
|
|
|
ms := &MetricsSetup{metrics_prefix: "test_prefix"}
|
|
|
|
labels := map[string]string{
|
|
"env": "production",
|
|
"region": "us-west-2",
|
|
}
|
|
|
|
// Run the benchmark
|
|
for n := 0; n < b.N; n++ {
|
|
ms.get_metrics_name("request_count", labels)
|
|
}
|
|
}
|
|
|
|
func BenchmarkCompileMetricsWithLabels(b *testing.B) {
|
|
labels := map[string]string{
|
|
"env": "production",
|
|
"region": "us-west-2",
|
|
"app": "api-server",
|
|
}
|
|
|
|
for n := 0; n < b.N; n++ {
|
|
compile_metrics_with_labels("request_count", labels)
|
|
}
|
|
}
|
|
|
|
func BenchmarkValidateMetricsName(b *testing.B) {
|
|
input := "valid metric name with special chars @#! and underscores__"
|
|
|
|
for n := 0; n < b.N; n++ {
|
|
_ = validate_metrics_name(input)
|
|
}
|
|
}
|