mirror of
https://github.com/google/nomulus.git
synced 2025-05-14 00:17:20 +02:00
Add metric for lock contention
Also - remove logging from TransactNew, to prevent double logging on transient failures (TransactNew retries on failure) ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=172500772
This commit is contained in:
parent
6f9b039e72
commit
77ee3e3544
3 changed files with 165 additions and 47 deletions
45
java/google/registry/model/server/LockMetrics.java
Normal file
45
java/google/registry/model/server/LockMetrics.java
Normal file
|
@ -0,0 +1,45 @@
|
|||
// Copyright 2017 The Nomulus Authors. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package google.registry.model.server;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import google.registry.model.server.Lock.LockState;
|
||||
import google.registry.monitoring.metrics.IncrementableMetric;
|
||||
import google.registry.monitoring.metrics.LabelDescriptor;
|
||||
import google.registry.monitoring.metrics.MetricRegistryImpl;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/** Metrics for lock contention. */
|
||||
class LockMetrics {
|
||||
|
||||
private static final ImmutableSet<LabelDescriptor> LABEL_DESCRIPTORS =
|
||||
ImmutableSet.of(
|
||||
LabelDescriptor.create("tld", "TLD"),
|
||||
LabelDescriptor.create("resource", "resource name"),
|
||||
LabelDescriptor.create(
|
||||
"state", "The existing lock state (before attempting to acquire)."));
|
||||
|
||||
private static final IncrementableMetric lockRequestsMetric =
|
||||
MetricRegistryImpl.getDefault()
|
||||
.newIncrementableMetric(
|
||||
"/lock/acquire_lock_requests",
|
||||
"Count of lock acquisition attempts",
|
||||
"count",
|
||||
LABEL_DESCRIPTORS);
|
||||
|
||||
void record(String resourceName, @Nullable String tld, LockState state) {
|
||||
lockRequestsMetric.increment(String.valueOf(tld), resourceName, state.name());
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue