Skip to content

Commit

Permalink
Upgrade weaver version to 0.24.6 (#150)
Browse files Browse the repository at this point in the history
  • Loading branch information
rgrandl authored Oct 11, 2024
1 parent 73d0819 commit d38d460
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 8 deletions.
3 changes: 2 additions & 1 deletion examples/echo/echo.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"regexp"

"github.com/ServiceWeaver/weaver"
"github.com/ServiceWeaver/weaver-gke/internal/store"
"github.com/ServiceWeaver/weaver/metrics"
)

Expand All @@ -28,7 +29,7 @@ import (
var stringLength = metrics.NewHistogram(
"echo_string_length",
"The length of strings passed to the Echo method",
metrics.NonNegativeBuckets,
store.GeneratedBuckets,
)

type echoOptions struct {
Expand Down
2 changes: 1 addition & 1 deletion examples/echo/weaver_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
cloud.google.com/go/monitoring v1.15.1
cloud.google.com/go/security v1.15.1
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/trace v1.11.0
github.com/ServiceWeaver/weaver v0.24.2
github.com/ServiceWeaver/weaver v0.24.6
github.com/golang/protobuf v1.5.3
github.com/google/cel-go v0.17.1
github.com/google/go-cmp v0.5.9
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/cloudmock v0
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/cloudmock v0.35.0/go.mod h1:/u5+zrOXintMHE97lVsaKZpwDIfGOBClYrCD/borbi8=
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.35.0 h1:vjtrvX7B3S+uqTIOvOUfqsMCa3eEtEOOQWm7ERI1pxg=
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.35.0/go.mod h1:H785fvlgotVZqht+1rHhXSs8EJ8uPVmpBYkTYO3ccpc=
github.com/ServiceWeaver/weaver v0.24.2 h1:GXapIUCLlN8YYLjH2fvbw0lR77wM5uZOrvCBNG8YZYE=
github.com/ServiceWeaver/weaver v0.24.2/go.mod h1:twEFAFbylAXe9l1Zc5qrLOBfQvw2dKAGVFOyPzS0tFE=
github.com/ServiceWeaver/weaver v0.24.6 h1:KSIbxVabeT8nGbdn5hrzk+FZ8TDoafj1RXhV9Wf+O7U=
github.com/ServiceWeaver/weaver v0.24.6/go.mod h1:twEFAFbylAXe9l1Zc5qrLOBfQvw2dKAGVFOyPzS0tFE=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
Expand Down
23 changes: 21 additions & 2 deletions internal/store/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ var (
requestLatencies = metrics.NewHistogramMap[storeLabels](
"serviceweaver_store_request_latency_micros",
"Latency of store requests, in microseconds, by operation",
metrics.NonNegativeBuckets,
GeneratedBuckets,
)
valueSizes = metrics.NewHistogramMap[storeLabels](
"serviceweaver_store_value_size_bytes",
"Size of values, in bytes, by operation",
metrics.NonNegativeBuckets,
GeneratedBuckets,
)
staleCounts = metrics.NewCounterMap[storeLabels](
"serviceweaver_store_stale_count",
Expand Down Expand Up @@ -141,3 +141,22 @@ func (m *metricsWrapper) Delete(ctx context.Context, key string) error {
func (m *metricsWrapper) List(ctx context.Context, opts ListOptions) ([]string, error) {
return m.store.List(ctx, opts)
}

// GeneratedBuckets provides rounded bucket boundaries for histograms
// that will only store non-negative values.
//
// Note that these buckets are intended to be used only by the metrics generated
// by the weaver runtime.
var GeneratedBuckets = []float64{
// Adjacent buckets differ from each other by 2x or 2.5x.
1, 2, 5,
10, 20, 50,
100, 200, 500,
1000, 2000, 5000,
10000, 20000, 50000,
100000, 200000, 500000,
1000000, 2000000, 5000000,
10000000, 20000000, 50000000,
100000000, 200000000, 500000000,
1000000000, 2000000000, 5000000000, // i.e., 5e9
}
2 changes: 1 addition & 1 deletion internal/tool/testprogram/weaver_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d38d460

Please sign in to comment.