Skip to content

Commit

Permalink
ddl, metrics: remove DDL version in metrics (#7737)
Browse files Browse the repository at this point in the history
  • Loading branch information
zimulala authored and shenli committed Sep 23, 2018
1 parent f457f24 commit 16864f9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
10 changes: 4 additions & 6 deletions ddl/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand All @@ -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)
}

Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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) {
Expand Down
7 changes: 3 additions & 4 deletions metrics/ddl.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -105,6 +105,5 @@ var (

// Label constants.
const (
LblAction = "action"
LblVersion = "version"
LblAction = "action"
)

0 comments on commit 16864f9

Please sign in to comment.