diff --git a/ddl/syncer.go b/ddl/syncer.go index d7a911f15805f..3a2ed32313931 100644 --- a/ddl/syncer.go +++ b/ddl/syncer.go @@ -221,7 +221,7 @@ func (s *schemaVersionSyncer) UpdateSelfVersion(ctx context.Context, version int err := PutKVToEtcd(ctx, s.etcdCli, putKeyNoRetry, s.selfSchemaVerPath, ver, clientv3.WithLease(s.session.Lease())) - metrics.UpdateSelfVersionHistogram.WithLabelValues(ver, metrics.RetLabel(err)).Observe(time.Since(startTime).Seconds()) + metrics.UpdateSelfVersionHistogram.WithLabelValues(metrics.RetLabel(err)).Observe(time.Since(startTime).Seconds()) return errors.Trace(err) } @@ -232,7 +232,7 @@ func (s *schemaVersionSyncer) OwnerUpdateGlobalVersion(ctx context.Context, vers // TODO: If the version is larger than the original global version, we need set the version. // Otherwise, we'd better set the original global version. err := PutKVToEtcd(ctx, s.etcdCli, putKeyRetryUnlimited, DDLGlobalSchemaVersion, ver) - metrics.OwnerHandleSyncerHistogram.WithLabelValues(metrics.OwnerUpdateGlobalVersion, ver, metrics.RetLabel(err)).Observe(time.Since(startTime).Seconds()) + metrics.OwnerHandleSyncerHistogram.WithLabelValues(metrics.OwnerUpdateGlobalVersion, metrics.RetLabel(err)).Observe(time.Since(startTime).Seconds()) return errors.Trace(err) } @@ -276,8 +276,7 @@ func (s *schemaVersionSyncer) MustGetGlobalVersion(ctx context.Context) (int64, intervalCnt := int(time.Second / keyOpRetryInterval) defer func() { - gVer := strconv.FormatInt(int64(ver), 10) - metrics.OwnerHandleSyncerHistogram.WithLabelValues(metrics.OwnerGetGlobalVersion, gVer, metrics.RetLabel(err)).Observe(time.Since(startTime).Seconds()) + metrics.OwnerHandleSyncerHistogram.WithLabelValues(metrics.OwnerGetGlobalVersion, metrics.RetLabel(err)).Observe(time.Since(startTime).Seconds()) }() for { if err != nil { @@ -325,8 +324,7 @@ func (s *schemaVersionSyncer) OwnerCheckAllVersions(ctx context.Context, latestV var err error defer func() { - ver := strconv.FormatInt(latestVer, 10) - metrics.OwnerHandleSyncerHistogram.WithLabelValues(metrics.OwnerGetGlobalVersion, ver, metrics.RetLabel(err)).Observe(time.Since(startTime).Seconds()) + metrics.OwnerHandleSyncerHistogram.WithLabelValues(metrics.OwnerCheckAllVersions, metrics.RetLabel(err)).Observe(time.Since(startTime).Seconds()) }() for { if isContextDone(ctx) { diff --git a/metrics/ddl.go b/metrics/ddl.go index 9a646195fc487..b08911b693514 100644 --- a/metrics/ddl.go +++ b/metrics/ddl.go @@ -63,7 +63,7 @@ var ( Name: "update_self_ver_duration_seconds", Help: "Bucketed histogram of processing time (s) of update self version", Buckets: prometheus.ExponentialBuckets(0.01, 2, 20), - }, []string{LblVersion, LblResult}) + }, []string{LblResult}) OwnerUpdateGlobalVersion = "update_global_version" OwnerGetGlobalVersion = "get_global_version" @@ -75,7 +75,7 @@ var ( Name: "owner_handle_syncer_duration_seconds", Help: "Bucketed histogram of processing time (s) of handle syncer", Buckets: prometheus.ExponentialBuckets(0.01, 2, 20), - }, []string{LblType, LblVersion, LblResult}) + }, []string{LblType, LblResult}) // Metrics for ddl_worker.go. WorkerAddDDLJob = "add_job" @@ -105,6 +105,5 @@ var ( // Label constants. const ( - LblAction = "action" - LblVersion = "version" + LblAction = "action" )