Package io.debezium.transforms.tracing
Class ActivateTracingSpan<R extends org.apache.kafka.connect.connector.ConnectRecord<R>>
- java.lang.Object
-
- io.debezium.transforms.tracing.ActivateTracingSpan<R>
-
- Type Parameters:
R- the subtype ofConnectRecordon which this transformation will operate
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.kafka.common.Configurable,org.apache.kafka.connect.transforms.Transformation<R>
public class ActivateTracingSpan<R extends org.apache.kafka.connect.connector.ConnectRecord<R>> extends Object implements org.apache.kafka.connect.transforms.Transformation<R>
This SMT enables integration with a tracing system. The SMT creates a tracing span and enriches it with metadata from envelope and source info block.
It is possible to connect the span to a parent span created by a business application. The application then needs to export its tracing active span context into a database field. The SMT looks for a predefined field name in theafterblock and when found it extracts the parent span from it.- Author:
- Jiri Pechanec
-
-
Field Summary
Fields Modifier and Type Field Description private static StringDB_FIELDS_PREFIXprivate static StringDEFAULT_TRACING_OPERATION_NAMEprivate static StringDEFAULT_TRACING_SPAN_CONTEXT_FIELDprivate static org.slf4j.LoggerLOGGERprivate static booleanOPEN_TRACING_AVAILABLEprivate StringoperationNameprivate booleanrequireContextFieldprivate SmtManager<R>smtManagerprivate StringspanContextFieldprivate static StringTRACING_COMPONENTstatic FieldTRACING_CONTEXT_FIELD_REQUIREDstatic FieldTRACING_OPERATION_NAMEstatic FieldTRACING_SPAN_CONTEXT_FIELDprivate static StringTX_LOG_WRITE_OPERATION_NAME
-
Constructor Summary
Constructors Constructor Description ActivateTracingSpan()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddFieldToSpan(io.opentracing.Tracer.SpanBuilder span, org.apache.kafka.connect.data.Struct struct, String field, String prefix)Rapply(R record)voidclose()org.apache.kafka.common.config.ConfigDefconfig()voidconfigure(Map<String,?> props)static booleanisOpenTracingAvailable()private static booleanresolveOpenTracingApiAvailable()voidsetRequireContextField(boolean requireContextField)private RtraceRecord(R record, org.apache.kafka.connect.data.Struct envelope, org.apache.kafka.connect.data.Struct source, org.apache.kafka.connect.data.Struct after, String propagatedSpanContext)
-
-
-
Field Detail
-
DB_FIELDS_PREFIX
private static final String DB_FIELDS_PREFIX
- See Also:
- Constant Field Values
-
LOGGER
private static final org.slf4j.Logger LOGGER
-
DEFAULT_TRACING_SPAN_CONTEXT_FIELD
private static final String DEFAULT_TRACING_SPAN_CONTEXT_FIELD
- See Also:
- Constant Field Values
-
DEFAULT_TRACING_OPERATION_NAME
private static final String DEFAULT_TRACING_OPERATION_NAME
- See Also:
- Constant Field Values
-
TRACING_COMPONENT
private static final String TRACING_COMPONENT
- See Also:
- Constant Field Values
-
TX_LOG_WRITE_OPERATION_NAME
private static final String TX_LOG_WRITE_OPERATION_NAME
- See Also:
- Constant Field Values
-
OPEN_TRACING_AVAILABLE
private static final boolean OPEN_TRACING_AVAILABLE
-
TRACING_SPAN_CONTEXT_FIELD
public static final Field TRACING_SPAN_CONTEXT_FIELD
-
TRACING_OPERATION_NAME
public static final Field TRACING_OPERATION_NAME
-
TRACING_CONTEXT_FIELD_REQUIRED
public static final Field TRACING_CONTEXT_FIELD_REQUIRED
-
spanContextField
private String spanContextField
-
operationName
private String operationName
-
requireContextField
private boolean requireContextField
-
smtManager
private SmtManager<R extends org.apache.kafka.connect.connector.ConnectRecord<R>> smtManager
-
-
Method Detail
-
configure
public void configure(Map<String,?> props)
- Specified by:
configurein interfaceorg.apache.kafka.common.Configurable
-
setRequireContextField
public void setRequireContextField(boolean requireContextField)
-
traceRecord
private R traceRecord(R record, org.apache.kafka.connect.data.Struct envelope, org.apache.kafka.connect.data.Struct source, org.apache.kafka.connect.data.Struct after, String propagatedSpanContext)
-
close
public void close()
-
config
public org.apache.kafka.common.config.ConfigDef config()
-
addFieldToSpan
private void addFieldToSpan(io.opentracing.Tracer.SpanBuilder span, org.apache.kafka.connect.data.Struct struct, String field, String prefix)
-
isOpenTracingAvailable
public static boolean isOpenTracingAvailable()
-
resolveOpenTracingApiAvailable
private static boolean resolveOpenTracingApiAvailable()
-
-