Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Model alternative for jaeger_index table #107

Open
Etienne-Carriere opened this issue Mar 3, 2022 · 1 comment
Open

Model alternative for jaeger_index table #107

Etienne-Carriere opened this issue Mar 3, 2022 · 1 comment

Comments

@Etienne-Carriere
Copy link

On jaeger_index tables, the tags is coded as a nested array with key and values.
It is good for the only usage of Jaeger-query but in our company we are using jaeger also for analytics purposes.
Since Clickhouse 21.3, the Map type (https://clickhouse.com/docs/en/sql-reference/data-types/map/) is available. I think It could be a good alternative to Nested .

Do you have already made some performance (time and storage) tests with Map ?
Could it be an acceptable contribution (with a flag to not activate it by default) ?

@levonet
Copy link
Member

levonet commented Jul 19, 2022

So do I. An alternative way is using tags.value[ indexOf(tags.key, 'some key') ].
I'm not saying that this is the best solution, but it works.
As an example:

CREATE MATERIALIZED VIEW IF NOT EXISTS jaeger.adapter_search_materialized ON CLUSTER '{cluster}'
TO jaeger.adapter_search_local AS SELECT
    timestamp,
    resource,
    argUseCache,
    traceId,
    toDate(_tripDate) AS tripDate,
    tripDirection,
    tripSource,
    toUInt16OrZero(_tripCount) AS tripCount,
    tripSearchId,
    durationUs
FROM (
    SELECT
        timestamp,
        toInt32(tags.value[ indexOf(tags.key, 'resource.code') ]) AS resource,
        toBool(tags.value[ indexOf(tags.key, 'use_cache') ] != 'false') AS argUseCache,
        traceID AS traceId,
        splitByChar(',', tags.value[ indexOf(tags.key, 'trip.date') ]) AS _tripDate,
        splitByChar(',', tags.value[ indexOf(tags.key, 'trip.direction') ]) AS tripDirection,
        splitByChar(',', tags.value[ indexOf(tags.key, 'trip.source') ]) AS tripSource,
        splitByChar(',', tags.value[ indexOf(tags.key, 'trip.count') ]) AS _tripCount,
        tags.value[ indexOf(tags.key, 'trip.search_id') ] AS tripSearchId,
        durationUs
    FROM jaeger.jaeger_index_local
    WHERE operation = 'searchAndWaitResult'
) ARRAY JOIN _tripDate, tripDirection, tripSource, _tripCount

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants