Skip to content

Commit

Permalink
Invoke get segment tag only if logger has tracing enabled.
Browse files Browse the repository at this point in the history
Signed-off-by: Juergen Fickel <juergen.fickel@bosch.io>
  • Loading branch information
Juergen Fickel committed Oct 25, 2022
1 parent fffc72c commit 0477748
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,13 @@ private StoppedKamonTimer(final StartedTimer startedTimer) {
}
});

final long durationNano = getElapsedNano();
LOGGER.trace("Timer with name <{}> and segment <{}> was stopped after <{}> nanoseconds",
name,
tags.getTagValue(SEGMENT_TAG).orElse(null),
durationNano);
final var durationNano = getElapsedNano();
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Timer with name <{}> and segment <{}> was stopped after <{}> nanoseconds",
name,
tags.getTagValue(SEGMENT_TAG).orElse(null),
durationNano);
}
startedTimer.getOnStopHandlers().forEach(stoppedTimerConsumer -> stoppedTimerConsumer.handleStoppedTimer(this));
getKamonInternalTimer().record(durationNano);
}
Expand Down

0 comments on commit 0477748

Please sign in to comment.