Skip to content

Commit

Permalink
pkg/metrics: use native histograms behind an environment flag.
Browse files Browse the repository at this point in the history
Optionally enable prometheus native histograms. This feature is still
marked as experimental in prometheus, so flag using an environment
variable, and use additional environment variables to tune precision and
max bucket count. Prometheus native histograms currently only support
exponentially spaced buckets, so we also limit their use to metrics with
an exponential distribution. Note that native histograms currently use
the protobuf exposition format, so we add content negotiation to the
prometheus exporter.

Release note: None
  • Loading branch information
jmcarp committed Aug 11, 2023
1 parent 3a68f5b commit 8ad2230
Show file tree
Hide file tree
Showing 27 changed files with 217 additions and 104 deletions.
74 changes: 47 additions & 27 deletions DEPS.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,16 @@ def go_deps():
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/akavel/rsrc/com_github_akavel_rsrc-v0.8.0.zip",
],
)
go_repository(
name = "com_github_alecthomas_kingpin_v2",
build_file_proto_mode = "disable_global",
importpath = "github.com/alecthomas/kingpin/v2",
sha256 = "2a322681d79461dd793c1e8a98adf062f6ef554abcd3ab06981eef94d79c136b",
strip_prefix = "github.com/alecthomas/kingpin/v2@v2.3.1",
urls = [
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/alecthomas/kingpin/v2/com_github_alecthomas_kingpin_v2-v2.3.1.zip",
],
)
go_repository(
name = "com_github_alecthomas_template",
build_file_proto_mode = "disable_global",
Expand All @@ -148,10 +158,10 @@ def go_deps():
name = "com_github_alecthomas_units",
build_file_proto_mode = "disable_global",
importpath = "github.com/alecthomas/units",
sha256 = "461b05eb19b6023664d6502cb4fbf093a99a9ee2a36c43b4da5ca1287c495ff7",
strip_prefix = "github.com/alecthomas/units@v0.0.0-20210208195552-ff826a37aa15",
sha256 = "b62437d74a523089af46ba0115ece1ce11bca5e321fe1e1d4c976ecca6ee78aa",
strip_prefix = "github.com/alecthomas/units@v0.0.0-20211218093645-b94a6e3cc137",
urls = [
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/alecthomas/units/com_github_alecthomas_units-v0.0.0-20210208195552-ff826a37aa15.zip",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/alecthomas/units/com_github_alecthomas_units-v0.0.0-20211218093645-b94a6e3cc137.zip",
],
)
go_repository(
Expand Down Expand Up @@ -3076,10 +3086,10 @@ def go_deps():
name = "com_github_go_kit_log",
build_file_proto_mode = "disable_global",
importpath = "github.com/go-kit/log",
sha256 = "e0676df7357654a000008dfad3b6b211cba3595f32d3e220edd63a4c9d0d9254",
strip_prefix = "github.com/go-kit/log@v0.1.0",
sha256 = "52634b502b9d0aa945833d93582cffc1bdd9bfa39810e7c70d0688e330b75198",
strip_prefix = "github.com/go-kit/log@v0.2.1",
urls = [
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/go-kit/log/com_github_go_kit_log-v0.1.0.zip",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/go-kit/log/com_github_go_kit_log-v0.2.1.zip",
],
)
go_repository(
Expand Down Expand Up @@ -3744,10 +3754,10 @@ def go_deps():
patches = [
"@com_github_cockroachdb_cockroach//build/patches:com_github_golang_protobuf.patch",
],
sha256 = "5d1c817bebc1202ab3b42a418e584e0008e8027baf212ce69c2ae3e9e7b8c64b",
strip_prefix = "github.com/golang/protobuf@v1.5.2",
sha256 = "93bda6e88d4a0a493a98b481de67a10000a755d15f16a800b49a6b96d1bd6f81",
strip_prefix = "github.com/golang/protobuf@v1.5.3",
urls = [
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/golang/protobuf/com_github_golang_protobuf-v1.5.2.zip",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/golang/protobuf/com_github_golang_protobuf-v1.5.3.zip",
],
)
go_repository(
Expand Down Expand Up @@ -7433,10 +7443,10 @@ def go_deps():
name = "com_github_prometheus_client_golang",
build_file_proto_mode = "disable_global",
importpath = "github.com/prometheus/client_golang",
sha256 = "d9bbfcdcb5f63812b6766884a0f5ad5b1f9a675375d28e307573f49e2ef96b7b",
strip_prefix = "github.com/prometheus/client_golang@v1.12.1",
sha256 = "0167cee686b836da39815e4a7ea64ecc245f6a3fb9b3c3f729941ed55da7dd4f",
strip_prefix = "github.com/prometheus/client_golang@v1.16.0",
urls = [
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/prometheus/client_golang/com_github_prometheus_client_golang-v1.12.1.zip",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/prometheus/client_golang/com_github_prometheus_client_golang-v1.16.0.zip",
],
)
go_repository(
Expand All @@ -7446,20 +7456,20 @@ def go_deps():
],
build_file_proto_mode = "default",
importpath = "github.com/prometheus/client_model",
sha256 = "44fc58fe25ed9b122b6755e8d356d5f199592f959af3b87a3b636c6eb82b43c5",
strip_prefix = "github.com/prometheus/client_model@v0.2.1-0.20210607210712-147c58e9608a",
sha256 = "2a1d147754959287fc34a7bb7c333b3d6fe0ca0d7db1606c49e8f48fd0311547",
strip_prefix = "github.com/prometheus/client_model@v0.3.0",
urls = [
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/prometheus/client_model/com_github_prometheus_client_model-v0.2.1-0.20210607210712-147c58e9608a.zip",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/prometheus/client_model/com_github_prometheus_client_model-v0.3.0.zip",
],
)
go_repository(
name = "com_github_prometheus_common",
build_file_proto_mode = "disable_global",
importpath = "github.com/prometheus/common",
sha256 = "9630b9bbfcf1746a01c8aff0262271c60cf891fa1cd48a8ed9149de557dc98d6",
strip_prefix = "github.com/prometheus/common@v0.32.1",
sha256 = "7a4ef12402a8a153c47c085cadf362bdc2ffe4761e50d6ab2c49e4d64044bc85",
strip_prefix = "github.com/prometheus/common@v0.42.0",
urls = [
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/prometheus/common/com_github_prometheus_common-v0.32.1.zip",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/prometheus/common/com_github_prometheus_common-v0.42.0.zip",
],
)
go_repository(
Expand All @@ -7486,10 +7496,10 @@ def go_deps():
name = "com_github_prometheus_procfs",
build_file_proto_mode = "disable_global",
importpath = "github.com/prometheus/procfs",
sha256 = "3e37c9f62738a493dd28283179d802749050353df0bca161df7cec4ed43e6f1a",
strip_prefix = "github.com/prometheus/procfs@v0.7.3",
sha256 = "3f7a5c30bbcd2adcc7ec62896b69a3792ca1603cf0998fa06d2b872a74ed13b0",
strip_prefix = "github.com/prometheus/procfs@v0.10.1",
urls = [
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/prometheus/procfs/com_github_prometheus_procfs-v0.7.3.zip",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/prometheus/procfs/com_github_prometheus_procfs-v0.10.1.zip",
],
)
go_repository(
Expand Down Expand Up @@ -8776,6 +8786,16 @@ def go_deps():
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/xeipuuv/gojsonschema/com_github_xeipuuv_gojsonschema-v1.2.0.zip",
],
)
go_repository(
name = "com_github_xhit_go_str2duration",
build_file_proto_mode = "disable_global",
importpath = "github.com/xhit/go-str2duration",
sha256 = "87df7da9ed9a48a2da6b3df14d33a567a9e6ed2454e4cbd694baa7ec82ca7ec1",
strip_prefix = "github.com/xhit/go-str2duration@v1.2.0",
urls = [
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/xhit/go-str2duration/com_github_xhit_go_str2duration-v1.2.0.zip",
],
)
go_repository(
name = "com_github_xiang90_probing",
build_file_proto_mode = "disable_global",
Expand Down Expand Up @@ -11140,10 +11160,10 @@ def go_deps():
name = "org_golang_google_protobuf",
build_file_proto_mode = "disable_global",
importpath = "google.golang.org/protobuf",
sha256 = "bf386bcd36987f898e70c8330c6f7ada03e5112909f0a92b7510961403bf61da",
strip_prefix = "google.golang.org/protobuf@v1.28.1",
sha256 = "8fb83b4d6e898c75a8d305dd46d46bb975d0a7ebab1e0042acdf25e3273d50e4",
strip_prefix = "google.golang.org/protobuf@v1.30.0",
urls = [
"https://storage.googleapis.com/cockroach-godeps/gomod/google.golang.org/protobuf/org_golang_google_protobuf-v1.28.1.zip",
"https://storage.googleapis.com/cockroach-godeps/gomod/google.golang.org/protobuf/org_golang_google_protobuf-v1.30.0.zip",
],
)
go_repository(
Expand Down Expand Up @@ -11260,10 +11280,10 @@ def go_deps():
name = "org_golang_x_sync",
build_file_proto_mode = "disable_global",
importpath = "golang.org/x/sync",
sha256 = "f510bec6009e19882d19953e7273137d34df86c65949345d72f123a255c2ecd2",
strip_prefix = "golang.org/x/sync@v0.1.0",
sha256 = "ee0df4572dd73665767964ff809b12f0d41e3a0740220d44d418a19989a0363b",
strip_prefix = "golang.org/x/sync@v0.2.0",
urls = [
"https://storage.googleapis.com/cockroach-godeps/gomod/golang.org/x/sync/org_golang_x_sync-v0.1.0.zip",
"https://storage.googleapis.com/cockroach-godeps/gomod/golang.org/x/sync/org_golang_x_sync-v0.2.0.zip",
],
)
go_repository(
Expand Down

0 comments on commit 8ad2230

Please sign in to comment.