forked from apache/cassandra
-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathIndexMetrics.java
More file actions
79 lines (70 loc) · 4.28 KB
/
IndexMetrics.java
File metadata and controls
79 lines (70 loc) · 4.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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 org.apache.cassandra.index.sai.metrics;
import java.util.Optional;
import com.codahale.metrics.Counter;
import com.codahale.metrics.Gauge;
import com.codahale.metrics.Histogram;
import com.codahale.metrics.Timer;
import org.apache.cassandra.config.CassandraRelevantProperties;
import org.apache.cassandra.index.sai.IndexContext;
import static org.apache.cassandra.metrics.CassandraMetricsRegistry.Metrics;
public class IndexMetrics extends AbstractMetrics
{
@SuppressWarnings("OptionalUsedAsFieldOrParameterType")
public final Optional<Timer> memtableIndexWriteLatency;
public final Gauge ssTableCellCount;
public final Gauge liveMemtableIndexWriteCount;
public final Gauge diskUsedBytes;
public final Gauge memtableOnHeapIndexBytes;
public final Gauge memtableOffHeapIndexBytes;
public final Gauge indexFileCacheBytes;
public final Counter memtableIndexFlushCount;
public final Counter compactionCount;
public final Counter compactionTermsProcessedCount;
public final Counter memtableIndexFlushErrors;
public final Counter segmentFlushErrors;
public final Counter queriesCount;
public final Histogram memtableFlushCellsPerSecond;
public final Histogram segmentsPerCompaction;
public final Histogram compactionSegmentCellsPerSecond;
public final Histogram compactionSegmentBytesPerSecond;
public IndexMetrics(IndexContext context)
{
super(context.getKeyspace(), context.getTable(), context.getIndexName(), "IndexMetrics");
memtableIndexWriteLatency = CassandraRelevantProperties.SAI_HISTOGRAMS_ENABLED.getBoolean()
? Optional.of(Metrics.timer(createMetricName("MemtableIndexWriteLatency")))
: Optional.empty();
compactionSegmentCellsPerSecond = Metrics.histogram(createMetricName("CompactionSegmentCellsPerSecond"), false);
compactionSegmentBytesPerSecond = Metrics.histogram(createMetricName("CompactionSegmentBytesPerSecond"), false);
memtableFlushCellsPerSecond = Metrics.histogram(createMetricName("MemtableIndexFlushCellsPerSecond"), false);
segmentsPerCompaction = Metrics.histogram(createMetricName("SegmentsPerCompaction"), false);
ssTableCellCount = Metrics.register(createMetricName("SSTableCellCount"), context::getCellCount);
memtableIndexFlushCount = Metrics.counter(createMetricName("MemtableIndexFlushCount"));
compactionCount = Metrics.counter(createMetricName("CompactionCount"));
compactionTermsProcessedCount = Metrics.counter(createMetricName("CompactionTermsProcessedCount"));
memtableIndexFlushErrors = Metrics.counter(createMetricName("MemtableIndexFlushErrors"));
segmentFlushErrors = Metrics.counter(createMetricName("CompactionSegmentFlushErrors"));
queriesCount = Metrics.counter(createMetricName("QueriesCount"));
liveMemtableIndexWriteCount = Metrics.register(createMetricName("LiveMemtableIndexWriteCount"), context::liveMemtableWriteCount);
memtableOnHeapIndexBytes = Metrics.register(createMetricName("MemtableOnHeapIndexBytes"), context::estimatedOnHeapMemIndexMemoryUsed);
memtableOffHeapIndexBytes = Metrics.register(createMetricName("MemtableOffHeapIndexBytes"), context::estimatedOffHeapMemIndexMemoryUsed);
diskUsedBytes = Metrics.register(createMetricName("DiskUsedBytes"), context::diskUsage);
indexFileCacheBytes = Metrics.register(createMetricName("IndexFileCacheBytes"), context::indexFileCacheSize);
}
}