Add javadoc note about metrics timestamps (#4820)

* Add javadoc note about metrics timestamps

* Move to class level
This commit is contained in:
Trask Stalnaker 2021-12-07 15:35:47 -08:00 committed by GitHub
parent bba587ea01
commit 80790a409d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -142,6 +142,11 @@ public final class InstrumenterBuilder<REQUEST, RESPONSE> {
* Sets the {@link TimeExtractor} to extract the timestamp marking the start and end of
* processing. If unset, the constructed instrumenter will defer determining start and end
* timestamps to the OpenTelemetry SDK.
*
* <p>Note: if metrics are generated by the Instrumenter, the start and end times from the {@link
* TimeExtractor} will be used to generate any duration metrics, but the internal metric timestamp
* (when it occurred) will always be stamped with "now" when the metric is recorded (i.e. there is
* no way to back date a metric recording).
*/
public InstrumenterBuilder<REQUEST, RESPONSE> setTimeExtractor(
TimeExtractor<REQUEST, RESPONSE> timeExtractor) {

View File

@ -8,7 +8,14 @@ package io.opentelemetry.instrumentation.api.instrumenter;
import java.time.Instant;
import javax.annotation.Nullable;
/** Extractor of the start and end times of request processing. */
/**
* Extractor of the start and end times of request processing.
*
* <p>Note: if metrics are generated by the Instrumenter, the start and end times from the {@code
* TimeExtractor} will be used to generate any duration metrics, but the internal metric timestamp
* (when it occurred) will always be stamped with "now" when the metric is recorded (i.e. there is
* no way to back date a metric recording).
*/
public interface TimeExtractor<REQUEST, RESPONSE> {
/** Returns the timestamp marking the start of the request processing. */