-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Otel metrics and traces #460
Changes from all commits
a4caca7
c026588
f3c0077
7fb8e2e
a8ae3d1
da9d36b
06618ca
aba1aab
900bc6d
3746a8e
e0e7bf1
4b43262
322e12f
723bf77
15a1705
8a6f52a
c50e01d
17c517d
6288844
09e849c
9cf2540
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package org.opensearch.migrations.trafficcapture.kafkaoffloader.tracing; | ||
|
||
import io.opentelemetry.api.common.AttributeKey; | ||
import io.opentelemetry.api.common.AttributesBuilder; | ||
import io.opentelemetry.api.trace.Span; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import org.opensearch.migrations.tracing.ISpanWithParentGenerator; | ||
import org.opensearch.migrations.tracing.commoncontexts.IConnectionContext; | ||
import org.opensearch.migrations.tracing.IWithAttributes; | ||
import org.opensearch.migrations.tracing.IWithStartTime; | ||
|
||
import java.time.Instant; | ||
|
||
@AllArgsConstructor | ||
Check warning on line 15 in TrafficCapture/captureKafkaOffloader/src/main/java/org/opensearch/migrations/trafficcapture/kafkaoffloader/tracing/KafkaRecordContext.java Codecov / codecov/patchTrafficCapture/captureKafkaOffloader/src/main/java/org/opensearch/migrations/trafficcapture/kafkaoffloader/tracing/KafkaRecordContext.java#L15
|
||
public class KafkaRecordContext implements IWithAttributes<IConnectionContext>, IWithStartTime { | ||
static final AttributeKey<String> TOPIC_ATTR = AttributeKey.stringKey("topic"); | ||
static final AttributeKey<String> RECORD_ID_ATTR = AttributeKey.stringKey("recordId"); | ||
static final AttributeKey<Long> RECORD_SIZE_ATTR = AttributeKey.longKey("recordSize"); | ||
|
||
@Getter | ||
public final IConnectionContext enclosingScope; | ||
@Getter | ||
Check warning on line 23 in TrafficCapture/captureKafkaOffloader/src/main/java/org/opensearch/migrations/trafficcapture/kafkaoffloader/tracing/KafkaRecordContext.java Codecov / codecov/patchTrafficCapture/captureKafkaOffloader/src/main/java/org/opensearch/migrations/trafficcapture/kafkaoffloader/tracing/KafkaRecordContext.java#L23
|
||
public final Span currentSpan; | ||
@Getter | ||
public final Instant startTime; | ||
@Getter | ||
public final String topic; | ||
@Getter | ||
public final String recordId; | ||
@Getter | ||
public final int recordSize; | ||
|
||
public KafkaRecordContext(IConnectionContext enclosingScope, ISpanWithParentGenerator incomingSpan, | ||
String topic, String recordId, int recordSize) { | ||
this.enclosingScope = enclosingScope; | ||
this.topic = topic; | ||
this.recordId = recordId; | ||
this.recordSize = recordSize; | ||
this.startTime = Instant.now(); | ||
currentSpan = incomingSpan.apply(this.getPopulatedAttributes(), enclosingScope.getCurrentSpan()); | ||
} | ||
|
||
@Override | ||
public AttributesBuilder fillAttributes(AttributesBuilder builder) { | ||
return builder.put(TOPIC_ATTR, getTopic()) | ||
.put(RECORD_ID_ATTR, getRecordId()) | ||
.put(RECORD_SIZE_ATTR, getRecordSize()); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
package org.opensearch.migrations.trafficcapture; | ||
|
||
import org.opensearch.migrations.tracing.commoncontexts.IConnectionContext; | ||
import org.opensearch.migrations.trafficcapture.tracing.ConnectionContext; | ||
|
||
import java.io.IOException; | ||
|
||
public interface IConnectionCaptureFactory<T> { | ||
IChannelConnectionCaptureSerializer<T> createOffloader(String connectionId) throws IOException; | ||
IChannelConnectionCaptureSerializer<T> createOffloader(IConnectionContext ctx, String connectionId) throws IOException; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question as previously, do we need this when coreUtilities already has this dependency?