diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index afd70250c4..2781d2a0c6 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -2,5 +2,6 @@ # Owners are automatically requested for review for PRs that changes code # that they own. * @ankitnayan -/frontend/ @palash-signoz @pranshuchittora +/frontend/ @palashgdev @pranshuchittora /deploy/ @prashant-shahi +/pkg/query-service/ @srikanthccv @makeavish @nityanandagohain diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f9096698cc..8f346bf882 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -17,6 +17,8 @@ jobs: run: cd frontend && yarn install - name: Run ESLint run: cd frontend && npm run lint + - name: Run Jest + run: cd frontend && npm run jest - name: TSC run: yarn tsc working-directory: ./frontend diff --git a/deploy/docker-swarm/clickhouse-setup/clickhouse-config.xml b/deploy/docker-swarm/clickhouse-setup/clickhouse-config.xml index 7a5f40d299..3bb26a3a36 100644 --- a/deploy/docker-swarm/clickhouse-setup/clickhouse-config.xml +++ b/deploy/docker-swarm/clickhouse-setup/clickhouse-config.xml @@ -1,137 +1,567 @@ - + + - information - 1 + + trace + /var/log/clickhouse-server/clickhouse-server.log + /var/log/clickhouse-server/clickhouse-server.err.log + + 1000M + 10 + + + + + + + + + + + + + + + 8123 + + 9000 - - + + 9004 - - - - - /etc/clickhouse-server/server.crt - /etc/clickhouse-server/server.key - - /etc/clickhouse-server/dhparam.pem - none - true - true - sslv2,sslv3 - true - + + 9005 - - true - true - sslv2,sslv3 - true - - - - RejectCertificateHandler - - - + + - - + + + + - - + + 9009 - -9009 + + + If not specified, then it is determined analogous to 'hostname -f' command. + This setting could be used to switch replication to another network interface + (the server may be connected to multiple networks via multiple addresses) + --> + + example.clickhouse.com + --> - -:: - - + + - - + + -4096 -3 - -100 + + + + + + + + + + + + + + + 4096 + + + 3 + + + + + false + + + /path/to/ssl_cert_file + /path/to/ssl_key_file + + + false + + + /path/to/ssl_ca_cert_file + + + none + + + 0 + + + -1 + -1 + + + false + + + + + + + /etc/clickhouse-server/server.crt + /etc/clickhouse-server/server.key + + + none + true + true + sslv2,sslv3 + true + + + + true + true + sslv2,sslv3 + true + + + + RejectCertificateHandler + + + + + + + + + 100 + + + 0 + + + + 10000 + + + + + + 0.9 + + + 4194304 + + + 0 + correct maximum value. --> - 8589934592 + + Note: uncompressed cache can be pointless for lz4, because memory bandwidth + is slower than multi-core decompression on some server configurations. + Enabling it can sometimes paradoxically make queries slower. + --> + 8589934592 - 5368709120 + --> + 5368709120 - - /var/lib/clickhouse/ + + 1000 - - /var/lib/clickhouse/tmp/ + + 134217728 - - users.xml + + 10000 - - default + + /var/lib/clickhouse/ - - default + + /var/lib/clickhouse/tmp/ + + + + ` + + + + + + /var/lib/clickhouse/user_files/ + + + + + + + + + + + + + users.xml + + + + /var/lib/clickhouse/access/ + + + + + + + default + + + + + + + + + + + + default - + Example: Zulu is an alias for UTC. + --> + - + --> + + + + true + + + false + + ' | sed -e 's|.*>\(.*\)<.*|\1|') + wget https://github.com/ClickHouse/clickhouse-jdbc-bridge/releases/download/v$PKG_VER/clickhouse-jdbc-bridge_$PKG_VER-1_all.deb + apt install --no-install-recommends -f ./clickhouse-jdbc-bridge_$PKG_VER-1_all.deb + clickhouse-jdbc-bridge & + + * [CentOS/RHEL] + export MVN_URL=https://repo1.maven.org/maven2/ru/yandex/clickhouse/clickhouse-jdbc-bridge + export PKG_VER=$(curl -sL $MVN_URL/maven-metadata.xml | grep '' | sed -e 's|.*>\(.*\)<.*|\1|') + wget https://github.com/ClickHouse/clickhouse-jdbc-bridge/releases/download/v$PKG_VER/clickhouse-jdbc-bridge-$PKG_VER-1.noarch.rpm + yum localinstall -y clickhouse-jdbc-bridge-$PKG_VER-1.noarch.rpm + clickhouse-jdbc-bridge & + + Please refer to https://github.com/ClickHouse/clickhouse-jdbc-bridge#usage for more information. + ]]> + - + https://clickhouse.com/docs/en/operations/table_engines/distributed/ + --> + + + + + + + + + + + localhost + 9000 + + + + + + + + false + + 127.0.0.1 + 9000 + + + 127.0.0.2 + 9000 + + + 127.0.0.3 + 9000 + + + + + + + + localhost + 9000 + + + + + localhost + 9000 + + + + + + + 127.0.0.1 + 9000 + + + + + 127.0.0.2 + 9000 + + + + + + true + + 127.0.0.1 + 9000 + + + + true + + 127.0.0.2 + 9000 + + + + + + + localhost + 9440 + 1 + + + + localhost 9000 - + + + localhost + 1 + + + + + + + + + + Values for substitutions are specified in /clickhouse/name_of_substitution elements in that file. + --> - + See https://clickhouse.com/docs/en/engines/table-engines/mergetree-family/replication/ + --> + + - + See https://clickhouse.com/docs/en/engines/table-engines/mergetree-family/replication/#creating-replicated-tables + --> + - - 3600 + + 3600 - - 3600 + + 3600 - - 60 + + 60 - + + --> + + + - + true + true + true + true + + --> + + + + system + query_log
+ + toYYYYMM(event_date) + + + - system - query_log
- - 7500 -
+ + 7500 +
+ + + system + trace_log
- + + system + query_thread_log
+ toYYYYMM(event_date) + 7500 +
+ + + + system + query_views_log
+ toYYYYMM(event_date) + 7500 +
+ + system part_log
- + toYYYYMM(event_date) 7500
---> + + + + + + system + metric_log
+ 7500 + 1000 +
+ + + + system + asynchronous_metric_log
+ + 7000 +
+ + + + + + engine MergeTree + partition by toYYYYMM(finish_date) + order by (finish_date, finish_time_us, trace_id) + + system + opentelemetry_span_log
+ 7500 +
- + + + system + crash_log
- - + + 1000 +
- - + + + + + + system + processors_profile_log
+ + toYYYYMM(event_date) + 7500 +
+ + + + + + - *_dictionary.xml + https://clickhouse.com/docs/en/sql-reference/dictionaries/external-dictionaries/external-dicts + --> + *_dictionary.xml + + + *_function.xml - + --> - + + + + + + + + + + + + + + + + + + + + + + + + + Works only if ZooKeeper is enabled. Comment it if such functionality isn't required. --> /clickhouse/task_queue/ddl + + + + + + + + + + + + + + + + + @@ -304,239 +1149,156 @@ 5 ---> + --> - + --> + + - - - + + - ^carbon\. + click_cost any 0 + 3600 + + + 86400 60 - - 7776000 - 3600 - - - 10368000 - 21600 - - - 34560000 - 43200 - - - 63072000 - 86400 - - - 94608000 - 604800 - - - - ^collectd\. - any - - 0 - 10 - - - 43200 - 60 - - - 864000 - 900 - - - 1728000 - 1800 - - - 3456000 - 3600 - - - 10368000 - 21600 - - - 34560000 - 43200 - - - 63072000 - 86400 - - - 94608000 - 604800 - - - - - ^high\. - any - - 0 - 10 - - - 172800 - 60 - - - 864000 - 900 - - - 1728000 - 1800 - - - 3456000 - 3600 - - - 10368000 - 21600 - - - 34560000 - 43200 - - - 63072000 - 86400 - - - 94608000 - 604800 - - - - - ^medium\. - any - - 0 - 60 - - - 864000 - 900 - - - 1728000 - 1800 - - - 3456000 - 3600 - - - 10368000 - 21600 - - - 34560000 - 43200 - - - 63072000 - 86400 - - - 94608000 - 604800 - - - - - ^low\. - any - - 0 - 600 - - - 15552000 - 1800 - - - 31536000 - 3600 - - - 63072000 - 21600 - - - 126144000 - 43200 - - - 252288000 - 86400 - - - 315360000 - 604800 - - - - any + max 0 60 - 864000 - 900 + 3600 + 300 - 1728000 - 1800 - - - 3456000 + 86400 3600 - - 10368000 - 21600 - - - 34560000 - 43200 - - - 63072000 - 86400 - - - 94608000 - 604800 - - + - /var/lib/clickhouse/format_schemas/ -
+ --> + /var/lib/clickhouse/format_schemas/ + + + + + hide encrypt/decrypt arguments + ((?:aes_)?(?:encrypt|decrypt)(?:_mysql)?)\s*\(\s*(?:'(?:\\'|.)+'|.*?)\s*\) + + \1(???) + + + + + + + + + + false + + false + + + https://6f33034cfe684dd7a3ab9875e57b1c8d@o388870.ingest.sentry.io/5226277 + + + + + + + + + + + 268435456 + true + + diff --git a/deploy/docker-swarm/clickhouse-setup/clickhouse-storage.xml b/deploy/docker-swarm/clickhouse-setup/clickhouse-storage.xml new file mode 100644 index 0000000000..aab0c15da7 --- /dev/null +++ b/deploy/docker-swarm/clickhouse-setup/clickhouse-storage.xml @@ -0,0 +1,28 @@ + + + + + + 10485760 + + + s3 + https://BUCKET-NAME.s3.amazonaws.com/data/ + ACCESS-KEY-ID + SECRET-ACCESS-KEY + + + + + + + default + + + s3 + + + + + + diff --git a/deploy/docker-swarm/clickhouse-setup/clickhouse-users.xml b/deploy/docker-swarm/clickhouse-setup/clickhouse-users.xml new file mode 100644 index 0000000000..f18562071d --- /dev/null +++ b/deploy/docker-swarm/clickhouse-setup/clickhouse-users.xml @@ -0,0 +1,123 @@ + + + + + + + + + + 10000000000 + + + random + + + + + 1 + + + + + + + + + + + + + ::/0 + + + + default + + + default + + + + + + + + + + + + + + 3600 + + + 0 + 0 + 0 + 0 + 0 + + + + diff --git a/deploy/docker-swarm/clickhouse-setup/docker-compose.yaml b/deploy/docker-swarm/clickhouse-setup/docker-compose.yaml index bc58e956b5..45b4137d11 100644 --- a/deploy/docker-swarm/clickhouse-setup/docker-compose.yaml +++ b/deploy/docker-swarm/clickhouse-setup/docker-compose.yaml @@ -2,12 +2,14 @@ version: "3.9" services: clickhouse: - image: yandex/clickhouse-server:21.12.3.32 + image: clickhouse/clickhouse-server:22.4.5-alpine # ports: # - "9000:9000" # - "8123:8123" volumes: - ./clickhouse-config.xml:/etc/clickhouse-server/config.xml + - ./clickhouse-users.xml:/etc/clickhouse-server/users.xml + # - ./clickhouse-storage.xml:/etc/clickhouse-server/config.d/storage.xml - ./data/clickhouse/:/var/lib/clickhouse/ deploy: restart_policy: diff --git a/deploy/docker/clickhouse-setup/clickhouse-config.xml b/deploy/docker/clickhouse-setup/clickhouse-config.xml index 7a5f40d299..3bb26a3a36 100644 --- a/deploy/docker/clickhouse-setup/clickhouse-config.xml +++ b/deploy/docker/clickhouse-setup/clickhouse-config.xml @@ -1,137 +1,567 @@ - + + - information - 1 + + trace + /var/log/clickhouse-server/clickhouse-server.log + /var/log/clickhouse-server/clickhouse-server.err.log + + 1000M + 10 + + + + + + + + + + + + + + + 8123 + + 9000 - - + + 9004 - - - - - /etc/clickhouse-server/server.crt - /etc/clickhouse-server/server.key - - /etc/clickhouse-server/dhparam.pem - none - true - true - sslv2,sslv3 - true - + + 9005 - - true - true - sslv2,sslv3 - true - - - - RejectCertificateHandler - - - + + - - + + + + - - + + 9009 - -9009 + + + If not specified, then it is determined analogous to 'hostname -f' command. + This setting could be used to switch replication to another network interface + (the server may be connected to multiple networks via multiple addresses) + --> + + example.clickhouse.com + --> - -:: - - + + - - + + -4096 -3 - -100 + + + + + + + + + + + + + + + 4096 + + + 3 + + + + + false + + + /path/to/ssl_cert_file + /path/to/ssl_key_file + + + false + + + /path/to/ssl_ca_cert_file + + + none + + + 0 + + + -1 + -1 + + + false + + + + + + + /etc/clickhouse-server/server.crt + /etc/clickhouse-server/server.key + + + none + true + true + sslv2,sslv3 + true + + + + true + true + sslv2,sslv3 + true + + + + RejectCertificateHandler + + + + + + + + + 100 + + + 0 + + + + 10000 + + + + + + 0.9 + + + 4194304 + + + 0 + correct maximum value. --> - 8589934592 + + Note: uncompressed cache can be pointless for lz4, because memory bandwidth + is slower than multi-core decompression on some server configurations. + Enabling it can sometimes paradoxically make queries slower. + --> + 8589934592 - 5368709120 + --> + 5368709120 - - /var/lib/clickhouse/ + + 1000 - - /var/lib/clickhouse/tmp/ + + 134217728 - - users.xml + + 10000 - - default + + /var/lib/clickhouse/ - - default + + /var/lib/clickhouse/tmp/ + + + + ` + + + + + + /var/lib/clickhouse/user_files/ + + + + + + + + + + + + + users.xml + + + + /var/lib/clickhouse/access/ + + + + + + + default + + + + + + + + + + + + default - + Example: Zulu is an alias for UTC. + --> + - + --> + + + + true + + + false + + ' | sed -e 's|.*>\(.*\)<.*|\1|') + wget https://github.com/ClickHouse/clickhouse-jdbc-bridge/releases/download/v$PKG_VER/clickhouse-jdbc-bridge_$PKG_VER-1_all.deb + apt install --no-install-recommends -f ./clickhouse-jdbc-bridge_$PKG_VER-1_all.deb + clickhouse-jdbc-bridge & + + * [CentOS/RHEL] + export MVN_URL=https://repo1.maven.org/maven2/ru/yandex/clickhouse/clickhouse-jdbc-bridge + export PKG_VER=$(curl -sL $MVN_URL/maven-metadata.xml | grep '' | sed -e 's|.*>\(.*\)<.*|\1|') + wget https://github.com/ClickHouse/clickhouse-jdbc-bridge/releases/download/v$PKG_VER/clickhouse-jdbc-bridge-$PKG_VER-1.noarch.rpm + yum localinstall -y clickhouse-jdbc-bridge-$PKG_VER-1.noarch.rpm + clickhouse-jdbc-bridge & + + Please refer to https://github.com/ClickHouse/clickhouse-jdbc-bridge#usage for more information. + ]]> + - + https://clickhouse.com/docs/en/operations/table_engines/distributed/ + --> + + + + + + + + + + + localhost + 9000 + + + + + + + + false + + 127.0.0.1 + 9000 + + + 127.0.0.2 + 9000 + + + 127.0.0.3 + 9000 + + + + + + + + localhost + 9000 + + + + + localhost + 9000 + + + + + + + 127.0.0.1 + 9000 + + + + + 127.0.0.2 + 9000 + + + + + + true + + 127.0.0.1 + 9000 + + + + true + + 127.0.0.2 + 9000 + + + + + + + localhost + 9440 + 1 + + + + localhost 9000 - + + + localhost + 1 + + + + + + + + + + Values for substitutions are specified in /clickhouse/name_of_substitution elements in that file. + --> - + See https://clickhouse.com/docs/en/engines/table-engines/mergetree-family/replication/ + --> + + - + See https://clickhouse.com/docs/en/engines/table-engines/mergetree-family/replication/#creating-replicated-tables + --> + - - 3600 + + 3600 - - 3600 + + 3600 - - 60 + + 60 - + + --> + + + - + true + true + true + true + + --> + + + + system + query_log
+ + toYYYYMM(event_date) + + + - system - query_log
- - 7500 -
+ + 7500 +
+ + + system + trace_log
- + + system + query_thread_log
+ toYYYYMM(event_date) + 7500 +
+ + + + system + query_views_log
+ toYYYYMM(event_date) + 7500 +
+ + system part_log
- + toYYYYMM(event_date) 7500
---> + + + + + + system + metric_log
+ 7500 + 1000 +
+ + + + system + asynchronous_metric_log
+ + 7000 +
+ + + + + + engine MergeTree + partition by toYYYYMM(finish_date) + order by (finish_date, finish_time_us, trace_id) + + system + opentelemetry_span_log
+ 7500 +
- + + + system + crash_log
- - + + 1000 +
- - + + + + + + system + processors_profile_log
+ + toYYYYMM(event_date) + 7500 +
+ + + + + + - *_dictionary.xml + https://clickhouse.com/docs/en/sql-reference/dictionaries/external-dictionaries/external-dicts + --> + *_dictionary.xml + + + *_function.xml - + --> - + + + + + + + + + + + + + + + + + + + + + + + + + Works only if ZooKeeper is enabled. Comment it if such functionality isn't required. --> /clickhouse/task_queue/ddl + + + + + + + + + + + + + + + + + @@ -304,239 +1149,156 @@ 5 ---> + --> - + --> + + - - - + + - ^carbon\. + click_cost any 0 + 3600 + + + 86400 60 - - 7776000 - 3600 - - - 10368000 - 21600 - - - 34560000 - 43200 - - - 63072000 - 86400 - - - 94608000 - 604800 - - - - ^collectd\. - any - - 0 - 10 - - - 43200 - 60 - - - 864000 - 900 - - - 1728000 - 1800 - - - 3456000 - 3600 - - - 10368000 - 21600 - - - 34560000 - 43200 - - - 63072000 - 86400 - - - 94608000 - 604800 - - - - - ^high\. - any - - 0 - 10 - - - 172800 - 60 - - - 864000 - 900 - - - 1728000 - 1800 - - - 3456000 - 3600 - - - 10368000 - 21600 - - - 34560000 - 43200 - - - 63072000 - 86400 - - - 94608000 - 604800 - - - - - ^medium\. - any - - 0 - 60 - - - 864000 - 900 - - - 1728000 - 1800 - - - 3456000 - 3600 - - - 10368000 - 21600 - - - 34560000 - 43200 - - - 63072000 - 86400 - - - 94608000 - 604800 - - - - - ^low\. - any - - 0 - 600 - - - 15552000 - 1800 - - - 31536000 - 3600 - - - 63072000 - 21600 - - - 126144000 - 43200 - - - 252288000 - 86400 - - - 315360000 - 604800 - - - - any + max 0 60 - 864000 - 900 + 3600 + 300 - 1728000 - 1800 - - - 3456000 + 86400 3600 - - 10368000 - 21600 - - - 34560000 - 43200 - - - 63072000 - 86400 - - - 94608000 - 604800 - - + - /var/lib/clickhouse/format_schemas/ -
+ --> + /var/lib/clickhouse/format_schemas/ + + + + + hide encrypt/decrypt arguments + ((?:aes_)?(?:encrypt|decrypt)(?:_mysql)?)\s*\(\s*(?:'(?:\\'|.)+'|.*?)\s*\) + + \1(???) + + + + + + + + + + false + + false + + + https://6f33034cfe684dd7a3ab9875e57b1c8d@o388870.ingest.sentry.io/5226277 + + + + + + + + + + + 268435456 + true + + diff --git a/deploy/docker/clickhouse-setup/clickhouse-storage.xml b/deploy/docker/clickhouse-setup/clickhouse-storage.xml new file mode 100644 index 0000000000..aab0c15da7 --- /dev/null +++ b/deploy/docker/clickhouse-setup/clickhouse-storage.xml @@ -0,0 +1,28 @@ + + + + + + 10485760 + + + s3 + https://BUCKET-NAME.s3.amazonaws.com/data/ + ACCESS-KEY-ID + SECRET-ACCESS-KEY + + + + + + + default + + + s3 + + + + + + diff --git a/deploy/docker/clickhouse-setup/clickhouse-users.xml b/deploy/docker/clickhouse-setup/clickhouse-users.xml new file mode 100644 index 0000000000..f18562071d --- /dev/null +++ b/deploy/docker/clickhouse-setup/clickhouse-users.xml @@ -0,0 +1,123 @@ + + + + + + + + + + 10000000000 + + + random + + + + + 1 + + + + + + + + + + + + + ::/0 + + + + default + + + default + + + + + + + + + + + + + + 3600 + + + 0 + 0 + 0 + 0 + 0 + + + + diff --git a/deploy/docker/clickhouse-setup/config.xml b/deploy/docker/clickhouse-setup/config.xml new file mode 100644 index 0000000000..3bb26a3a36 --- /dev/null +++ b/deploy/docker/clickhouse-setup/config.xml @@ -0,0 +1,1304 @@ + + + + + + trace + /var/log/clickhouse-server/clickhouse-server.log + /var/log/clickhouse-server/clickhouse-server.err.log + + 1000M + 10 + + + + + + + + + + + + + + + + + + 8123 + + + 9000 + + + 9004 + + + 9005 + + + + + + + + + + + + 9009 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 4096 + + + 3 + + + + + false + + + /path/to/ssl_cert_file + /path/to/ssl_key_file + + + false + + + /path/to/ssl_ca_cert_file + + + none + + + 0 + + + -1 + -1 + + + false + + + + + + + /etc/clickhouse-server/server.crt + /etc/clickhouse-server/server.key + + + none + true + true + sslv2,sslv3 + true + + + + true + true + sslv2,sslv3 + true + + + + RejectCertificateHandler + + + + + + + + + 100 + + + 0 + + + + 10000 + + + + + + 0.9 + + + 4194304 + + + 0 + + + + + + 8589934592 + + + 5368709120 + + + + 1000 + + + 134217728 + + + 10000 + + + /var/lib/clickhouse/ + + + /var/lib/clickhouse/tmp/ + + + + ` + + + + + + /var/lib/clickhouse/user_files/ + + + + + + + + + + + + + users.xml + + + + /var/lib/clickhouse/access/ + + + + + + + default + + + + + + + + + + + + default + + + + + + + + + true + + + false + + ' | sed -e 's|.*>\(.*\)<.*|\1|') + wget https://github.com/ClickHouse/clickhouse-jdbc-bridge/releases/download/v$PKG_VER/clickhouse-jdbc-bridge_$PKG_VER-1_all.deb + apt install --no-install-recommends -f ./clickhouse-jdbc-bridge_$PKG_VER-1_all.deb + clickhouse-jdbc-bridge & + + * [CentOS/RHEL] + export MVN_URL=https://repo1.maven.org/maven2/ru/yandex/clickhouse/clickhouse-jdbc-bridge + export PKG_VER=$(curl -sL $MVN_URL/maven-metadata.xml | grep '' | sed -e 's|.*>\(.*\)<.*|\1|') + wget https://github.com/ClickHouse/clickhouse-jdbc-bridge/releases/download/v$PKG_VER/clickhouse-jdbc-bridge-$PKG_VER-1.noarch.rpm + yum localinstall -y clickhouse-jdbc-bridge-$PKG_VER-1.noarch.rpm + clickhouse-jdbc-bridge & + + Please refer to https://github.com/ClickHouse/clickhouse-jdbc-bridge#usage for more information. + ]]> + + + + + + + + + + + + + + + + localhost + 9000 + + + + + + + + false + + 127.0.0.1 + 9000 + + + 127.0.0.2 + 9000 + + + 127.0.0.3 + 9000 + + + + + + + + localhost + 9000 + + + + + localhost + 9000 + + + + + + + 127.0.0.1 + 9000 + + + + + 127.0.0.2 + 9000 + + + + + + true + + 127.0.0.1 + 9000 + + + + true + + 127.0.0.2 + 9000 + + + + + + + localhost + 9440 + 1 + + + + + + + localhost + 9000 + + + + + localhost + 1 + + + + + + + + + + + + + + + + + + + + + + + + 3600 + + + + 3600 + + + 60 + + + + + + + + + + + + + system + query_log
+ + toYYYYMM(event_date) + + + + + + 7500 +
+ + + + system + trace_log
+ + toYYYYMM(event_date) + 7500 +
+ + + + system + query_thread_log
+ toYYYYMM(event_date) + 7500 +
+ + + + system + query_views_log
+ toYYYYMM(event_date) + 7500 +
+ + + + system + part_log
+ toYYYYMM(event_date) + 7500 +
+ + + + + + system + metric_log
+ 7500 + 1000 +
+ + + + system + asynchronous_metric_log
+ + 7000 +
+ + + + + + engine MergeTree + partition by toYYYYMM(finish_date) + order by (finish_date, finish_time_us, trace_id) + + system + opentelemetry_span_log
+ 7500 +
+ + + + + system + crash_log
+ + + 1000 +
+ + + + + + + system + processors_profile_log
+ + toYYYYMM(event_date) + 7500 +
+ + + + + + + + + *_dictionary.xml + + + *_function.xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + /clickhouse/task_queue/ddl + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + click_cost + any + + 0 + 3600 + + + 86400 + 60 + + + + max + + 0 + 60 + + + 3600 + 300 + + + 86400 + 3600 + + + + + + /var/lib/clickhouse/format_schemas/ + + + + + hide encrypt/decrypt arguments + ((?:aes_)?(?:encrypt|decrypt)(?:_mysql)?)\s*\(\s*(?:'(?:\\'|.)+'|.*?)\s*\) + + \1(???) + + + + + + + + + + false + + false + + + https://6f33034cfe684dd7a3ab9875e57b1c8d@o388870.ingest.sentry.io/5226277 + + + + + + + + + + + 268435456 + true + +
diff --git a/deploy/docker/clickhouse-setup/docker-compose.arm.yaml b/deploy/docker/clickhouse-setup/docker-compose.arm.yaml deleted file mode 100644 index c30bf82064..0000000000 --- a/deploy/docker/clickhouse-setup/docker-compose.arm.yaml +++ /dev/null @@ -1,133 +0,0 @@ -version: "2.4" - -services: - clickhouse: - image: altinity/clickhouse-server:21.12.3.32.altinitydev.arm - # ports: - # - "9000:9000" - # - "8123:8123" - volumes: - - ./clickhouse-config.xml:/etc/clickhouse-server/config.xml - - ./data/clickhouse/:/var/lib/clickhouse/ - restart: on-failure - logging: - options: - max-size: 50m - max-file: "3" - healthcheck: - # "clickhouse", "client", "-u ${CLICKHOUSE_USER}", "--password ${CLICKHOUSE_PASSWORD}", "-q 'SELECT 1'" - test: ["CMD", "wget", "--spider", "-q", "localhost:8123/ping"] - interval: 30s - timeout: 5s - retries: 3 - - alertmanager: - image: signoz/alertmanager:0.23.0-0.1 - volumes: - - ./data/alertmanager:/data - depends_on: - query-service: - condition: service_healthy - restart: on-failure - command: - - --queryService.url=http://query-service:8085 - - --storage.path=/data - -# Notes for Maintainers/Contributors who will change Line Numbers of Frontend & Query-Section. Please Update Line Numbers in `./scripts/commentLinesForSetup.sh` & `./CONTRIBUTING.md` - - - query-service: - image: signoz/query-service:0.8.2 - container_name: query-service - command: ["-config=/root/config/prometheus.yml"] - # ports: - # - "6060:6060" # pprof port - # - "8080:8080" # query-service port - volumes: - - ./prometheus.yml:/root/config/prometheus.yml - - ../dashboards:/root/config/dashboards - - ./data/signoz/:/var/lib/signoz/ - environment: - - ClickHouseUrl=tcp://clickhouse:9000/?database=signoz_traces - - STORAGE=clickhouse - - GODEBUG=netdns=go - - TELEMETRY_ENABLED=true - - DEPLOYMENT_TYPE=docker-standalone-arm - restart: on-failure - healthcheck: - test: ["CMD", "wget", "--spider", "-q", "localhost:8080/api/v1/version"] - interval: 30s - timeout: 5s - retries: 3 - depends_on: - clickhouse: - condition: service_healthy - - frontend: - image: signoz/frontend:0.8.2 - container_name: frontend - restart: on-failure - depends_on: - - alertmanager - - query-service - ports: - - "3301:3301" - volumes: - - ../common/nginx-config.conf:/etc/nginx/conf.d/default.conf - - otel-collector: - image: signoz/otelcontribcol:0.45.1-0.3 - command: ["--config=/etc/otel-collector-config.yaml"] - volumes: - - ./otel-collector-config.yaml:/etc/otel-collector-config.yaml - ports: - - "4317:4317" # OTLP gRPC receiver - - "4318:4318" # OTLP HTTP receiver - # - "8889:8889" # Prometheus metrics exposed by the agent - # - "13133:13133" # health_check - # - "14268:14268" # Jaeger receiver - # - "55678:55678" # OpenCensus receiver - # - "55679:55679" # zpages extension - # - "55680:55680" # OTLP gRPC legacy receiver - # - "55681:55681" # OTLP HTTP legacy receiver - mem_limit: 2000m - restart: on-failure - depends_on: - clickhouse: - condition: service_healthy - - otel-collector-metrics: - image: signoz/otelcontribcol:0.45.1-0.3 - command: ["--config=/etc/otel-collector-metrics-config.yaml"] - volumes: - - ./otel-collector-metrics-config.yaml:/etc/otel-collector-metrics-config.yaml - restart: on-failure - depends_on: - clickhouse: - condition: service_healthy - - hotrod: - image: jaegertracing/example-hotrod:1.30 - container_name: hotrod - logging: - options: - max-size: 50m - max-file: "3" - command: ["all"] - environment: - - JAEGER_ENDPOINT=http://otel-collector:14268/api/traces - - load-hotrod: - image: "grubykarol/locust:1.2.3-python3.9-alpine3.12" - container_name: load-hotrod - hostname: load-hotrod - environment: - ATTACKED_HOST: http://hotrod:8080 - LOCUST_MODE: standalone - NO_PROXY: standalone - TASK_DELAY_FROM: 5 - TASK_DELAY_TO: 30 - QUIET_MODE: "${QUIET_MODE:-false}" - LOCUST_OPTS: "--headless -u 10 -r 1" - volumes: - - ../common/locust-scripts:/locust diff --git a/deploy/docker/clickhouse-setup/docker-compose.yaml b/deploy/docker/clickhouse-setup/docker-compose.yaml index 44a0e25554..166a2096e3 100644 --- a/deploy/docker/clickhouse-setup/docker-compose.yaml +++ b/deploy/docker/clickhouse-setup/docker-compose.yaml @@ -2,12 +2,14 @@ version: "2.4" services: clickhouse: - image: yandex/clickhouse-server:21.12.3.32 + image: clickhouse/clickhouse-server:22.4.5-alpine # ports: # - "9000:9000" # - "8123:8123" volumes: - ./clickhouse-config.xml:/etc/clickhouse-server/config.xml + - ./clickhouse-users.xml:/etc/clickhouse-server/users.xml + # - ./clickhouse-storage.xml:/etc/clickhouse-server/config.d/storage.xml - ./data/clickhouse/:/var/lib/clickhouse/ restart: on-failure logging: diff --git a/deploy/docker/clickhouse-setup/users.xml b/deploy/docker/clickhouse-setup/users.xml new file mode 100644 index 0000000000..f18562071d --- /dev/null +++ b/deploy/docker/clickhouse-setup/users.xml @@ -0,0 +1,123 @@ + + + + + + + + + + 10000000000 + + + random + + + + + 1 + + + + + + + + + + + + + ::/0 + + + + default + + + default + + + + + + + + + + + + + + 3600 + + + 0 + 0 + 0 + 0 + 0 + + + + diff --git a/deploy/docker/common/nginx-config.conf b/deploy/docker/common/nginx-config.conf index 705656bb6e..99615f1f60 100644 --- a/deploy/docker/common/nginx-config.conf +++ b/deploy/docker/common/nginx-config.conf @@ -11,6 +11,11 @@ server { gzip_buffers 16 8k; gzip_http_version 1.1; + # to handle uri issue 414 from nginx + client_max_body_size 24M; + + large_client_header_buffers 8 16k; + location / { if ( $uri = '/index.html' ) { add_header Cache-Control no-store always; diff --git a/frontend/jest.setup.ts b/frontend/jest.setup.ts index 6557f780cf..b3b8061422 100644 --- a/frontend/jest.setup.ts +++ b/frontend/jest.setup.ts @@ -2,3 +2,4 @@ * Adds custom matchers from the react testing library to all tests */ import '@testing-library/jest-dom'; +import 'jest-styled-components'; diff --git a/frontend/package.json b/frontend/package.json index ebaffb5fae..f93bc9684c 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -159,6 +159,7 @@ "husky": "^7.0.4", "is-ci": "^3.0.1", "jest-playwright-preset": "^1.7.0", + "jest-styled-components": "^7.0.8", "less-plugin-npm-import": "^2.1.0", "lint-staged": "^12.3.7", "portfinder-sync": "^0.0.2", diff --git a/frontend/src/components/NotFound/__snapshots__/NotFound.test.tsx.snap b/frontend/src/components/NotFound/__snapshots__/NotFound.test.tsx.snap index 0e9ce92e30..9da91a31bd 100644 --- a/frontend/src/components/NotFound/__snapshots__/NotFound.test.tsx.snap +++ b/frontend/src/components/NotFound/__snapshots__/NotFound.test.tsx.snap @@ -2,8 +2,102 @@ exports[`Not Found page test should render Not Found page without errors 1`] = ` -

Ah, seems like we reached a dead end!

Page Not Found

diff --git a/frontend/src/constants/routes.ts b/frontend/src/constants/routes.ts index 636a3b0758..506474af97 100644 --- a/frontend/src/constants/routes.ts +++ b/frontend/src/constants/routes.ts @@ -12,7 +12,7 @@ const ROUTES = { ALL_DASHBOARD: '/dashboard', DASHBOARD: '/dashboard/:dashboardId', DASHBOARD_WIDGET: '/dashboard/:dashboardId/:widgetId', - EDIT_ALERTS: '/alerts/edit/:ruleId', + EDIT_ALERTS: '/alerts/edit', LIST_ALL_ALERT: '/alerts', ALERTS_NEW: '/alerts/new', ALL_CHANNELS: '/settings/channels', diff --git a/frontend/src/container/GridGraphLayout/Graph/FullView/index.tsx b/frontend/src/container/GridGraphLayout/Graph/FullView/index.tsx index e4b4bc8183..3111e33e87 100644 --- a/frontend/src/container/GridGraphLayout/Graph/FullView/index.tsx +++ b/frontend/src/container/GridGraphLayout/Graph/FullView/index.tsx @@ -57,7 +57,10 @@ function FullView({ time: timePreferenceType, ): { min: string | number; max: string | number } => { if (time === 'GLOBAL_TIME') { - const minMax = GetMinMax(globalSelectedTime); + const minMax = GetMinMax(globalSelectedTime, [ + minTime / 1000000, + maxTime / 1000000, + ]); return { min: convertToNanoSecondsToSecond(minMax.minTime / 1000), max: convertToNanoSecondsToSecond(minMax.maxTime / 1000), diff --git a/frontend/src/container/GridGraphLayout/index.tsx b/frontend/src/container/GridGraphLayout/index.tsx index 88250f3b7c..8f7ea56c15 100644 --- a/frontend/src/container/GridGraphLayout/index.tsx +++ b/frontend/src/container/GridGraphLayout/index.tsx @@ -218,7 +218,7 @@ function GridGraph(props: Props): JSX.Element { const onLayoutChangeHandler = async (layout: Layout[]): Promise => { setLayoutFunction(layout); - await onLayoutSaveHandler(layout); + // await onLayoutSaveHandler(layout); }; const onAddPanelHandler = useCallback(() => { diff --git a/frontend/src/container/ListAlertRules/ListAlert.tsx b/frontend/src/container/ListAlertRules/ListAlert.tsx index 8ec1fa9987..b851b0829a 100644 --- a/frontend/src/container/ListAlertRules/ListAlert.tsx +++ b/frontend/src/container/ListAlertRules/ListAlert.tsx @@ -11,7 +11,6 @@ import React, { useCallback, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { UseQueryResult } from 'react-query'; import { useSelector } from 'react-redux'; -import { generatePath } from 'react-router-dom'; import { AppState } from 'store/reducers'; import { ErrorResponse, SuccessResponse } from 'types/api'; import { Alerts } from 'types/api/alerts/getAll'; @@ -51,11 +50,7 @@ function ListAlert({ allAlertRules, refetch }: ListAlertProps): JSX.Element { const [notifications, Element] = notification.useNotification(); const onEditHandler = (id: string): void => { - history.push( - generatePath(ROUTES.EDIT_ALERTS, { - ruleId: id, - }), - ); + history.push(`${ROUTES.EDIT_ALERTS}?ruleId=${id}`); }; const columns: ColumnsType = [ diff --git a/frontend/src/container/ListOfDashboard/SearchFilter/__tests__/utils.test.ts b/frontend/src/container/ListOfDashboard/SearchFilter/__tests__/utils.test.ts new file mode 100644 index 0000000000..db9825b677 --- /dev/null +++ b/frontend/src/container/ListOfDashboard/SearchFilter/__tests__/utils.test.ts @@ -0,0 +1,58 @@ +import { Dashboard } from 'types/api/dashboard/getAll'; +import { v4 as uuid } from 'uuid'; + +import { TOperator } from '../types'; +import { executeSearchQueries } from '../utils'; + +describe('executeSearchQueries', () => { + const firstDashboard: Dashboard = { + id: 11111, + uuid: uuid(), + created_at: '', + updated_at: '', + data: { + title: 'first dashboard', + }, + }; + const secondDashboard: Dashboard = { + id: 22222, + uuid: uuid(), + created_at: '', + updated_at: '', + data: { + title: 'second dashboard', + }, + }; + const thirdDashboard: Dashboard = { + id: 333333, + uuid: uuid(), + created_at: '', + updated_at: '', + data: { + title: 'third dashboard (with special characters +?\\)', + }, + }; + const dashboards = [firstDashboard, secondDashboard, thirdDashboard]; + + it('should filter dashboards based on title', () => { + const query = { + category: 'title', + id: 'someid', + operator: '=' as TOperator, + value: 'first dashboard', + }; + + expect(executeSearchQueries([query], dashboards)).toEqual([firstDashboard]); + }); + + it('should filter dashboards with special characters', () => { + const query = { + category: 'title', + id: 'someid', + operator: '=' as TOperator, + value: 'third dashboard (with special characters +?\\)', + }; + + expect(executeSearchQueries([query], dashboards)).toEqual([thirdDashboard]); + }); +}); diff --git a/frontend/src/container/ListOfDashboard/SearchFilter/utils.ts b/frontend/src/container/ListOfDashboard/SearchFilter/utils.ts index 5f9b37cc3e..6487ccd789 100644 --- a/frontend/src/container/ListOfDashboard/SearchFilter/utils.ts +++ b/frontend/src/container/ListOfDashboard/SearchFilter/utils.ts @@ -42,6 +42,8 @@ export const executeSearchQueries = ( if (!searchData.length || !queries.length) { return searchData; } + const escapeRegExp = (regExp: string): string => + regExp.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); queries.forEach((query: IQueryStructure) => { const { operator } = query; @@ -61,7 +63,7 @@ export const executeSearchQueries = ( for (const searchSpaceItem of searchSpace) { if (searchSpaceItem) for (const queryValue of value) { - if (searchSpaceItem.match(queryValue)) { + if (searchSpaceItem.match(escapeRegExp(queryValue))) { return resolveOperator(true, operator); } } diff --git a/frontend/src/container/SideNav/menuItems.ts b/frontend/src/container/SideNav/menuItems.ts index 921cef71d5..66a2a1fe77 100644 --- a/frontend/src/container/SideNav/menuItems.ts +++ b/frontend/src/container/SideNav/menuItems.ts @@ -15,7 +15,7 @@ const menus: SidebarMenu[] = [ { Icon: BarChartOutlined, to: ROUTES.APPLICATION, - name: 'Metrics', + name: 'Services', }, { Icon: AlignLeftOutlined, diff --git a/frontend/src/container/TopNav/Breadcrumbs/index.tsx b/frontend/src/container/TopNav/Breadcrumbs/index.tsx index 25ff730711..33d42ac5b0 100644 --- a/frontend/src/container/TopNav/Breadcrumbs/index.tsx +++ b/frontend/src/container/TopNav/Breadcrumbs/index.tsx @@ -16,6 +16,7 @@ const breadcrumbNameMap = { [ROUTES.ORG_SETTINGS]: 'Organization Settings', [ROUTES.MY_SETTINGS]: 'My Settings', [ROUTES.ERROR_DETAIL]: 'Errors', + [ROUTES.LIST_ALL_ALERT]: 'Alerts', }; function ShowBreadcrumbs(props: RouteComponentProps): JSX.Element { diff --git a/frontend/src/container/Trace/Filters/Panel/PanelBody/CommonCheckBox/index.tsx b/frontend/src/container/Trace/Filters/Panel/PanelBody/CommonCheckBox/index.tsx index 0681e7e5d5..440c9652a7 100644 --- a/frontend/src/container/Trace/Filters/Panel/PanelBody/CommonCheckBox/index.tsx +++ b/frontend/src/container/Trace/Filters/Panel/PanelBody/CommonCheckBox/index.tsx @@ -1,12 +1,19 @@ -import React from 'react'; -import { useSelector } from 'react-redux'; +import { Button, Input } from 'antd'; +import React, { useState } from 'react'; +import { useDispatch, useSelector } from 'react-redux'; +import { Dispatch } from 'redux'; import { AppState } from 'store/reducers'; +import { INITIAL_FILTER_VALUE } from 'store/reducers/trace'; +import AppActions from 'types/actions'; +import { UPDATE_SPAN_UPDATE_FILTER_DISPLAY_VALUE } from 'types/actions/trace'; import { TraceFilterEnum, TraceReducer } from 'types/reducer/trace'; import CheckBoxComponent from '../Common/Checkbox'; +const { Search } = Input; + function CommonCheckBox(props: CommonCheckBoxProps): JSX.Element { - const { filter } = useSelector( + const { filter, filterDisplayValue } = useSelector( (state) => state.traces, ); @@ -15,9 +22,40 @@ function CommonCheckBox(props: CommonCheckBoxProps): JSX.Element { const status = filter.get(name) || {}; const statusObj = Object.keys(status); + const numberOfFilters = filterDisplayValue.get(name) || 0; + const dispatch = useDispatch>(); + const [searchFilter, setSearchFilter] = useState(''); + + const onClickMoreHandler = (): void => { + const newFilterDisplayValue = new Map(filterDisplayValue); + const preValue = + (newFilterDisplayValue.get(name) || 0) + INITIAL_FILTER_VALUE; + + newFilterDisplayValue.set(name, preValue); + + dispatch({ + type: UPDATE_SPAN_UPDATE_FILTER_DISPLAY_VALUE, + payload: newFilterDisplayValue, + }); + }; + + const isMoreButtonAvilable = Boolean( + numberOfFilters && statusObj.length > numberOfFilters, + ); return ( <> + {statusObj.length > 0 && ( + setSearchFilter(e.target.value)} + style={{ + padding: '0 3%', + }} + placeholder="Filter Values" + /> + )} + {statusObj .sort((a, b) => { const countA = +status[a]; @@ -28,6 +66,15 @@ function CommonCheckBox(props: CommonCheckBoxProps): JSX.Element { } return countA - countB; }) + .filter((filter) => { + if (searchFilter.length === 0) { + return true; + } + return filter + .toLocaleLowerCase() + .includes(searchFilter.toLocaleLowerCase()); + }) + .filter((_, index) => index < numberOfFilters) .map((e) => ( ))} + + {isMoreButtonAvilable && ( + + )} ); } diff --git a/frontend/src/container/Trace/Filters/Panel/PanelBody/Duration/index.tsx b/frontend/src/container/Trace/Filters/Panel/PanelBody/Duration/index.tsx index a2a5d163a1..81bd6e7faa 100644 --- a/frontend/src/container/Trace/Filters/Panel/PanelBody/Duration/index.tsx +++ b/frontend/src/container/Trace/Filters/Panel/PanelBody/Duration/index.tsx @@ -1,11 +1,14 @@ -/* eslint-disable react/no-unstable-nested-components */ -import { Input, Slider } from 'antd'; +import { Slider } from 'antd'; import { SliderRangeProps } from 'antd/lib/slider'; import getFilters from 'api/trace/getFilters'; -import dayjs from 'dayjs'; -import durationPlugin from 'dayjs/plugin/duration'; import useDebouncedFn from 'hooks/useDebouncedFunction'; -import React, { useEffect, useMemo, useRef, useState } from 'react'; +import React, { + useCallback, + useEffect, + useMemo, + useRef, + useState, +} from 'react'; import { useDispatch, useSelector } from 'react-redux'; import { Dispatch } from 'redux'; import { getFilter, updateURL } from 'store/actions/trace/util'; @@ -15,19 +18,8 @@ import { UPDATE_ALL_FILTERS } from 'types/actions/trace'; import { GlobalReducer } from 'types/reducer/globalTime'; import { TraceReducer } from 'types/reducer/trace'; -import { Container, InputContainer, Text } from './styles'; - -dayjs.extend(durationPlugin); - -const getMs = (value: string): string => { - return parseFloat( - dayjs - .duration({ - milliseconds: parseInt(value, 10) / 1000000, - }) - .format('SSS'), - ).toFixed(2); -}; +import { Container, InputComponent, InputContainer, Text } from './styles'; +import { getMs } from './util'; function Duration(): JSX.Element { const { @@ -77,17 +69,18 @@ function Duration(): JSX.Element { preLocalMinDuration.current = parseFloat(minDuration); } - setPreMax(maxDuration); - setPreMin(minDuration); + setPreMax(getMs(maxDuration)); + setPreMin(getMs(minDuration)); }, [getDuration]); - const defaultValue = [parseFloat(preMin), parseFloat(preMax)]; - const updatedUrl = async (min: number, max: number): Promise => { const preSelectedFilter = new Map(selectedFilter); const preUserSelected = new Map(userSelectedFilter); - preSelectedFilter.set('duration', [String(max), String(min)]); + preSelectedFilter.set('duration', [ + String(max * 1000000), + String(min * 1000000), + ]); const response = await getFilters({ end: String(globalTime.maxTime), @@ -137,18 +130,18 @@ function Duration(): JSX.Element { } }; - const onRangeSliderHandler = (number: [number, number]): void => { + const onRangeSliderHandler = (number: [string, string]): void => { const [min, max] = number; - setPreMin(min.toString()); - setPreMax(max.toString()); + setPreMin(min); + setPreMax(max); }; const debouncedFunction = useDebouncedFn( (min, max) => { updatedUrl(min as number, max as number); }, - 500, + 1500, undefined, ); @@ -156,8 +149,8 @@ function Duration(): JSX.Element { event, ) => { const { value } = event.target; - const min = parseFloat(preMin); - const max = parseFloat(value) * 1000000; + const min = preMin; + const max = value; onRangeSliderHandler([min, max]); debouncedFunction(min, max); @@ -167,8 +160,9 @@ function Duration(): JSX.Element { event, ) => { const { value } = event.target; - const min = parseFloat(value) * 1000000; - const max = parseFloat(preMax); + const min = value; + const max = preMax; + onRangeSliderHandler([min, max]); debouncedFunction(min, max); }; @@ -177,45 +171,48 @@ function Duration(): JSX.Element { updatedUrl(min, max); }; + const TipComponent = useCallback((value) => { + if (value === undefined) { + return
; + } + return
{`${getMs(value?.toString())}ms`}
; + }, []); + return (
Min - Max - { - if (value === undefined) { - return
; - } - return
{`${getMs(value?.toString())}ms`}
; - }} + tipFormatter={TipComponent} onChange={([min, max]): void => { - onRangeSliderHandler([min, max]); + onRangeSliderHandler([String(min), String(max)]); }} onAfterChange={onRangeHandler} - value={[parseFloat(preMin), parseFloat(preMax)]} + value={[Number(preMin), Number(preMax)]} />
diff --git a/frontend/src/container/Trace/Filters/Panel/PanelBody/Duration/styles.ts b/frontend/src/container/Trace/Filters/Panel/PanelBody/Duration/styles.ts index d80c0e503d..1cab3f8954 100644 --- a/frontend/src/container/Trace/Filters/Panel/PanelBody/Duration/styles.ts +++ b/frontend/src/container/Trace/Filters/Panel/PanelBody/Duration/styles.ts @@ -1,4 +1,4 @@ -import { Typography } from 'antd'; +import { Input, Typography } from 'antd'; import styled from 'styled-components'; export const DurationText = styled.div` @@ -9,6 +9,19 @@ export const DurationText = styled.div` flex-direction: column; `; +export const InputComponent = styled(Input)` + input::-webkit-outer-spin-button, + input::-webkit-inner-spin-button { + -webkit-appearance: none; + margin: 0; + } + + /* Firefox */ + input[type='number'] { + -moz-appearance: textfield; + } +`; + export const InputContainer = styled.div` width: 100%; margin-top: 0.5rem; diff --git a/frontend/src/container/Trace/Filters/Panel/PanelBody/Duration/util.ts b/frontend/src/container/Trace/Filters/Panel/PanelBody/Duration/util.ts new file mode 100644 index 0000000000..2a6bcf9586 --- /dev/null +++ b/frontend/src/container/Trace/Filters/Panel/PanelBody/Duration/util.ts @@ -0,0 +1,13 @@ +import dayjs from 'dayjs'; +import durationPlugin from 'dayjs/plugin/duration'; + +dayjs.extend(durationPlugin); + +export const getMs = (value: string): string => + parseFloat( + dayjs + .duration({ + milliseconds: parseInt(value, 10) / 1000000, + }) + .format('SSS'), + ).toFixed(2); diff --git a/frontend/src/container/Trace/Search/AllTags/Tag/TagKey.tsx b/frontend/src/container/Trace/Search/AllTags/Tag/TagKey.tsx index b57b4fc361..bb9794d8e7 100644 --- a/frontend/src/container/Trace/Search/AllTags/Tag/TagKey.tsx +++ b/frontend/src/container/Trace/Search/AllTags/Tag/TagKey.tsx @@ -73,11 +73,24 @@ function TagsKey(props: TagsKeysProps): JSX.Element { { - if (options && options.find((option) => option.value === value)) { + allowClear + showSearch + options={options?.map((e) => ({ + label: e.label?.toString(), + value: e.value, + }))} + filterOption={(inputValue, option): boolean => + option?.label?.toUpperCase().indexOf(inputValue.toUpperCase()) !== -1 + } + onChange={(e): void => setSelectedKey(e)} + onSelect={(value: unknown): void => { + if ( + typeof value === 'string' && + options && + options.find((option) => option.value === value) + ) { setSelectedKey(value); setLocalSelectedTags((tags) => [ @@ -89,8 +102,6 @@ function TagsKey(props: TagsKeysProps): JSX.Element { }, ...tags.slice(index + 1, tags.length), ]); - } else { - setSelectedKey(''); } }} > diff --git a/frontend/src/container/Trace/Search/AllTags/Tag/TagValue.tsx b/frontend/src/container/Trace/Search/AllTags/Tag/TagValue.tsx index 756bb54225..60b2d4118b 100644 --- a/frontend/src/container/Trace/Search/AllTags/Tag/TagValue.tsx +++ b/frontend/src/container/Trace/Search/AllTags/Tag/TagValue.tsx @@ -1,13 +1,13 @@ import { Select } from 'antd'; import getTagValue from 'api/trace/getTagValue'; -import React from 'react'; +import React, { useState } from 'react'; import { useQuery } from 'react-query'; import { useSelector } from 'react-redux'; import { AppState } from 'store/reducers'; import { GlobalReducer } from 'types/reducer/globalTime'; import { TraceReducer } from 'types/reducer/trace'; -import { SelectComponent } from './styles'; +import { AutoCompleteComponent } from './styles'; function TagValue(props: TagValueProps): JSX.Element { const { tag, setLocalSelectedTags, index, tagKey } = props; @@ -16,6 +16,7 @@ function TagValue(props: TagValueProps): JSX.Element { Operator: selectedOperator, Values: selectedValues, } = tag; + const [localValue, setLocalValue] = useState(selectedValues[0]); const globalReducer = useSelector( (state) => state.globalTime, @@ -34,22 +35,38 @@ function TagValue(props: TagValueProps): JSX.Element { ); return ( - ({ + label: e.tagValues, + value: e.tagValues, + }))} + allowClear + defaultOpen + showSearch + filterOption={(inputValue, option): boolean => + option?.label.toUpperCase().indexOf(inputValue.toUpperCase()) !== -1 + } + disabled={isLoading} + value={localValue} + onChange={(values): void => { + if (typeof values === 'string') { + setLocalValue(values); + } + }} onSelect={(value: unknown): void => { if (typeof value === 'string') { + setLocalValue(value); setLocalSelectedTags((tags) => [ ...tags.slice(0, index), { Key: selectedKey, Operator: selectedOperator, - Values: [...selectedValues, value], + Values: [value], }, ...tags.slice(index + 1, tags.length), ]); } }} - loading={isLoading || false} > {data && data.payload && @@ -58,7 +75,7 @@ function TagValue(props: TagValueProps): JSX.Element { {suggestion.tagValues} ))} - + ); } diff --git a/frontend/src/container/Trace/Search/AllTags/Tag/styles.ts b/frontend/src/container/Trace/Search/AllTags/Tag/styles.ts index 347bc287f2..e604a444d7 100644 --- a/frontend/src/container/Trace/Search/AllTags/Tag/styles.ts +++ b/frontend/src/container/Trace/Search/AllTags/Tag/styles.ts @@ -1,4 +1,4 @@ -import { Select, Space } from 'antd'; +import { AutoComplete, Select, Space } from 'antd'; import styled from 'styled-components'; export const SpaceComponent = styled(Space)` @@ -9,18 +9,23 @@ export const SpaceComponent = styled(Space)` export const SelectComponent = styled(Select)` &&& { - min-width: 170px; - margin-right: 21.91px; - margin-left: 21.92px; + width: 100%; } `; -export const Container = styled.div` +export const Container = styled(Space)` &&& { display: flex; margin-top: 1rem; margin-bottom: 1rem; } + + .ant-space-item:not(:last-child, :nth-child(2)) { + width: 100%; + } + .ant-space-item:nth-child(2) { + width: 50%; + } `; export const IconContainer = styled.div` @@ -31,3 +36,9 @@ export const IconContainer = styled.div` margin-left: 1.125rem; `; + +export const AutoCompleteComponent = styled(AutoComplete)` + &&& { + width: 100%; + } +`; diff --git a/frontend/src/container/TraceDetail/SelectedSpanDetails/index.tsx b/frontend/src/container/TraceDetail/SelectedSpanDetails/index.tsx index 87a953fd6e..50f2aa9537 100644 --- a/frontend/src/container/TraceDetail/SelectedSpanDetails/index.tsx +++ b/frontend/src/container/TraceDetail/SelectedSpanDetails/index.tsx @@ -1,7 +1,7 @@ -import { Space, Tabs, Typography } from 'antd'; +import { Tabs, Tooltip, Typography } from 'antd'; import { StyledSpace } from 'components/Styled'; import useThemeMode from 'hooks/useThemeMode'; -import React from 'react'; +import React, { useMemo } from 'react'; import { ITraceTree } from 'types/api/trace/getTraceItem'; import ErrorTag from './ErrorTag'; @@ -19,29 +19,38 @@ const { TabPane } = Tabs; function SelectedSpanDetails(props: SelectedSpanDetailsProps): JSX.Element { const { tree } = props; const { isDarkMode } = useThemeMode(); + + const OverLayComponentName = useMemo(() => tree?.name, [tree?.name]); + const OverLayComponentServiceName = useMemo(() => tree?.serviceName, [ + tree?.serviceName, + ]); + if (!tree) { return
; } - const { name, tags, serviceName } = tree; + const { tags } = tree; return ( Details for selected Span - - Service - {serviceName} - - - Operation - {name} - + + Service + + {tree.serviceName} + + + Operation + + {tree.name} + + {tags.length !== 0 ? ( diff --git a/frontend/src/container/TraceDetail/SelectedSpanDetails/styles.ts b/frontend/src/container/TraceDetail/SelectedSpanDetails/styles.ts index dc5bdc03e9..d8bae86ba7 100644 --- a/frontend/src/container/TraceDetail/SelectedSpanDetails/styles.ts +++ b/frontend/src/container/TraceDetail/SelectedSpanDetails/styles.ts @@ -1,7 +1,7 @@ -import { Typography } from 'antd'; +import { Space, Typography } from 'antd'; import styled, { css } from 'styled-components'; -const { Text, Title, Paragraph } = Typography; +const { Title, Paragraph } = Typography; export const CustomTitle = styled(Title)` &&& { @@ -9,7 +9,7 @@ export const CustomTitle = styled(Title)` } `; -export const CustomText = styled(Text)` +export const CustomText = styled(Paragraph)` &&& { color: #2d9cdb; } @@ -17,7 +17,6 @@ export const CustomText = styled(Text)` export const CustomSubTitle = styled(Title)` &&& { - /* color: #bdbdbd; */ font-size: 14px; margin-bottom: 8px; } @@ -44,6 +43,17 @@ export const CardContainer = styled.div` width: 100%; flex: 1; overflow-y: auto; + overflow-x: hidden; + white-space: nowrap; + text-overflow: ellipsis; +`; + +export const CustomSpace = styled(Space)` + &&& { + .ant-space-item { + width: 100%; + } + } `; const removeMargin = css` @@ -60,9 +70,21 @@ const selectedSpanDetailsContainer = css` const spanEventsTabsContainer = css` margin-top: 1rem; `; + +const overflow = css` + width: 95%; + + > div.ant-space-item:nth-child(4) { + overflow-x: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } +`; + export const styles = { removeMargin, removePadding, selectedSpanDetailsContainer, spanEventsTabsContainer, + overflow, }; diff --git a/frontend/src/container/TraceFlameGraph/__tests__/__snapshots__/TraceFlameGraph.test.tsx.snap b/frontend/src/container/TraceFlameGraph/__tests__/__snapshots__/TraceFlameGraph.test.tsx.snap index 39a3638956..c8c24ebfd4 100644 --- a/frontend/src/container/TraceFlameGraph/__tests__/__snapshots__/TraceFlameGraph.test.tsx.snap +++ b/frontend/src/container/TraceFlameGraph/__tests__/__snapshots__/TraceFlameGraph.test.tsx.snap @@ -2,12 +2,30 @@ exports[`loads and displays greeting 1`] = ` -
diff --git a/frontend/src/pages/EditRules/index.tsx b/frontend/src/pages/EditRules/index.tsx index 9b80ff7024..09cda600ab 100644 --- a/frontend/src/pages/EditRules/index.tsx +++ b/frontend/src/pages/EditRules/index.tsx @@ -1,23 +1,45 @@ +import { notification } from 'antd'; import get from 'api/alerts/get'; import Spinner from 'components/Spinner'; +import ROUTES from 'constants/routes'; import EditRulesContainer from 'container/EditRules'; -import React from 'react'; +import history from 'lib/history'; +import React, { useEffect } from 'react'; import { useTranslation } from 'react-i18next'; import { useQuery } from 'react-query'; -import { useParams } from 'react-router-dom'; +import { useLocation } from 'react-router-dom'; function EditRules(): JSX.Element { - const { ruleId } = useParams(); + const { search } = useLocation(); + const params = new URLSearchParams(search); + const ruleId = params.get('ruleId'); + const { t } = useTranslation('common'); + const isValidRuleId = ruleId !== null && String(ruleId).length !== 0; + const { isLoading, data, isError } = useQuery(['ruleId', ruleId], { queryFn: () => get({ - id: parseInt(ruleId, 10), + id: parseInt(ruleId || '', 10), }), + enabled: isValidRuleId, }); - if (isError) { + useEffect(() => { + if (!isValidRuleId) { + notification.error({ + message: 'Rule Id is required', + }); + history.replace(ROUTES.LIST_ALL_ALERT); + } + }, [isValidRuleId, ruleId]); + + if ( + (isError && !isValidRuleId) || + ruleId == null || + (data?.payload?.data === undefined && !isLoading) + ) { return
{data?.error || t('something_went_wrong')}
; } @@ -28,8 +50,4 @@ function EditRules(): JSX.Element { return ; } -interface EditRulesParam { - ruleId: string; -} - export default EditRules; diff --git a/frontend/src/store/reducers/trace.ts b/frontend/src/store/reducers/trace.ts index b99ee7dd3a..3f7672cdd5 100644 --- a/frontend/src/store/reducers/trace.ts +++ b/frontend/src/store/reducers/trace.ts @@ -11,6 +11,7 @@ import { UPDATE_SELECTED_TAGS, UPDATE_SPAN_ORDER, UPDATE_SPAN_ORDER_PARAMS, + UPDATE_SPAN_UPDATE_FILTER_DISPLAY_VALUE, UPDATE_SPANS_AGGREGATE, UPDATE_SPANS_AGGREGATE_PAGE_NUMBER, UPDATE_SPANS_AGGREGATE_PAGE_SIZE, @@ -23,6 +24,8 @@ import { } from 'types/actions/trace'; import { TraceFilterEnum, TraceReducer } from 'types/reducer/trace'; +export const INITIAL_FILTER_VALUE = 8; + const initialValue: TraceReducer = { filter: new Map(), filterToFetchData: ['duration', 'status', 'serviceName'], @@ -53,6 +56,17 @@ const initialValue: TraceReducer = { loading: true, payload: { items: {} }, }, + filterDisplayValue: new Map([ + ['component', INITIAL_FILTER_VALUE], + ['duration', INITIAL_FILTER_VALUE], + ['httpCode', INITIAL_FILTER_VALUE], + ['httpHost', INITIAL_FILTER_VALUE], + ['httpMethod', INITIAL_FILTER_VALUE], + ['httpUrl', INITIAL_FILTER_VALUE], + ['operation', INITIAL_FILTER_VALUE], + ['serviceName', INITIAL_FILTER_VALUE], + ['status', INITIAL_FILTER_VALUE], + ]), }; const traceReducer = ( @@ -251,6 +265,13 @@ const traceReducer = ( }; } + case UPDATE_SPAN_UPDATE_FILTER_DISPLAY_VALUE: { + return { + ...state, + filterDisplayValue: action.payload, + }; + } + default: return state; } diff --git a/frontend/src/types/actions/trace.ts b/frontend/src/types/actions/trace.ts index da97d05129..f043926142 100644 --- a/frontend/src/types/actions/trace.ts +++ b/frontend/src/types/actions/trace.ts @@ -31,6 +31,8 @@ export const UPDATE_SPANS_AGGREGATE_PAGE_NUMBER = export const UPDATE_SPANS_AGGREGATE_PAGE_SIZE = 'UPDATE_SPANS_AGGREGATE_PAGE_SIZE'; export const UPDATE_SPAN_ORDER_PARAMS = 'UPDATE_SPAN_ORDER_PARAMS'; +export const UPDATE_SPAN_UPDATE_FILTER_DISPLAY_VALUE = + 'UPDATE_SPAN_UPDATE_FILTER_DISPLAY_VALUE'; export interface UpdateFilter { type: typeof UPDATE_TRACE_FILTER; @@ -187,6 +189,11 @@ export interface UpdateSpanParams { }; } +export interface UpdateTraceFilterDisplayValue { + type: typeof UPDATE_SPAN_UPDATE_FILTER_DISPLAY_VALUE; + payload: TraceReducer['filterDisplayValue']; +} + export type TraceActions = | UpdateFilter | GetTraceFilter @@ -208,4 +215,5 @@ export type TraceActions = | UpdateSpanOrder | UpdateSpansAggregatePageNumber | UpdateSpanSize - | UpdateSpanParams; + | UpdateSpanParams + | UpdateTraceFilterDisplayValue; diff --git a/frontend/src/types/reducer/trace.ts b/frontend/src/types/reducer/trace.ts index babeb344c6..fc1c08f4fc 100644 --- a/frontend/src/types/reducer/trace.ts +++ b/frontend/src/types/reducer/trace.ts @@ -32,6 +32,7 @@ export interface TraceReducer { payload: PayloadProps; }; yAxisUnit: string | undefined; + filterDisplayValue: Map; } interface SpansAggregateData { diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json index b3aa27fe50..a10bce6e81 100644 --- a/frontend/tsconfig.json +++ b/frontend/tsconfig.json @@ -35,6 +35,7 @@ "playwright.config.ts", "./commitlint.config.js", "./webpack.config.js", - "./webpack.config.prod.js" + "./webpack.config.prod.js", + "./jest.setup.ts" ] } diff --git a/frontend/yarn.lock b/frontend/yarn.lock index 2227658f6b..3a254370a1 100644 --- a/frontend/yarn.lock +++ b/frontend/yarn.lock @@ -8128,6 +8128,13 @@ jest-snapshot@^27.5.1: pretty-format "^27.5.1" semver "^7.3.2" +jest-styled-components@^7.0.8: + version "7.0.8" + resolved "https://registry.yarnpkg.com/jest-styled-components/-/jest-styled-components-7.0.8.tgz#9ea3b43f002de060b4638fde3b422d14b3e3ec9f" + integrity sha512-0KE54d0yIzKcvtOv8eikyjG3rFRtKYUyQovaoha3nondtZzXYGB3bhsvYgEegU08Iry0ndWx2+g9f5ZzD4I+0Q== + dependencies: + css "^3.0.0" + jest-util@^26.6.2: version "26.6.2" resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-26.6.2.tgz#907535dbe4d5a6cb4c47ac9b926f6af29576cbc1" diff --git a/pkg/query-service/app/clickhouseReader/reader.go b/pkg/query-service/app/clickhouseReader/reader.go index 1258060c41..f405c69f6d 100644 --- a/pkg/query-service/app/clickhouseReader/reader.go +++ b/pkg/query-service/app/clickhouseReader/reader.go @@ -592,21 +592,45 @@ func (r *ClickHouseReader) GetRulesFromDB() (*[]model.RuleResponseItem, *model.A func (r *ClickHouseReader) GetRule(id string) (*model.RuleResponseItem, *model.ApiError) { - idInt, _ := strconv.Atoi(id) + idInt, err := strconv.Atoi(id) + if err != nil { + zap.S().Debug("Error in parsing param: ", err) + return nil, &model.ApiError{Typ: model.ErrorBadData, Err: err} + } rule := &model.RuleResponseItem{} - query := fmt.Sprintf("SELECT id, updated_at, data FROM rules WHERE id=%d", idInt) - - err := r.localDB.Get(rule, query) - - zap.S().Info(query) + query := "SELECT id, updated_at, data FROM rules WHERE id=?" + rows, err := r.localDB.Query(query, idInt) if err != nil { zap.S().Debug("Error in processing sql query: ", err) return nil, &model.ApiError{Typ: model.ErrorInternal, Err: err} } + count := 0 + // iterate over each row + for rows.Next() { + err = rows.Scan(&rule.Id, &rule.UpdatedAt, &rule.Data) + if err != nil { + zap.S().Debug(err) + return nil, &model.ApiError{Typ: model.ErrorInternal, Err: err} + } + count += 1 + + } + + if count == 0 { + err = fmt.Errorf("no rule with id %d found", idInt) + zap.S().Debug(err) + return nil, &model.ApiError{Typ: model.ErrorNotFound, Err: err} + } + if count > 1 { + err = fmt.Errorf("multiple rules with id %d found", idInt) + zap.S().Debug(err) + return nil, &model.ApiError{Typ: model.ErrorConflict, Err: err} + } + return rule, nil } diff --git a/pkg/query-service/tests/test-deploy/clickhouse-config.xml b/pkg/query-service/tests/test-deploy/clickhouse-config.xml index 06ddb2b723..3bb26a3a36 100644 --- a/pkg/query-service/tests/test-deploy/clickhouse-config.xml +++ b/pkg/query-service/tests/test-deploy/clickhouse-config.xml @@ -1,136 +1,567 @@ - + + - information - 1 + + trace + /var/log/clickhouse-server/clickhouse-server.log + /var/log/clickhouse-server/clickhouse-server.err.log + + 1000M + 10 + + + + + + + + + + + + + + + 8123 + + 9000 - - + + 9004 - - - - - /etc/clickhouse-server/server.crt - /etc/clickhouse-server/server.key - - /etc/clickhouse-server/dhparam.pem - none - true - true - sslv2,sslv3 - true - + + 9005 - - true - true - sslv2,sslv3 - true - - - - RejectCertificateHandler - - - + + - - - - - - - s3 - http://172.17.0.1:9100/test// - ash - password - - - - - - - default - - - s3 - - - - - + + + + - - + + 9009 - -9009 + + + If not specified, then it is determined analogous to 'hostname -f' command. + This setting could be used to switch replication to another network interface + (the server may be connected to multiple networks via multiple addresses) + --> + + example.clickhouse.com + --> - -:: - - + + - - + + -4096 -3 - -100 + + + + + + + + + + + + + + + 4096 + + + 3 + + + + + false + + + /path/to/ssl_cert_file + /path/to/ssl_key_file + + + false + + + /path/to/ssl_ca_cert_file + + + none + + + 0 + + + -1 + -1 + + + false + + + + + + + /etc/clickhouse-server/server.crt + /etc/clickhouse-server/server.key + + + none + true + true + sslv2,sslv3 + true + + + + true + true + sslv2,sslv3 + true + + + + RejectCertificateHandler + + + + + + + + + 100 + + + 0 + + + + 10000 + + + + + + 0.9 + + + 4194304 + + + 0 + correct maximum value. --> - 8589934592 + + Note: uncompressed cache can be pointless for lz4, because memory bandwidth + is slower than multi-core decompression on some server configurations. + Enabling it can sometimes paradoxically make queries slower. + --> + 8589934592 - 5368709120 + --> + 5368709120 - - /var/lib/clickhouse/ + + 1000 - - /var/lib/clickhouse/tmp/ + + 134217728 - - users.xml + + 10000 - - default + + /var/lib/clickhouse/ - - default + + /var/lib/clickhouse/tmp/ + + + + ` + + + + + + /var/lib/clickhouse/user_files/ + + + + + + + + + + + + + users.xml + + + + /var/lib/clickhouse/access/ + + + + + + + default + + + + + + + + + + + + default - + Example: Zulu is an alias for UTC. + --> + - + --> + + + + true + + + false + + ' | sed -e 's|.*>\(.*\)<.*|\1|') + wget https://github.com/ClickHouse/clickhouse-jdbc-bridge/releases/download/v$PKG_VER/clickhouse-jdbc-bridge_$PKG_VER-1_all.deb + apt install --no-install-recommends -f ./clickhouse-jdbc-bridge_$PKG_VER-1_all.deb + clickhouse-jdbc-bridge & + + * [CentOS/RHEL] + export MVN_URL=https://repo1.maven.org/maven2/ru/yandex/clickhouse/clickhouse-jdbc-bridge + export PKG_VER=$(curl -sL $MVN_URL/maven-metadata.xml | grep '' | sed -e 's|.*>\(.*\)<.*|\1|') + wget https://github.com/ClickHouse/clickhouse-jdbc-bridge/releases/download/v$PKG_VER/clickhouse-jdbc-bridge-$PKG_VER-1.noarch.rpm + yum localinstall -y clickhouse-jdbc-bridge-$PKG_VER-1.noarch.rpm + clickhouse-jdbc-bridge & + + Please refer to https://github.com/ClickHouse/clickhouse-jdbc-bridge#usage for more information. + ]]> + - + https://clickhouse.com/docs/en/operations/table_engines/distributed/ + --> + + + + + + + + + + + localhost + 9000 + + + + + + + + false + + 127.0.0.1 + 9000 + + + 127.0.0.2 + 9000 + + + 127.0.0.3 + 9000 + + + + + + + + localhost + 9000 + + + + + localhost + 9000 + + + + + + + 127.0.0.1 + 9000 + + + + + 127.0.0.2 + 9000 + + + + + + true + + 127.0.0.1 + 9000 + + + + true + + 127.0.0.2 + 9000 + + + + + + + localhost + 9440 + 1 + + + + localhost 9000 - + + + localhost + 1 + + + + + + + + + + Values for substitutions are specified in /clickhouse/name_of_substitution elements in that file. + --> - + See https://clickhouse.com/docs/en/engines/table-engines/mergetree-family/replication/ + --> + + - + See https://clickhouse.com/docs/en/engines/table-engines/mergetree-family/replication/#creating-replicated-tables + --> + - - 3600 + + 3600 - - 3600 + + 3600 - - 60 + + 60 - + + --> + + + - + true + true + true + true + + --> + + + + system + query_log
+ + toYYYYMM(event_date) + + + - system - query_log
- - 7500 -
+ + 7500 +
+ + + system + trace_log
- + + system + query_thread_log
+ toYYYYMM(event_date) + 7500 +
+ + + + system + query_views_log
+ toYYYYMM(event_date) + 7500 +
+ + system part_log
- + toYYYYMM(event_date) 7500
---> + + + + + + system + metric_log
+ 7500 + 1000 +
+ + + + system + asynchronous_metric_log
+ + 7000 +
+ + + + + + engine MergeTree + partition by toYYYYMM(finish_date) + order by (finish_date, finish_time_us, trace_id) + + system + opentelemetry_span_log
+ 7500 +
- + + + system + crash_log
- - + + 1000 +
- - + + + + + + system + processors_profile_log
+ + toYYYYMM(event_date) + 7500 +
+ + + + + + - *_dictionary.xml + https://clickhouse.com/docs/en/sql-reference/dictionaries/external-dictionaries/external-dicts + --> + *_dictionary.xml + + + *_function.xml - + --> - + + + + + + + + + + + + + + + + + + + + + + + + + Works only if ZooKeeper is enabled. Comment it if such functionality isn't required. --> /clickhouse/task_queue/ddl + + + + + + + + + + + + + + + + + @@ -303,239 +1149,156 @@ 5 ---> + --> - + --> + + - - - + + - ^carbon\. + click_cost any 0 + 3600 + + + 86400 60 - - 7776000 - 3600 - - - 10368000 - 21600 - - - 34560000 - 43200 - - - 63072000 - 86400 - - - 94608000 - 604800 - - - - ^collectd\. - any - - 0 - 10 - - - 43200 - 60 - - - 864000 - 900 - - - 1728000 - 1800 - - - 3456000 - 3600 - - - 10368000 - 21600 - - - 34560000 - 43200 - - - 63072000 - 86400 - - - 94608000 - 604800 - - - - - ^high\. - any - - 0 - 10 - - - 172800 - 60 - - - 864000 - 900 - - - 1728000 - 1800 - - - 3456000 - 3600 - - - 10368000 - 21600 - - - 34560000 - 43200 - - - 63072000 - 86400 - - - 94608000 - 604800 - - - - - ^medium\. - any - - 0 - 60 - - - 864000 - 900 - - - 1728000 - 1800 - - - 3456000 - 3600 - - - 10368000 - 21600 - - - 34560000 - 43200 - - - 63072000 - 86400 - - - 94608000 - 604800 - - - - - ^low\. - any - - 0 - 600 - - - 15552000 - 1800 - - - 31536000 - 3600 - - - 63072000 - 21600 - - - 126144000 - 43200 - - - 252288000 - 86400 - - - 315360000 - 604800 - - - - any + max 0 60 - 864000 - 900 + 3600 + 300 - 1728000 - 1800 - - - 3456000 + 86400 3600 - - 10368000 - 21600 - - - 34560000 - 43200 - - - 63072000 - 86400 - - - 94608000 - 604800 - - + - /var/lib/clickhouse/format_schemas/ -
+ --> + /var/lib/clickhouse/format_schemas/ + + + + + hide encrypt/decrypt arguments + ((?:aes_)?(?:encrypt|decrypt)(?:_mysql)?)\s*\(\s*(?:'(?:\\'|.)+'|.*?)\s*\) + + \1(???) + + + + + + + + + + false + + false + + + https://6f33034cfe684dd7a3ab9875e57b1c8d@o388870.ingest.sentry.io/5226277 + + + + + + + + + + + 268435456 + true + + diff --git a/pkg/query-service/tests/test-deploy/clickhouse-storage.xml b/pkg/query-service/tests/test-deploy/clickhouse-storage.xml new file mode 100644 index 0000000000..eaf1e7e99d --- /dev/null +++ b/pkg/query-service/tests/test-deploy/clickhouse-storage.xml @@ -0,0 +1,28 @@ + + + + + + 10485760 + + + s3 + http://172.17.0.1:9100/test// + ash + password + + + + + + + default + + + s3 + + + + + + diff --git a/pkg/query-service/tests/test-deploy/clickhouse-users.xml b/pkg/query-service/tests/test-deploy/clickhouse-users.xml new file mode 100644 index 0000000000..f18562071d --- /dev/null +++ b/pkg/query-service/tests/test-deploy/clickhouse-users.xml @@ -0,0 +1,123 @@ + + + + + + + + + + 10000000000 + + + random + + + + + 1 + + + + + + + + + + + + + ::/0 + + + + default + + + default + + + + + + + + + + + + + + 3600 + + + 0 + 0 + 0 + 0 + 0 + + + + diff --git a/pkg/query-service/tests/test-deploy/docker-compose.arm.yaml b/pkg/query-service/tests/test-deploy/docker-compose.arm.yaml deleted file mode 100644 index 48a1449fe4..0000000000 --- a/pkg/query-service/tests/test-deploy/docker-compose.arm.yaml +++ /dev/null @@ -1,99 +0,0 @@ -version: "2.4" - -services: - clickhouse: - image: altinity/clickhouse-server:21.12.3.32.altinitydev.arm - volumes: - - ./clickhouse-config.xml:/etc/clickhouse-server/config.xml - restart: on-failure - logging: - options: - max-size: 50m - max-file: "3" - healthcheck: - # "clickhouse", "client", "-u ${CLICKHOUSE_USER}", "--password ${CLICKHOUSE_PASSWORD}", "-q 'SELECT 1'" - test: ["CMD", "wget", "--spider", "-q", "localhost:8123/ping"] - interval: 30s - timeout: 5s - retries: 3 - - alertmanager: - image: signoz/alertmanager:0.23.0-0.1 - depends_on: - - query-service - restart: on-failure - command: - - --queryService.url=http://query-service:8085 - - --storage.path=/data - - query-service: - image: signoz/query-service:latest - container_name: query-service - command: ["-config=/root/config/prometheus.yml"] - volumes: - - ./prometheus.yml:/root/config/prometheus.yml - - ../dashboards:/root/config/dashboards - - ./data:/var/lib/signoz - ports: - - "8180:8080" - environment: - - ClickHouseUrl=tcp://clickhouse:9000/?database=signoz_traces - - STORAGE=clickhouse - - GODEBUG=netdns=go - - TELEMETRY_ENABLED=true - healthcheck: - test: ["CMD", "wget", "--spider", "-q", "localhost:8080/api/v1/version"] - interval: 30s - timeout: 5s - retries: 3 - depends_on: - clickhouse: - condition: service_healthy - - otel-collector: - image: signoz/otelcontribcol:0.45.1-0.3 - command: ["--config=/etc/otel-collector-config.yaml"] - volumes: - - ./otel-collector-config.yaml:/etc/otel-collector-config.yaml - ports: - - "4317:4317" # OTLP GRPC receiver - mem_limit: 2000m - restart: always - depends_on: - clickhouse: - condition: service_healthy - - otel-collector-metrics: - image: signoz/otelcontribcol:0.45.1-0.3 - command: ["--config=/etc/otel-collector-metrics-config.yaml"] - volumes: - - ./otel-collector-metrics-config.yaml:/etc/otel-collector-metrics-config.yaml - depends_on: - clickhouse: - condition: service_healthy - - hotrod: - image: jaegertracing/example-hotrod:1.30 - container_name: hotrod - logging: - options: - max-size: 50m - max-file: "3" - command: ["all"] - environment: - - JAEGER_ENDPOINT=http://otel-collector:14268/api/traces - - load-hotrod: - image: "grubykarol/locust:1.2.3-python3.9-alpine3.12" - container_name: load-hotrod - hostname: load-hotrod - environment: - ATTACKED_HOST: http://hotrod:8080 - LOCUST_MODE: standalone - NO_PROXY: standalone - TASK_DELAY_FROM: 5 - TASK_DELAY_TO: 30 - QUIET_MODE: "${QUIET_MODE:-false}" - LOCUST_OPTS: "--headless -u 10 -r 1" - volumes: - - ../../../../deploy/docker/common/locust-scripts:/locust diff --git a/pkg/query-service/tests/test-deploy/docker-compose.yaml b/pkg/query-service/tests/test-deploy/docker-compose.yaml index 4a3ad41870..b1c6a39d7e 100644 --- a/pkg/query-service/tests/test-deploy/docker-compose.yaml +++ b/pkg/query-service/tests/test-deploy/docker-compose.yaml @@ -2,9 +2,11 @@ version: "2.4" services: clickhouse: - image: yandex/clickhouse-server:21.12.3.32 + image: clickhouse/clickhouse-server:22.4.5-alpine volumes: - ./clickhouse-config.xml:/etc/clickhouse-server/config.xml + - ./clickhouse-users.xml:/etc/clickhouse-server/users.xml + - ./clickhouse-storage.xml:/etc/clickhouse-server/config.d/storage.xml restart: on-failure logging: options: @@ -17,8 +19,8 @@ services: timeout: 5s retries: 3 ports: - - "9000:9000" - - "8123:8123" + - "9000:9000" + - "8123:8123" alertmanager: image: signoz/alertmanager:0.23.0-0.1