diff --git a/go.mod b/go.mod index ca13261b..1309f9a8 100644 --- a/go.mod +++ b/go.mod @@ -18,5 +18,5 @@ require ( k8s.io/code-generator v0.18.12 k8s.io/kube-openapi v0.0.0-20200410145947-bcb3869e6f29 knative.dev/hack v0.0.0-20201120192952-353db687ec5b - knative.dev/pkg v0.0.0-20201123172958-fea72c1c8e2f + knative.dev/pkg v0.0.0-20201124204235-3154117dcfaf ) diff --git a/go.sum b/go.sum index 2943f375..b5aa5f69 100644 --- a/go.sum +++ b/go.sum @@ -1133,8 +1133,8 @@ k8s.io/utils v0.0.0-20200603063816-c1c6865ac451 h1:v8ud2Up6QK1lNOKFgiIVrZdMg7Mpm k8s.io/utils v0.0.0-20200603063816-c1c6865ac451/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= knative.dev/hack v0.0.0-20201120192952-353db687ec5b h1:Lc+AKgwhAZUD98mN++qTHeeaP6FRmS8fcwc/rXkP8G0= knative.dev/hack v0.0.0-20201120192952-353db687ec5b/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI= -knative.dev/pkg v0.0.0-20201123172958-fea72c1c8e2f h1:zQEnqguiWwewcE2munQYL38S8VuV/hAuZCCk/6UMvhI= -knative.dev/pkg v0.0.0-20201123172958-fea72c1c8e2f/go.mod h1:wXZqP8MXCxb51yNFlecA13BwG7Hk370SWDFWV4dx4ug= +knative.dev/pkg v0.0.0-20201124204235-3154117dcfaf h1:H5um6wZSd1Qmqqozr+/nHF2HyaMde6GNXM3+KbaYlJc= +knative.dev/pkg v0.0.0-20201124204235-3154117dcfaf/go.mod h1:wXZqP8MXCxb51yNFlecA13BwG7Hk370SWDFWV4dx4ug= pgregory.net/rapid v0.3.3/go.mod h1:UYpPVyjFHzYBGHIxLFoupi8vwk6rXNzRY9OMvVxFIOU= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= diff --git a/vendor/knative.dev/pkg/controller/controller.go b/vendor/knative.dev/pkg/controller/controller.go index b0ecb2e9..941117c7 100644 --- a/vendor/knative.dev/pkg/controller/controller.go +++ b/vendor/knative.dev/pkg/controller/controller.go @@ -493,7 +493,7 @@ func (c *Impl) processNextWorkItem() bool { if err != nil { status = falseString } - c.statsReporter.ReportReconcile(time.Since(startTime), status) + c.statsReporter.ReportReconcile(time.Since(startTime), status, key) // We call Done here so the workqueue knows we have finished // processing this item. We also must remember to call Forget if diff --git a/vendor/knative.dev/pkg/controller/stats_reporter.go b/vendor/knative.dev/pkg/controller/stats_reporter.go index 7ffa80d7..92a5848a 100644 --- a/vendor/knative.dev/pkg/controller/stats_reporter.go +++ b/vendor/knative.dev/pkg/controller/stats_reporter.go @@ -25,10 +25,12 @@ import ( "go.opencensus.io/stats/view" "go.opencensus.io/tag" "go.uber.org/zap" + "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/tools/cache" kubemetrics "k8s.io/client-go/tools/metrics" "k8s.io/client-go/util/workqueue" "knative.dev/pkg/metrics" + "knative.dev/pkg/metrics/metricskey" ) var ( @@ -47,6 +49,7 @@ var ( // - characters are printable US-ASCII reconcilerTagKey = tag.MustNewKey("reconciler") successTagKey = tag.MustNewKey("success") + NamespaceTagKey = tag.MustNewKey(metricskey.LabelNamespaceName) ) func init() { @@ -170,12 +173,12 @@ func init() { Description: "Number of reconcile operations", Measure: reconcileCountStat, Aggregation: view.Count(), - TagKeys: []tag.Key{reconcilerTagKey, successTagKey}, + TagKeys: []tag.Key{reconcilerTagKey, successTagKey, NamespaceTagKey}, }, { Description: "Latency of reconcile operations", Measure: reconcileLatencyStat, Aggregation: reconcileDistribution, - TagKeys: []tag.Key{reconcilerTagKey, successTagKey}, + TagKeys: []tag.Key{reconcilerTagKey, successTagKey, NamespaceTagKey}, }} views = append(views, wp.DefaultViews()...) views = append(views, rp.DefaultViews()...) @@ -195,7 +198,7 @@ type StatsReporter interface { ReportQueueDepth(v int64) error // ReportReconcile reports the count and latency metrics for a reconcile operation - ReportReconcile(duration time.Duration, success string) error + ReportReconcile(duration time.Duration, success string, key types.NamespacedName) error } // Reporter holds cached metric objects to report metrics @@ -237,11 +240,14 @@ func (r *reporter) ReportQueueDepth(v int64) error { } // ReportReconcile reports the count and latency metrics for a reconcile operation -func (r *reporter) ReportReconcile(duration time.Duration, success string) error { +func (r *reporter) ReportReconcile(duration time.Duration, success string, key types.NamespacedName) error { ctx, err := tag.New( context.Background(), tag.Insert(reconcilerTagKey, r.reconciler), - tag.Insert(successTagKey, success)) + tag.Insert(successTagKey, success), + tag.Insert(NamespaceTagKey, key.Namespace), + ) + if err != nil { return err } diff --git a/vendor/modules.txt b/vendor/modules.txt index 59c42d32..bc704e90 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -742,7 +742,7 @@ k8s.io/utils/trace # knative.dev/hack v0.0.0-20201120192952-353db687ec5b ## explicit knative.dev/hack -# knative.dev/pkg v0.0.0-20201123172958-fea72c1c8e2f +# knative.dev/pkg v0.0.0-20201124204235-3154117dcfaf ## explicit knative.dev/pkg/apis knative.dev/pkg/apis/duck