@Override
    public void pre(SpanAdapter span, Exchange exchange, Endpoint endpoint) {
        super.pre(span, exchange, endpoint);
        span.setTag(TagConstants.DB_SYSTEM, CASSANDRA_DB_TYPE);
        URI uri = URI.create(endpoint.getEndpointUri());
        if (uri.getPath() != null && !uri.getPath().isEmpty()) {
            // Strip leading '/' from path
            span.setTag(TagConstants.DB_NAME, uri.getPath().substring(1));
        }

        String cql = exchange.getIn().getHeader(CAMEL_CQL_QUERY, String.class);
        if (cql != null) {
            span.setTag(TagConstants.DB_STATEMENT, cql);
        } else {
            Map<String, String> queryParameters = toQueryParameters(endpoint.getEndpointUri());
            if (queryParameters.containsKey("cql")) {
                span.setTag(TagConstants.DB_STATEMENT, queryParameters.get("cql"));
            }
        }
    }
@Test
    public void testPreCqlFromHeader() {
        String cql = "select * from users";

        Endpoint endpoint = Mockito.mock(Endpoint.class);
        Exchange exchange = Mockito.mock(Exchange.class);
        Message message = Mockito.mock(Message.class);

        Mockito.when(endpoint.getEndpointUri()).thenReturn("cql://host1,host2?consistencyLevel=quorum");
        Mockito.when(exchange.getIn()).thenReturn(message);
        Mockito.when(message.getHeader(CqlSpanDecorator.CAMEL_CQL_QUERY, String.class)).thenReturn(cql);

        SpanDecorator decorator = new CqlSpanDecorator();

        MockSpanAdapter span = new MockSpanAdapter();

        decorator.pre(span, exchange, endpoint);

        assertEquals(CqlSpanDecorator.CASSANDRA_DB_TYPE, span.tags().get(TagConstants.DB_SYSTEM));
        assertEquals(cql, span.tags().get(TagConstants.DB_STATEMENT));
        assertNull(span.tags().get(TagConstants.DB_NAME));
    }