Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ jobs:
# musl for static binaries
rustup target add x86_64-unknown-linux-musl

- name: Run tests
run: make test

- name: Build
run: |
set -x
Expand Down Expand Up @@ -101,6 +104,8 @@ jobs:
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Run tests
run: make test
- name: Build
run: |
cargo build --no-default-features
Expand Down
27 changes: 25 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,18 @@ syntect = { version = "*", default-features = false, features = ["default-syntax
# Drivers
#
# Patches:
# - rustls
# - no panic on broken protocol
clickhouse-rs = { git = "https://github.com/azat-rust/clickhouse-rs", branch = "mTLS", default-features = false, features = ["tokio_io"] }
# - https://github.com/suharev7/clickhouse-rs/pull/226 - Properly handle terminated connection by the server and fix CI
# - https://github.com/suharev7/clickhouse-rs/pull/227 - mTLS
clickhouse-rs = { git = "https://github.com/azat-rust/clickhouse-rs", branch = "next", default-features = false, features = ["tokio_io"] }
tokio = { version = "*", default-features = false, features = ["macros"] }
# Flamegraphs
flamelens = { version = "0.3.1", default-features = false }
ratatui = { version = "0.26.3", features = ["unstable-rendered-line-info"] }
crossterm = { version = "0.27.0", features = ["use-dev-tty"] }

[dev-dependencies]
pretty_assertions = { version= "*", default-features = false, features = ["alloc"] }

[profile.release]
# Too slow and does not worth it
lto = false
Expand Down
57 changes: 36 additions & 21 deletions Documentation/FAQ.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
### What is format of the URL accepted by `chdig`?

The simplest form is just - **`localhost`**

For a secure connections with user and password _(note: passing the password on
the command line is not safe)_, use:

```sh
chdig -u 'user:password@clickhouse-host.com/?secure=true'
```

A full list of supported connection options is available [here](https://github.com/azat-rust/clickhouse-rs/?tab=readme-ov-file#dns).

_Note: This link currently points to my fork, as some changes have not yet been accepted upstream._

### Environment variables

A safer way to pass the password is via environment variables:


```sh
export CLICKHOUSE_USER='user'
export CLICKHOUSE_PASSWORD='password'
chdig -u 'clickhouse-host.com/?secure=true'
# or specify the port explicitly
chdig -u 'clickhouse-host.com:9440/?secure=true'
```

### What is --connection?

`--connection` allows you to use predefined connections, that is supported by
Expand All @@ -15,6 +43,9 @@ Here is an example in `XML` format:
<password>secret</password>
<!-- <secure>false</secure> -->
<!-- <skip_verify>false</skip_verify> -->
<!-- <ca_certificate></ca_certificate> -->
<!-- <client_certificate></client_certificate> -->
<!-- <client_private_key></client_private_key> -->
</connection>
</connections_credentials>
</clickhouse>
Expand All @@ -30,6 +61,11 @@ connections_credentials:
hostname: prod
user: default
password: secret
# secure: false
# skip_verify: false
# ca_certificate:
# client_certificate:
# client_private_key:
```

And later, instead of specifying `--url` (with password in plain-text, which is
Expand Down Expand Up @@ -92,27 +128,6 @@ highly not recommended), you can use `chdig --connection prod`.
| | **n**/**N** | Move to next/previous match |
| Extended Navigation | **Home** | reset selection/follow item in table |

### What is format of the URL accepted by `chdig`?

Example for secure connection with all default connection settings & user name
& password (passing the password in the command line is unsafe)

```sh
chdig -u 'user:password@clickhouse-host.com:9440/?secure=true&skip_verify=false&compression=lz4&query_timeout=600s&connection_timeout=5s'
```

Safer option is to pass the password via the environment variable:

```sh
export CLICKHOUSE_USER='user'
export CLICKHOUSE_PASSWORD='password'
chdig -u 'clickhouse-host.com/?secure=true'
# or with port
chdig -u 'clickhouse-host.com:9440/?secure=true'
```

Or via the configuration file (see above)

### Why I see IO wait reported as zero?

- You should ensure that ClickHouse uses one of taskstat gathering methods:
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ run: chdig

build: chdig deploy-binary

test:
cargo test $(cargo_build_opts)

build_completion: chdig
cargo run $(cargo_build_opts) -- --completion bash > target/chdig.bash-completion

Expand Down
Loading