Search in sources :

Example 1 with TypeCodecImpl

use of zipkin.storage.cassandra3.Schema.TypeCodecImpl in project zipkin by openzipkin.

the class DefaultSessionFactory method initializeUDTs.

private static void initializeUDTs(Session session) {
    Schema.ensureExists(DEFAULT_KEYSPACE + "_udts", session);
    MappingManager mapping = new MappingManager(session);
    // The UDTs are hardcoded against the zipkin keyspace.
    // If a different keyspace is being used the codecs must be re-applied to this different keyspace
    TypeCodec<TraceIdUDT> traceIdCodec = mapping.udtCodec(TraceIdUDT.class);
    TypeCodec<EndpointUDT> endpointCodec = mapping.udtCodec(EndpointUDT.class);
    TypeCodec<AnnotationUDT> annoCodec = mapping.udtCodec(AnnotationUDT.class);
    TypeCodec<BinaryAnnotationUDT> bAnnoCodec = mapping.udtCodec(BinaryAnnotationUDT.class);
    KeyspaceMetadata keyspace = session.getCluster().getMetadata().getKeyspace(session.getLoggedKeyspace());
    session.getCluster().getConfiguration().getCodecRegistry().register(new TypeCodecImpl(keyspace.getUserType("trace_id"), TraceIdUDT.class, traceIdCodec)).register(new TypeCodecImpl(keyspace.getUserType("endpoint"), EndpointUDT.class, endpointCodec)).register(new TypeCodecImpl(keyspace.getUserType("annotation"), AnnotationUDT.class, annoCodec)).register(new TypeCodecImpl(keyspace.getUserType("binary_annotation"), BinaryAnnotationUDT.class, bAnnoCodec));
}
Also used : EndpointUDT(zipkin.storage.cassandra3.Schema.EndpointUDT) TypeCodecImpl(zipkin.storage.cassandra3.Schema.TypeCodecImpl) MappingManager(com.datastax.driver.mapping.MappingManager) BinaryAnnotationUDT(zipkin.storage.cassandra3.Schema.BinaryAnnotationUDT) AnnotationUDT(zipkin.storage.cassandra3.Schema.AnnotationUDT) BinaryAnnotationUDT(zipkin.storage.cassandra3.Schema.BinaryAnnotationUDT) KeyspaceMetadata(com.datastax.driver.core.KeyspaceMetadata) TraceIdUDT(zipkin.storage.cassandra3.Schema.TraceIdUDT)

Aggregations

KeyspaceMetadata (com.datastax.driver.core.KeyspaceMetadata)1 MappingManager (com.datastax.driver.mapping.MappingManager)1 AnnotationUDT (zipkin.storage.cassandra3.Schema.AnnotationUDT)1 BinaryAnnotationUDT (zipkin.storage.cassandra3.Schema.BinaryAnnotationUDT)1 EndpointUDT (zipkin.storage.cassandra3.Schema.EndpointUDT)1 TraceIdUDT (zipkin.storage.cassandra3.Schema.TraceIdUDT)1 TypeCodecImpl (zipkin.storage.cassandra3.Schema.TypeCodecImpl)1