mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
This is part of a series of changes to add metric charts in performance benchmarks. This change is meant to do three things: - Remove the interface indirection from the Prometheus library, which is performance-critical due to its use in writing out profiling metrics (although the runsc metric server also benefits from this too). - Use a `StringWriter`-like writer contract, to avoid needless casting between strings and bytes within the Prometheus library. The library only ever needs to deal with strings, so it is up to callers to do the conversion to bytes if they need to (which the runsc metric-server does). - Avoid buffer allocations in the metric server when each snapshot is larger than the buffer size. Instead, buffers are saved and reused. PiperOrigin-RevId: 630500004
35 lines
1016 B
Python
35 lines
1016 B
Python
load("//tools:defs.bzl", "go_library", "go_test")
|
|
|
|
package(
|
|
default_applicable_licenses = ["//:license"],
|
|
licenses = ["notice"],
|
|
)
|
|
|
|
go_library(
|
|
name = "prometheus",
|
|
srcs = [
|
|
"prometheus.go",
|
|
"prometheus_verify.go",
|
|
],
|
|
stateify = False,
|
|
visibility = ["//:sandbox"],
|
|
deps = ["//pkg/metric:metric_go_proto"],
|
|
)
|
|
|
|
go_test(
|
|
name = "prometheus_test",
|
|
size = "small",
|
|
srcs = ["prometheus_test.go"],
|
|
library = ":prometheus",
|
|
deps = [
|
|
"//pkg/metric:metric_go_proto",
|
|
"@com_github_golang_protobuf//proto:go_default_library",
|
|
"@com_github_google_go_cmp//cmp:go_default_library",
|
|
"@com_github_prometheus_common//expfmt",
|
|
"@org_golang_google_protobuf//encoding/prototext:go_default_library",
|
|
"@org_golang_google_protobuf//proto:go_default_library",
|
|
"@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
|
|
"@org_golang_google_protobuf//testing/protocmp:go_default_library",
|
|
],
|
|
)
|