GithubHelp home page GithubHelp logo

nickitat / ch2speedscope Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 1.99 MB

This utility produces profiles in SpeedScope format from ClickHouse `trace_log`

License: Apache License 2.0

Python 100.00%

ch2speedscope's Introduction

ch2speedscope

This utility transforms ClickHouse profiling facilities output into the speedscope profile format.

The advantage of speedscope comparing to the traditional FlameGraph-s is the "Time Order" visualisation mode that presents call stacks ordered by the time they appear in the profile instead of just a static picture when all the same stacks merged together. This way you could see what the process was busy with in different points in time.

system.trace_log

TL;DR Data in trace_log collected by the sampling profiler. To create an event-based (event is "function foo started executing at the moment t0 and finished at the moment t1") profile we transform each entry (timestamp, trace) (there are more fields, but they're not important now) into an event

([timestamp; timestamp + sampling_period], trace)

, where

sampling_period = min(query_profiler_cpu_time_period_ns, query_profiler_real_time_period_ns).

I.e. we assume that each function started executing at the moment it was observed by the sampling profiler and finished in sampling_period nanoseconds.


trace_log documentation.

Essentially all you need to do is set query_profiler_cpu_time_period_ns and/or query_profiler_real_time_period_ns to a reasonable values. Please also set log_query_threads = 1 - this is needed to display thread names together with thread id-s in output profile.


To have a taste of what you gonna get take a look at this profile: trace_log_aggregation_profile.

Here you can see reading transforms execution alternated by pre-aggregation:

reading

pre-aggregation

And merging happening after this:

merging


Usage:

./trace_log.py -h

Example command:

./trace_log.py -q '<query_id>' --host '<hostname>' --port 9440 --password '<pwd>' --secure --on_cluster default --trace_type 'Real' 'CPU' > profile.json

system.opentelemetry_span_log

opentelemetry_span_log documentation.

TODO: implement support.

ch2speedscope's People

Contributors

nickitat avatar

Stargazers

 avatar

Watchers

 avatar

ch2speedscope's Issues

Finish implementation of `trace_log` source

  • parse parameters from command line
  • don't require query_thread_log to be present
  • support selecting trace type
  • read sample period from query_log
  • allow run without query_id
  • sanity check for revision
  • merge get_demangled_frames and get_frames

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.