Allow enabling receive telemetry in kafka library instrumentation (#9693)
This commit is contained in:
parent
48d3956bd8
commit
e7db2c0246
|
@ -30,6 +30,7 @@ public final class KafkaTelemetryBuilder {
|
||||||
private List<String> capturedHeaders = emptyList();
|
private List<String> capturedHeaders = emptyList();
|
||||||
private boolean captureExperimentalSpanAttributes = false;
|
private boolean captureExperimentalSpanAttributes = false;
|
||||||
private boolean propagationEnabled = true;
|
private boolean propagationEnabled = true;
|
||||||
|
private boolean messagingReceiveInstrumentationEnabled = false;
|
||||||
|
|
||||||
KafkaTelemetryBuilder(OpenTelemetry openTelemetry) {
|
KafkaTelemetryBuilder(OpenTelemetry openTelemetry) {
|
||||||
this.openTelemetry = Objects.requireNonNull(openTelemetry);
|
this.openTelemetry = Objects.requireNonNull(openTelemetry);
|
||||||
|
@ -85,11 +86,25 @@ public final class KafkaTelemetryBuilder {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set whether to capture the consumer message receive telemetry in messaging instrumentation.
|
||||||
|
*
|
||||||
|
* <p>Note that this will cause the consumer side to start a new trace, with only a span link
|
||||||
|
* connecting it to the producer trace.
|
||||||
|
*/
|
||||||
|
@CanIgnoreReturnValue
|
||||||
|
public KafkaTelemetryBuilder setMessagingReceiveInstrumentationEnabled(
|
||||||
|
boolean messagingReceiveInstrumentationEnabled) {
|
||||||
|
this.messagingReceiveInstrumentationEnabled = messagingReceiveInstrumentationEnabled;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public KafkaTelemetry build() {
|
public KafkaTelemetry build() {
|
||||||
KafkaInstrumenterFactory instrumenterFactory =
|
KafkaInstrumenterFactory instrumenterFactory =
|
||||||
new KafkaInstrumenterFactory(openTelemetry, INSTRUMENTATION_NAME)
|
new KafkaInstrumenterFactory(openTelemetry, INSTRUMENTATION_NAME)
|
||||||
.setCapturedHeaders(capturedHeaders)
|
.setCapturedHeaders(capturedHeaders)
|
||||||
.setCaptureExperimentalSpanAttributes(captureExperimentalSpanAttributes);
|
.setCaptureExperimentalSpanAttributes(captureExperimentalSpanAttributes)
|
||||||
|
.setMessagingReceiveInstrumentationEnabled(messagingReceiveInstrumentationEnabled);
|
||||||
|
|
||||||
return new KafkaTelemetry(
|
return new KafkaTelemetry(
|
||||||
openTelemetry,
|
openTelemetry,
|
||||||
|
|
|
@ -50,6 +50,12 @@ public final class SpringKafkaTelemetryBuilder {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set whether to capture the consumer message receive telemetry in messaging instrumentation.
|
||||||
|
*
|
||||||
|
* <p>Note that this will cause the consumer side to start a new trace, with only a span link
|
||||||
|
* connecting it to the producer trace.
|
||||||
|
*/
|
||||||
@CanIgnoreReturnValue
|
@CanIgnoreReturnValue
|
||||||
public SpringKafkaTelemetryBuilder setMessagingReceiveInstrumentationEnabled(
|
public SpringKafkaTelemetryBuilder setMessagingReceiveInstrumentationEnabled(
|
||||||
boolean messagingReceiveInstrumentationEnabled) {
|
boolean messagingReceiveInstrumentationEnabled) {
|
||||||
|
|
Loading…
Reference in New Issue