-
Notifications
You must be signed in to change notification settings - Fork 828
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge start and end time extractors (#4692)
- Loading branch information
Showing
18 changed files
with
210 additions
and
87 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
21 changes: 0 additions & 21 deletions
21
...api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/EndTimeExtractor.java
This file was deleted.
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
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
20 changes: 0 additions & 20 deletions
20
...i/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/StartTimeExtractor.java
This file was deleted.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
...on-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/TimeExtractor.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,19 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.instrumentation.api.instrumenter; | ||
|
||
import java.time.Instant; | ||
import javax.annotation.Nullable; | ||
|
||
/** Extractor of the start and end times of request processing. */ | ||
public interface TimeExtractor<REQUEST, RESPONSE> { | ||
|
||
/** Returns the timestamp marking the start of the request processing. */ | ||
Instant extractStartTime(REQUEST request); | ||
|
||
/** Returns the timestamp marking the end of the response processing. */ | ||
Instant extractEndTime(REQUEST request, @Nullable RESPONSE response, @Nullable Throwable error); | ||
} |
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
24 changes: 24 additions & 0 deletions
24
...src/main/java/io/opentelemetry/javaagent/instrumentation/jms/JmsMessageTimeExtractor.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,24 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.javaagent.instrumentation.jms; | ||
|
||
import io.opentelemetry.instrumentation.api.instrumenter.TimeExtractor; | ||
import java.time.Instant; | ||
import javax.annotation.Nullable; | ||
|
||
class JmsMessageTimeExtractor implements TimeExtractor<MessageWithDestination, Void> { | ||
|
||
@Override | ||
public Instant extractStartTime(MessageWithDestination request) { | ||
return request.startTime(); | ||
} | ||
|
||
@Override | ||
public Instant extractEndTime( | ||
MessageWithDestination request, @Nullable Void unused, @Nullable Throwable error) { | ||
return request.endTime(); | ||
} | ||
} |
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
24 changes: 24 additions & 0 deletions
24
...main/java/io/opentelemetry/instrumentation/kafka/internal/KafkaConsumerTimeExtractor.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,24 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.instrumentation.kafka.internal; | ||
|
||
import io.opentelemetry.instrumentation.api.instrumenter.TimeExtractor; | ||
import java.time.Instant; | ||
import javax.annotation.Nullable; | ||
|
||
class KafkaConsumerTimeExtractor implements TimeExtractor<ReceivedRecords, Void> { | ||
|
||
@Override | ||
public Instant extractStartTime(ReceivedRecords request) { | ||
return request.startTime(); | ||
} | ||
|
||
@Override | ||
public Instant extractEndTime( | ||
ReceivedRecords request, @Nullable Void unused, @Nullable Throwable error) { | ||
return request.now(); | ||
} | ||
} |
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
26 changes: 26 additions & 0 deletions
26
...entelemetry/javaagent/instrumentation/netty/v3_8/client/NettyConnectionTimeExtractor.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,26 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.javaagent.instrumentation.netty.v3_8.client; | ||
|
||
import io.opentelemetry.instrumentation.api.instrumenter.TimeExtractor; | ||
import io.opentelemetry.javaagent.instrumentation.netty.common.NettyConnectionRequest; | ||
import java.time.Instant; | ||
import javax.annotation.Nullable; | ||
import org.jboss.netty.channel.Channel; | ||
|
||
class NettyConnectionTimeExtractor implements TimeExtractor<NettyConnectionRequest, Channel> { | ||
|
||
@Override | ||
public Instant extractStartTime(NettyConnectionRequest request) { | ||
return request.timer().startTime(); | ||
} | ||
|
||
@Override | ||
public Instant extractEndTime( | ||
NettyConnectionRequest request, @Nullable Channel channel, @Nullable Throwable error) { | ||
return request.timer().now(); | ||
} | ||
} |
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
26 changes: 26 additions & 0 deletions
26
...telemetry/javaagent/instrumentation/netty/common/client/NettyConnectionTimeExtractor.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,26 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.javaagent.instrumentation.netty.common.client; | ||
|
||
import io.netty.channel.Channel; | ||
import io.opentelemetry.instrumentation.api.instrumenter.TimeExtractor; | ||
import io.opentelemetry.javaagent.instrumentation.netty.common.NettyConnectionRequest; | ||
import java.time.Instant; | ||
import javax.annotation.Nullable; | ||
|
||
class NettyConnectionTimeExtractor implements TimeExtractor<NettyConnectionRequest, Channel> { | ||
|
||
@Override | ||
public Instant extractStartTime(NettyConnectionRequest request) { | ||
return request.timer().startTime(); | ||
} | ||
|
||
@Override | ||
public Instant extractEndTime( | ||
NettyConnectionRequest request, @Nullable Channel channel, @Nullable Throwable error) { | ||
return request.timer().now(); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...io/opentelemetry/javaagent/instrumentation/netty/common/client/NettySslTimeExtractor.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,24 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.javaagent.instrumentation.netty.common.client; | ||
|
||
import io.opentelemetry.instrumentation.api.instrumenter.TimeExtractor; | ||
import java.time.Instant; | ||
import javax.annotation.Nullable; | ||
|
||
class NettySslTimeExtractor implements TimeExtractor<NettySslRequest, Void> { | ||
|
||
@Override | ||
public Instant extractStartTime(NettySslRequest request) { | ||
return request.timer().startTime(); | ||
} | ||
|
||
@Override | ||
public Instant extractEndTime( | ||
NettySslRequest request, @Nullable Void unused, @Nullable Throwable error) { | ||
return request.timer().now(); | ||
} | ||
} |
Oops, something went wrong.