Skip to content
Draft
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 @@ -44,15 +44,15 @@ class EventKeeperTranslator implements EventKeeper {
// is preloaded with the old names.
static {
eventKeeperMap.put(EventKeeper.Events.JNI_CALL,
new Count("JNI_CALLS", "jni calls", false));
FDBStoreTimer.Counts.JNI_CALLS);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

java.lang.UnsupportedOperationException: Programmer error: Counter(name = jni calls) is not a timer
	at com.apple.foundationdb.relational.recordlayer.util.MetricRegistryStoreTimer$RegistryCounter.record(MetricRegistryStoreTimer.java:108)
	at com.apple.foundationdb.record.provider.common.StoreTimer.record(StoreTimer.java:558)
	at com.apple.foundationdb.record.provider.foundationdb.EventKeeperTranslator.count(EventKeeperTranslator.java:72)
	at com.apple.foundationdb.EventKeeper.increment(EventKeeper.java:46)
	at com.apple.foundationdb.FDBTransaction.closeInternal(FDBTransaction.java:790)
	at com.apple.foundationdb.NativeObjectWrapper.close(NativeObjectWrapper.java:75)
	at com.apple.foundationdb.FDBDatabase.createTransaction(FDBDatabase.java:174)
	at com.apple.foundationdb.record.provider.foundationdb.FDBDatabase.createTransaction(FDBDatabase.java:784)
	at com.apple.foundationdb.record.provider.foundationdb.FDBDatabase.openContext(FDBDatabase.java:449)
	at com.apple.foundationdb.relational.recordlayer.RecordLayerTransactionManager.createTransaction(RecordLayerTransactionManager.java:49)
	at com.apple.foundationdb.relational.server.FRL.<init>(FRL.java:105)
	at com.apple.foundationdb.relational.yamltests.configs.EmbeddedConfig.beforeAll(EmbeddedConfig.java:52)
	at CustomTagTest.beforeAll(CustomTagTest.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I tracked this down. The error isn't that JNI_CALLS shouldn't be a COUNT. The error is that the logic that was supposed to figure out if it was a count or not was using the wrong class/interface. Fix here: 7e6b582

eventKeeperMap.put(EventKeeper.Events.RANGE_QUERY_FETCHES,
new Count("RANGE_FETCHES", "range fetches", false));
FDBStoreTimer.Counts.RANGE_FETCHES);
eventKeeperMap.put(EventKeeper.Events.RANGE_QUERY_RECORDS_FETCHED,
new Count("RANGE_KEYVALUES_FETCHED", "range key-values ", false));
FDBStoreTimer.Counts.RANGE_KEYVALUES_FETCHED);
eventKeeperMap.put(EventKeeper.Events.RANGE_QUERY_CHUNK_FAILED,
new Count("CHUNK_READ_FAILURES", "read fails", false));
FDBStoreTimer.Counts.CHUNK_READ_FAILURES);
eventKeeperMap.put(EventKeeper.Events.RANGE_QUERY_FETCH_TIME_NANOS,
new Event("FETCHES", "fetches"));
FDBStoreTimer.Events.FETCHES);
}

@Nullable
Expand All @@ -66,7 +66,7 @@ public EventKeeperTranslator(@Nullable final StoreTimer underlying) {
public void count(final EventKeeper.Event event, final long amount) {
if (underlying != null) {
StoreTimer.Event storeTimerEvent = getEvent(event);
if (storeTimerEvent instanceof Count) {
if (storeTimerEvent instanceof StoreTimer.Count) {
underlying.increment((StoreTimer.Count) storeTimerEvent, (int) amount);
} else {
underlying.record(storeTimerEvent, amount);
Expand Down Expand Up @@ -97,6 +97,9 @@ public long getTimeNanos(final EventKeeper.Event event) {

private static StoreTimer.Event getEvent(EventKeeper.Event event) {
return eventKeeperMap.computeIfAbsent(event, keeperEvent -> {
// If the EventKeeper event is not mapped cleanly to a predefined event in the map, create one
// This may be a bad idea. It's possible we'd want to rely solely on a predefined set of
// events known at compile time and then ignore any events we don't know about
final String name = event.name();
final String title = event.name().toLowerCase(Locale.ROOT).replace('_', ' ');
if (event.isTimeEvent()) {
Expand Down
Loading