use of com.google.gerrit.server.logging.Metadata in project gerrit by GerritCodeReview.
the class Timer1 method record.
/**
* Record a value in the distribution.
*
* @param fieldValue bucket to record the timer
* @param value value to record
* @param unit time unit of the value
*/
public final void record(F1 fieldValue, long value, TimeUnit unit) {
long durationMs = unit.toMillis(value);
Metadata.Builder metadataBuilder = Metadata.builder();
field.metadataMapper().accept(metadataBuilder, fieldValue);
Metadata metadata = metadataBuilder.build();
if (!suppressLogging) {
LoggingContext.getInstance().addPerformanceLogRecord(() -> PerformanceLogRecord.create(name, durationMs, metadata));
logger.atFinest().log("%s (%s = %s) took %dms", name, field.name(), fieldValue, durationMs);
}
doRecord(fieldValue, value, unit);
RequestStateContext.abortIfCancelled();
}
use of com.google.gerrit.server.logging.Metadata in project gerrit by GerritCodeReview.
the class Timer3 method record.
/**
* Record a value in the distribution.
*
* @param fieldValue1 bucket to record the timer
* @param fieldValue2 bucket to record the timer
* @param fieldValue3 bucket to record the timer
* @param value value to record
* @param unit time unit of the value
*/
public final void record(F1 fieldValue1, F2 fieldValue2, F3 fieldValue3, long value, TimeUnit unit) {
long durationMs = unit.toMillis(value);
Metadata.Builder metadataBuilder = Metadata.builder();
field1.metadataMapper().accept(metadataBuilder, fieldValue1);
field2.metadataMapper().accept(metadataBuilder, fieldValue2);
field3.metadataMapper().accept(metadataBuilder, fieldValue3);
Metadata metadata = metadataBuilder.build();
if (!suppressLogging) {
LoggingContext.getInstance().addPerformanceLogRecord(() -> PerformanceLogRecord.create(name, durationMs, metadata));
logger.atFinest().log("%s (%s = %s, %s = %s, %s = %s) took %dms", name, field1.name(), fieldValue1, field2.name(), fieldValue2, field3.name(), fieldValue3, durationMs);
}
doRecord(fieldValue1, fieldValue2, fieldValue3, value, unit);
RequestStateContext.abortIfCancelled();
}
use of com.google.gerrit.server.logging.Metadata in project gerrit by GerritCodeReview.
the class Timer2 method record.
/**
* Record a value in the distribution.
*
* @param fieldValue1 bucket to record the timer
* @param fieldValue2 bucket to record the timer
* @param value value to record
* @param unit time unit of the value
*/
public final void record(F1 fieldValue1, F2 fieldValue2, long value, TimeUnit unit) {
long durationMs = unit.toMillis(value);
Metadata.Builder metadataBuilder = Metadata.builder();
field1.metadataMapper().accept(metadataBuilder, fieldValue1);
field2.metadataMapper().accept(metadataBuilder, fieldValue2);
Metadata metadata = metadataBuilder.build();
if (!suppressLogging) {
LoggingContext.getInstance().addPerformanceLogRecord(() -> PerformanceLogRecord.create(name, durationMs, metadata));
logger.atFinest().log("%s (%s = %s, %s = %s) took %dms", name, field1.name(), fieldValue1, field2.name(), fieldValue2, durationMs);
}
doRecord(fieldValue1, fieldValue2, value, unit);
RequestStateContext.abortIfCancelled();
}
Aggregations