Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use new StatisticsService to send stats to collector (close #1684)
- Loading branch information
1 parent
5f3a062
commit e2ec7cc
Showing
18 changed files
with
1,292 additions
and
417 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
197 changes: 90 additions & 107 deletions
197
...-test/src/test/java/org/ehcache/clustered/management/ClusteringManagementServiceTest.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
core/src/main/java/org/ehcache/core/statistics/CacheStatistics.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Copyright Terracotta, Inc. | ||
* | ||
* 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 org.ehcache.core.statistics; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* All statistics relative to a cache and its underlying tiers. | ||
* | ||
* @author Henri Tremblay | ||
*/ | ||
public interface CacheStatistics { | ||
|
||
Map<String, TypedValueStatistic> getKnownStatistics(); | ||
|
||
/** | ||
* Reset the values for this cache and its underlying tiers. | ||
* <p> | ||
* <b>Implementation note:</b> Calling clear doesn't really clear the data. It freezes the actual values and compensate | ||
* for them when returning a result. | ||
*/ | ||
void clear(); | ||
|
||
long getCacheHits(); | ||
|
||
float getCacheHitPercentage(); | ||
|
||
long getCacheMisses(); | ||
|
||
float getCacheMissPercentage(); | ||
|
||
long getCacheGets(); | ||
|
||
long getCachePuts(); | ||
|
||
long getCacheRemovals(); | ||
|
||
long getCacheEvictions(); | ||
|
||
float getCacheAverageGetTime(); | ||
|
||
float getCacheAveragePutTime(); | ||
|
||
float getCacheAverageRemoveTime(); | ||
|
||
} |
50 changes: 50 additions & 0 deletions
50
core/src/main/java/org/ehcache/core/statistics/TierStatistics.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright Terracotta, Inc. | ||
* | ||
* 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 org.ehcache.core.statistics; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* All statistics relative to a tier | ||
*/ | ||
public interface TierStatistics { | ||
|
||
Map<String, TypedValueStatistic> getKnownStatistics(); | ||
|
||
/** | ||
* Reset the values for this tier. However, note that {@code mapping, maxMappings, allocatedMemory, occupiedMemory} | ||
* but be reset since it doesn't make sense. | ||
* <p> | ||
* <b>Implementation note:</b> Calling clear doesn't really clear the data. It freezes the actual values and compensate | ||
* for them when returning a result. | ||
*/ | ||
void clear(); | ||
|
||
long getHits(); | ||
|
||
long getMisses(); | ||
|
||
long getEvictions(); | ||
|
||
long getMappings(); | ||
|
||
long getMaxMappings(); | ||
|
||
long getAllocatedByteSize(); | ||
|
||
long getOccupiedByteSize(); | ||
} |
40 changes: 40 additions & 0 deletions
40
core/src/main/java/org/ehcache/core/statistics/TypedValueStatistic.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright Terracotta, Inc. | ||
* | ||
* 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 org.ehcache.core.statistics; | ||
|
||
import org.terracotta.statistics.ValueStatistic; | ||
import org.terracotta.statistics.extended.StatisticType; | ||
|
||
/** | ||
* Represent a {@code ValueStatistic} that knows its {@code StatisticType}. | ||
*/ | ||
public abstract class TypedValueStatistic implements ValueStatistic<Number> { | ||
private final StatisticType type; | ||
|
||
/** | ||
* Type of this value statistic. Can be COUNTER or SIZE. | ||
* | ||
* @param type {@code StatisticType} | ||
*/ | ||
public TypedValueStatistic(StatisticType type) { | ||
this.type = type; | ||
} | ||
|
||
public StatisticType getType() { | ||
return type; | ||
} | ||
} |
Oops, something went wrong.