Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@ public void createNode(final String path, byte[] data, List<ACL> acl, long ephem
containers.add(path);
} else if (ephemeralType == EphemeralType.TTL) {
ttls.add(path);
ServerMetrics.getMetrics().TTL_NODE_CREATED_COUNT.add(1);
} else if (ephemeralOwner != 0) {
HashSet<String> list = ephemerals.computeIfAbsent(ephemeralOwner, k -> new HashSet<>());
synchronized (list) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ private ServerMetrics(MetricsProvider metricsProvider) {
QUOTA_EXCEEDED_ERROR_PER_NAMESPACE = metricsContext.getCounterSet(QuotaMetricsUtils.QUOTA_EXCEEDED_ERROR_PER_NAMESPACE);

TTL_NODE_DELETED_COUNT = metricsContext.getCounter("ttl_node_deleted_count");
TTL_NODE_CREATED_COUNT = metricsContext.getCounter("ttl_node_created_count");
}

/**
Expand Down Expand Up @@ -550,9 +551,10 @@ private ServerMetrics(MetricsProvider metricsProvider) {
public final CounterSet QUOTA_EXCEEDED_ERROR_PER_NAMESPACE;

/**
* Count of deleted TTL nodes
* Count of created and deleted TTL nodes
*/
public final Counter TTL_NODE_DELETED_COUNT;
public final Counter TTL_NODE_CREATED_COUNT;

private final MetricsProvider metricsProvider;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,9 @@ public void testCreate() throws KeeperException, InterruptedException {
containerManager.checkContainers();
assertNull(zk.exists("/foo", false), "Ttl node should have been deleted");

// validate deleted TTL nodes count
// validate created and deleted TTL nodes count
Map<String, Object> metrics = MetricsUtils.currentServerMetrics();
assertTrue((long) metrics.get("ttl_node_created_count") >= 1);
assertTrue((long) metrics.get("ttl_node_deleted_count") >= 1);
}

Expand Down