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 ofConnectRecord
on 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 theafter
block and when found it extracts the parent span from it.- Author:
- Jiri Pechanec
-
-
Field Summary
Fields Modifier and Type Field Description private static String
DB_FIELDS_PREFIX
private static String
DEFAULT_TRACING_OPERATION_NAME
private static String
DEFAULT_TRACING_SPAN_CONTEXT_FIELD
private static org.slf4j.Logger
LOGGER
private String
operationName
private boolean
requireContextField
private SmtManager<R>
smtManager
private String
spanContextField
private static String
TRACING_COMPONENT
static Field
TRACING_CONTEXT_FIELD_REQUIRED
static Field
TRACING_OPERATION_NAME
static Field
TRACING_SPAN_CONTEXT_FIELD
private static String
TX_LOG_WRITE_OPERATION_NAME
-
Constructor Summary
Constructors Constructor Description ActivateTracingSpan()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
addFieldToSpan(io.opentracing.Tracer.SpanBuilder span, org.apache.kafka.connect.data.Struct struct, String field, String prefix)
R
apply(R record)
void
close()
org.apache.kafka.common.config.ConfigDef
config()
void
configure(Map<String,?> props)
void
setRequireContextField(boolean requireContextField)
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)
-
-
-
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
-
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:
configure
in 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()
-
-