Merge pull request #54921 from weiwei04/fix_reflector_last_resource_version

Automatic merge from submit-queue (batch tested with PRs 54800, 53898, 54812, 54921, 53558). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

rename metric reflector_xx_last_resource_version

**What this PR does / why we need it**:

mv reflector name from metric name to metric label

before:

```
reflector_k8s_io_kubernetes_pkg_client_informers_informers_generated_internalversion_factory_go:73_8664_last_resource_version{instance="104.154.20.21:443",job="kubernetes-apiservers"}
```

after

```
reflector_last_resource_version{instance="10.0.2.15:6443",job="kubernetes-apiservers",name="k8s_io_kubernetes_pkg_client_informers_informers_generated_internalversion_factory_go_73_8664"}
```

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #52121

**Special notes for your reviewer**:

None

**Release note**:

```release-note
NONE
```

Kubernetes-commit: b7968e090730141f915577fa116e44e2bc6c0099
This commit is contained in:
Kubernetes Publisher 2017-11-02 03:14:24 -07:00
commit 97bcf95ca0
2 changed files with 83 additions and 83 deletions

160
Godeps/Godeps.json generated
View File

@ -372,323 +372,323 @@
},
{
"ImportPath": "k8s.io/api/admissionregistration/v1alpha1",
"Rev": "1414bb6a06f4bf767440cc791d9ecf844c867971"
"Rev": "447c79b355fd16e12ec3a5bf2206cb221e604afe"
},
{
"ImportPath": "k8s.io/api/apps/v1",
"Rev": "1414bb6a06f4bf767440cc791d9ecf844c867971"
"Rev": "447c79b355fd16e12ec3a5bf2206cb221e604afe"
},
{
"ImportPath": "k8s.io/api/apps/v1beta1",
"Rev": "1414bb6a06f4bf767440cc791d9ecf844c867971"
"Rev": "447c79b355fd16e12ec3a5bf2206cb221e604afe"
},
{
"ImportPath": "k8s.io/api/apps/v1beta2",
"Rev": "1414bb6a06f4bf767440cc791d9ecf844c867971"
"Rev": "447c79b355fd16e12ec3a5bf2206cb221e604afe"
},
{
"ImportPath": "k8s.io/api/authentication/v1",
"Rev": "1414bb6a06f4bf767440cc791d9ecf844c867971"
"Rev": "447c79b355fd16e12ec3a5bf2206cb221e604afe"
},
{
"ImportPath": "k8s.io/api/authentication/v1beta1",
"Rev": "1414bb6a06f4bf767440cc791d9ecf844c867971"
"Rev": "447c79b355fd16e12ec3a5bf2206cb221e604afe"
},
{
"ImportPath": "k8s.io/api/authorization/v1",
"Rev": "1414bb6a06f4bf767440cc791d9ecf844c867971"
"Rev": "447c79b355fd16e12ec3a5bf2206cb221e604afe"
},
{
"ImportPath": "k8s.io/api/authorization/v1beta1",
"Rev": "1414bb6a06f4bf767440cc791d9ecf844c867971"
"Rev": "447c79b355fd16e12ec3a5bf2206cb221e604afe"
},
{
"ImportPath": "k8s.io/api/autoscaling/v1",
"Rev": "1414bb6a06f4bf767440cc791d9ecf844c867971"
"Rev": "447c79b355fd16e12ec3a5bf2206cb221e604afe"
},
{
"ImportPath": "k8s.io/api/autoscaling/v2beta1",
"Rev": "1414bb6a06f4bf767440cc791d9ecf844c867971"
"Rev": "447c79b355fd16e12ec3a5bf2206cb221e604afe"
},
{
"ImportPath": "k8s.io/api/batch/v1",
"Rev": "1414bb6a06f4bf767440cc791d9ecf844c867971"
"Rev": "447c79b355fd16e12ec3a5bf2206cb221e604afe"
},
{
"ImportPath": "k8s.io/api/batch/v1beta1",
"Rev": "1414bb6a06f4bf767440cc791d9ecf844c867971"
"Rev": "447c79b355fd16e12ec3a5bf2206cb221e604afe"
},
{
"ImportPath": "k8s.io/api/batch/v2alpha1",
"Rev": "1414bb6a06f4bf767440cc791d9ecf844c867971"
"Rev": "447c79b355fd16e12ec3a5bf2206cb221e604afe"
},
{
"ImportPath": "k8s.io/api/certificates/v1beta1",
"Rev": "1414bb6a06f4bf767440cc791d9ecf844c867971"
"Rev": "447c79b355fd16e12ec3a5bf2206cb221e604afe"
},
{
"ImportPath": "k8s.io/api/core/v1",
"Rev": "1414bb6a06f4bf767440cc791d9ecf844c867971"
"Rev": "447c79b355fd16e12ec3a5bf2206cb221e604afe"
},
{
"ImportPath": "k8s.io/api/extensions/v1beta1",
"Rev": "1414bb6a06f4bf767440cc791d9ecf844c867971"
"Rev": "447c79b355fd16e12ec3a5bf2206cb221e604afe"
},
{
"ImportPath": "k8s.io/api/imagepolicy/v1alpha1",
"Rev": "1414bb6a06f4bf767440cc791d9ecf844c867971"
"Rev": "447c79b355fd16e12ec3a5bf2206cb221e604afe"
},
{
"ImportPath": "k8s.io/api/networking/v1",
"Rev": "1414bb6a06f4bf767440cc791d9ecf844c867971"
"Rev": "447c79b355fd16e12ec3a5bf2206cb221e604afe"
},
{
"ImportPath": "k8s.io/api/policy/v1beta1",
"Rev": "1414bb6a06f4bf767440cc791d9ecf844c867971"
"Rev": "447c79b355fd16e12ec3a5bf2206cb221e604afe"
},
{
"ImportPath": "k8s.io/api/rbac/v1",
"Rev": "1414bb6a06f4bf767440cc791d9ecf844c867971"
"Rev": "447c79b355fd16e12ec3a5bf2206cb221e604afe"
},
{
"ImportPath": "k8s.io/api/rbac/v1alpha1",
"Rev": "1414bb6a06f4bf767440cc791d9ecf844c867971"
"Rev": "447c79b355fd16e12ec3a5bf2206cb221e604afe"
},
{
"ImportPath": "k8s.io/api/rbac/v1beta1",
"Rev": "1414bb6a06f4bf767440cc791d9ecf844c867971"
"Rev": "447c79b355fd16e12ec3a5bf2206cb221e604afe"
},
{
"ImportPath": "k8s.io/api/scheduling/v1alpha1",
"Rev": "1414bb6a06f4bf767440cc791d9ecf844c867971"
"Rev": "447c79b355fd16e12ec3a5bf2206cb221e604afe"
},
{
"ImportPath": "k8s.io/api/settings/v1alpha1",
"Rev": "1414bb6a06f4bf767440cc791d9ecf844c867971"
"Rev": "447c79b355fd16e12ec3a5bf2206cb221e604afe"
},
{
"ImportPath": "k8s.io/api/storage/v1",
"Rev": "1414bb6a06f4bf767440cc791d9ecf844c867971"
"Rev": "447c79b355fd16e12ec3a5bf2206cb221e604afe"
},
{
"ImportPath": "k8s.io/api/storage/v1beta1",
"Rev": "1414bb6a06f4bf767440cc791d9ecf844c867971"
"Rev": "447c79b355fd16e12ec3a5bf2206cb221e604afe"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/equality",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/errors",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/meta",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/resource",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/testing",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/testing/fuzzer",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/testing/roundtrip",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apimachinery",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apimachinery/announced",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apimachinery/registered",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/fuzzer",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/internalversion",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1alpha1",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/conversion",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/conversion/queryparams",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/conversion/unstructured",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/fields",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/labels",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/schema",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/json",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/protobuf",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/recognizer",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/streaming",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/versioning",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/selection",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/types",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/cache",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/clock",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/diff",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/errors",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/framer",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/httpstream",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/httpstream/spdy",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/intstr",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/json",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/mergepatch",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/net",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/remotecommand",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/runtime",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/sets",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/strategicpatch",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/validation",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/validation/field",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/wait",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/yaml",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/version",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/watch",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/json",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/netutil",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/reflect",
"Rev": "9cf13201f03e0dc2a9782ed30908f3030442a665"
"Rev": "29ad778ed160b0a342405cda3afe6b892dae01e0"
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/common",

View File

@ -109,7 +109,7 @@ func NewNamedReflector(name string, lw ListerWatcher, expectedType interface{},
r := &Reflector{
name: name,
// we need this to be unique per process (some names are still the same)but obvious who it belongs to
metrics: newReflectorMetrics(makeValidPromethusMetricName(fmt.Sprintf("reflector_"+name+"_%d", reflectorSuffix))),
metrics: newReflectorMetrics(makeValidPromethusMetricLabel(fmt.Sprintf("reflector_"+name+"_%d", reflectorSuffix))),
listerWatcher: lw,
store: store,
expectedType: reflect.TypeOf(expectedType),
@ -120,9 +120,9 @@ func NewNamedReflector(name string, lw ListerWatcher, expectedType interface{},
return r
}
func makeValidPromethusMetricName(in string) string {
func makeValidPromethusMetricLabel(in string) string {
// this isn't perfect, but it removes our common characters
return strings.NewReplacer("/", "_", ".", "_", "-", "_").Replace(in)
return strings.NewReplacer("/", "_", ".", "_", "-", "_", ":", "_").Replace(in)
}
// internalPackages are packages that ignored when creating a default reflector name. These packages are in the common