From bbab8fe770ef961310d1c7ba045d68f3708e6463 Mon Sep 17 00:00:00 2001 From: Oleksandr Redko Date: Thu, 21 Sep 2023 14:31:08 +0300 Subject: [PATCH] Fix typos in comments, tests, and errors (#1346) Signed-off-by: Oleksandr Redko --- CHANGELOG.md | 2 +- api/prometheus/v1/api_test.go | 2 +- api/prometheus/v1/example_test.go | 2 +- prometheus/collectors/expvar_collector.go | 2 +- prometheus/counter.go | 2 +- prometheus/gauge.go | 2 +- prometheus/go_collector_latest_test.go | 2 +- prometheus/histogram.go | 8 ++++---- prometheus/internal/difflib.go | 2 +- prometheus/push/push.go | 2 +- prometheus/registry.go | 2 +- prometheus/registry_test.go | 4 ++-- prometheus/summary.go | 2 +- prometheus/testutil/testutil_test.go | 2 +- tutorial/whatsup/internal/playground_test.go | 2 +- 15 files changed, 19 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e73f2b..cb5c5bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -295,7 +295,7 @@ _This release removes all previously deprecated features, resulting in the break * [BUGFIX] Fixed goroutine leaks. #236 #472 * [BUGFIX] Fixed an error message for exponential histogram buckets. #467 * [BUGFIX] Fixed data race writing to the metric map. #401 -* [BUGFIX] API client: Decode JSON on a 4xx respons but do not on 204 +* [BUGFIX] API client: Decode JSON on a 4xx response but do not on 204 responses. #476 #414 ## 0.8.0 / 2016-08-17 diff --git a/api/prometheus/v1/api_test.go b/api/prometheus/v1/api_test.go index 114be9a..e87e483 100644 --- a/api/prometheus/v1/api_test.go +++ b/api/prometheus/v1/api_test.go @@ -1441,7 +1441,7 @@ func TestAPIClientDo(t *testing.T) { } } else { if warnings != nil { - t.Fatalf("unexpexted warnings: %v", warnings) + t.Fatalf("unexpected warnings: %v", warnings) } } diff --git a/api/prometheus/v1/example_test.go b/api/prometheus/v1/example_test.go index 5876572..a73d283 100644 --- a/api/prometheus/v1/example_test.go +++ b/api/prometheus/v1/example_test.go @@ -135,7 +135,7 @@ func ExampleAPI_queryRangeWithBasicAuth() { client, err := api.NewClient(api.Config{ Address: "http://demo.robustperception.io:9090", // We can use amazing github.com/prometheus/common/config helper! - RoundTripper: config.NewBasicAuthRoundTripper("me", "defintely_me", "", api.DefaultRoundTripper), + RoundTripper: config.NewBasicAuthRoundTripper("me", "definitely_me", "", api.DefaultRoundTripper), }) if err != nil { fmt.Printf("Error creating client: %v\n", err) diff --git a/prometheus/collectors/expvar_collector.go b/prometheus/collectors/expvar_collector.go index 3aa8d05..b22d862 100644 --- a/prometheus/collectors/expvar_collector.go +++ b/prometheus/collectors/expvar_collector.go @@ -22,7 +22,7 @@ import "github.com/prometheus/client_golang/prometheus" // Prometheus metrics. Note that the data models of expvar and Prometheus are // fundamentally different, and that the expvar Collector is inherently slower // than native Prometheus metrics. Thus, the expvar Collector is probably great -// for experiments and prototying, but you should seriously consider a more +// for experiments and prototyping, but you should seriously consider a more // direct implementation of Prometheus metrics for monitoring production // systems. // diff --git a/prometheus/counter.go b/prometheus/counter.go index 5f72deb..4ce84e7 100644 --- a/prometheus/counter.go +++ b/prometheus/counter.go @@ -67,7 +67,7 @@ type CounterVecOpts struct { CounterOpts // VariableLabels are used to partition the metric vector by the given set - // of labels. Each label value will be constrained with the optional Contraint + // of labels. Each label value will be constrained with the optional Constraint // function, if provided. VariableLabels ConstrainableLabels } diff --git a/prometheus/gauge.go b/prometheus/gauge.go index 8e94883..dd2eac9 100644 --- a/prometheus/gauge.go +++ b/prometheus/gauge.go @@ -62,7 +62,7 @@ type GaugeVecOpts struct { GaugeOpts // VariableLabels are used to partition the metric vector by the given set - // of labels. Each label value will be constrained with the optional Contraint + // of labels. Each label value will be constrained with the optional Constraint // function, if provided. VariableLabels ConstrainableLabels } diff --git a/prometheus/go_collector_latest_test.go b/prometheus/go_collector_latest_test.go index d64120c..551f497 100644 --- a/prometheus/go_collector_latest_test.go +++ b/prometheus/go_collector_latest_test.go @@ -120,7 +120,7 @@ func TestGoCollector_ExposedMetrics(t *testing.T) { name := goMetrics[i].Desc().fqName if _, ok := tcase.expectedFQNameSet[name]; !ok { - t.Errorf("found unpexpected metric %s", name) + t.Errorf("found unexpected metric %s", name) continue } } diff --git a/prometheus/histogram.go b/prometheus/histogram.go index ab758db..1feba62 100644 --- a/prometheus/histogram.go +++ b/prometheus/histogram.go @@ -392,7 +392,7 @@ type HistogramOpts struct { // zero, it is replaced by default buckets. The default buckets are // DefBuckets if no buckets for a native histogram (see below) are used, // otherwise the default is no buckets. (In other words, if you want to - // use both reguler buckets and buckets for a native histogram, you have + // use both regular buckets and buckets for a native histogram, you have // to define the regular buckets here explicitly.) Buckets []float64 @@ -484,7 +484,7 @@ type HistogramVecOpts struct { HistogramOpts // VariableLabels are used to partition the metric vector by the given set - // of labels. Each label value will be constrained with the optional Contraint + // of labels. Each label value will be constrained with the optional Constraint // function, if provided. VariableLabels ConstrainableLabels } @@ -896,7 +896,7 @@ func (h *histogram) maybeReset( h.resetCounts(cold) // Repeat the latest observation to not lose it completely. cold.observe(value, bucket, true) - // Make coldCounts the new hot counts while ressetting countAndHotIdx. + // Make coldCounts the new hot counts while resetting countAndHotIdx. n := atomic.SwapUint64(&h.countAndHotIdx, (coldIdx<<63)+1) count := n & ((1 << 63) - 1) waitForCooldown(count, hot) @@ -1356,7 +1356,7 @@ func makeBuckets(buckets *sync.Map) ([]*dto.BucketSpan, []int64) { // Multiple spans with only small gaps in between are probably // encoded more efficiently as one larger span with a few empty // buckets. Needs some research to find the sweet spot. For now, - // we assume that gaps of one ore two buckets should not create + // we assume that gaps of one or two buckets should not create // a new span. iDelta := int32(i - nextI) if n == 0 || iDelta > 2 { diff --git a/prometheus/internal/difflib.go b/prometheus/internal/difflib.go index fd0750f..a595a20 100644 --- a/prometheus/internal/difflib.go +++ b/prometheus/internal/difflib.go @@ -14,7 +14,7 @@ // It provides tools to compare sequences of strings and generate textual diffs. // // Maintaining `GetUnifiedDiffString` here because original repository -// (https://github.com/pmezard/go-difflib) is no loger maintained. +// (https://github.com/pmezard/go-difflib) is no longer maintained. package internal import ( diff --git a/prometheus/push/push.go b/prometheus/push/push.go index d3a3cef..b2c32f4 100644 --- a/prometheus/push/push.go +++ b/prometheus/push/push.go @@ -289,7 +289,7 @@ func (p *Pusher) push(ctx context.Context, method string) error { } if err := enc.Encode(mf); err != nil { return fmt.Errorf( - "failed to encode metric familty %s, error is %w", + "failed to encode metric family %s, error is %w", mf.GetName(), err) } } diff --git a/prometheus/registry.go b/prometheus/registry.go index 22d6f99..5e2ced2 100644 --- a/prometheus/registry.go +++ b/prometheus/registry.go @@ -548,7 +548,7 @@ func (r *Registry) Gather() ([]*dto.MetricFamily, error) { goroutineBudget-- runtime.Gosched() } - // Once both checkedMetricChan and uncheckdMetricChan are closed + // Once both checkedMetricChan and uncheckedMetricChan are closed // and drained, the contraption above will nil out cmc and umc, // and then we can leave the collect loop here. if cmc == nil && umc == nil { diff --git a/prometheus/registry_test.go b/prometheus/registry_test.go index 654778b..dca36fe 100644 --- a/prometheus/registry_test.go +++ b/prometheus/registry_test.go @@ -1104,7 +1104,7 @@ type collidingCollector struct { a, b, c, d prometheus.Collector } -// Describe satisifies part of the prometheus.Collector interface. +// Describe satisfies part of the prometheus.Collector interface. func (m *collidingCollector) Describe(desc chan<- *prometheus.Desc) { m.a.Describe(desc) m.b.Describe(desc) @@ -1112,7 +1112,7 @@ func (m *collidingCollector) Describe(desc chan<- *prometheus.Desc) { m.d.Describe(desc) } -// Collect satisifies part of the prometheus.Collector interface. +// Collect satisfies part of the prometheus.Collector interface. func (m *collidingCollector) Collect(metric chan<- prometheus.Metric) { m.a.Collect(metric) m.b.Collect(metric) diff --git a/prometheus/summary.go b/prometheus/summary.go index e2c2fbd..1462704 100644 --- a/prometheus/summary.go +++ b/prometheus/summary.go @@ -158,7 +158,7 @@ type SummaryVecOpts struct { SummaryOpts // VariableLabels are used to partition the metric vector by the given set - // of labels. Each label value will be constrained with the optional Contraint + // of labels. Each label value will be constrained with the optional Constraint // function, if provided. VariableLabels ConstrainableLabels } diff --git a/prometheus/testutil/testutil_test.go b/prometheus/testutil/testutil_test.go index 8c8a1a4..ab2fdb0 100644 --- a/prometheus/testutil/testutil_test.go +++ b/prometheus/testutil/testutil_test.go @@ -230,7 +230,7 @@ func TestCollectAndCompareHistogram(t *testing.T) { case *prometheus.HistogramVec: collector.WithLabelValues("test").Observe(input.observation) default: - t.Fatalf("unsuported collector tested") + t.Fatalf("unsupported collector tested") } diff --git a/tutorial/whatsup/internal/playground_test.go b/tutorial/whatsup/internal/playground_test.go index abecb4f..f1c1598 100644 --- a/tutorial/whatsup/internal/playground_test.go +++ b/tutorial/whatsup/internal/playground_test.go @@ -36,7 +36,7 @@ import ( ) func TestPlayground(t *testing.T) { - // NOTE: Only one run at the time will work due to statics ports used. + // NOTE: Only one run at the time will work due to static ports used. e, err := e2e.New(e2e.WithVerbose()) testutil.Ok(t, err)