Skip to content

Commit 0646a91

Browse files
committed
small fixes
1 parent c5b2264 commit 0646a91

File tree

7 files changed

+88
-41
lines changed

7 files changed

+88
-41
lines changed

docs/_snippets/_launch_sql_console.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ If you need a SQL client connection, your ClickHouse Cloud service has an associ
1212

1313
From your ClickHouse Cloud services list, click on a service.
1414

15-
<Image img={cloud_connect_to_sql_console} alt="Connect to SQL Console" size="lg" force/>
15+
<Image img={cloud_connect_to_sql_console} alt="Connect to SQL Console" size="lg" force border/>
1616

1717
This will redirect you to the SQL console.
1818

19-
<Image img={createservice8} alt="SQL Console" size="lg" force/>
19+
<Image img={createservice8} alt="SQL Console" size="lg" force border/>
2020

2121
</details>

docs/migrations/bigquery/migrating-to-clickhouse-cloud.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ The following provides example queries comparing BigQuery to ClickHouse. This li
384384

385385
_BigQuery_
386386

387-
<Image img={bigquery_8} size="md" alt="Rewriting BigQuery queries"/>
387+
<Image img={bigquery_8} size="sm" alt="Rewriting BigQuery queries" border/>
388388

389389
_ClickHouse_
390390

@@ -417,7 +417,7 @@ _BigQuery_
417417

418418
<br />
419419

420-
<Image img={bigquery_9} size="md" alt="BigQuery 1"/>
420+
<Image img={bigquery_9} size="sm" alt="BigQuery 1" border/>
421421

422422
_ClickHouse_
423423

@@ -450,9 +450,9 @@ Where possible, users should exploit ClickHouse aggregate functions. Below, we s
450450

451451
_BigQuery_
452452

453-
<Image img={bigquery_10} size="md" alt="Aggregate functions 1"/>
453+
<Image img={bigquery_10} border size="sm" alt="Aggregate functions 1"/>
454454

455-
<Image img={bigquery_11} size="md" alt="Aggregate functions 2"/>
455+
<Image img={bigquery_11} border size="sm" alt="Aggregate functions 2"/>
456456

457457
_ClickHouse_
458458

@@ -505,7 +505,7 @@ Conditional and array functions make queries significantly simpler. The followin
505505

506506
_BigQuery_
507507

508-
<Image img={bigquery_12} size="md" alt="Conditionals and Arrays"/>
508+
<Image img={bigquery_12} size="sm" border alt="Conditionals and Arrays"/>
509509

510510
_ClickHouse_
511511

docs/tutorial.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ The New York City taxi data contains the details of millions of taxi rides, with
8989
Now that you have a table created, let's add the NYC taxi data. It is in CSV files in S3, and you can load the data from there.
9090
9191
1. The following command inserts ~2,000,000 rows into your `trips` table from two different files in S3: `trips_1.tsv.gz` and `trips_2.tsv.gz`:
92+
9293
```sql
9394
INSERT INTO trips
9495
SELECT * FROM s3(
@@ -499,4 +500,3 @@ Well done - you made it through the tutorial, and hopefully you have a better un
499500
- [Connect your favorite UI/BI tool](./integrations/data-visualization/index.md) to ClickHouse
500501
- Check out the [SQL Reference](./sql-reference/index.md) and browse through the various functions. ClickHouse has an amazing collection of functions for transforming, processing and analyzing data
501502
- Learn more about [Dictionaries](/sql-reference/dictionaries/index.md)
502-

docs/use-cases/observability/grafana.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,15 @@ If adhering to the Grafana requirements for logs, users can select `Query Type:
4949
SELECT Timestamp as timestamp, Body as body, SeverityText as level, TraceId as traceID FROM "default"."otel_logs" WHERE ( timestamp >= $__fromTime AND timestamp <= $__toTime ) ORDER BY timestamp DESC LIMIT 1000
5050
```
5151

52-
<Image img={observability_16} alt="Connector logs config" size="lg"/>
52+
<Image img={observability_16} alt="Connector logs config" size="lg" border/>
5353

5454
The query builder provides a simple means of modifying the query, avoiding the need for users to write SQL. Filtering, including finding logs containing keywords, can be performed from the query builder. Users wishing to write more complex queries can switch to the SQL editor. Provided the appropriate columns are returned, and `logs` selected as the Query Type, the results will be rendered as logs. The required columns for log rendering are listed [here](https://grafana.com/developers/plugin-tools/tutorials/build-a-logs-data-source-plugin#logs-data-frame-format).
5555

5656
### Logs to traces {#logs-to-traces}
5757

5858
If logs contain trace Ids, users can benefit from being able to navigate through to a trace for a specific log line.
5959

60-
<Image img={observability_17} alt="Logs to traces" size="lg"/>
60+
<Image img={observability_17} alt="Logs to traces" size="lg" border/>
6161

6262
## Traces {#traces}
6363

@@ -78,7 +78,7 @@ WHERE ( Timestamp >= $__fromTime AND Timestamp <= $__toTime )
7878

7979
This query returns the column names expected by Grafana, rendering a table of traces as shown below. Filtering on duration or other columns can be performed without needing to write SQL.
8080

81-
<Image img={observability_18} alt="Traces" size="lg"/>
81+
<Image img={observability_18} alt="Traces" size="lg" border/>
8282

8383
Users wishing to write more complex queries can switch to the `SQL Editor`.
8484

@@ -114,7 +114,7 @@ LIMIT 1000
114114
Note how the above query uses the materialized view `otel_traces_trace_id_ts` to perform the trace id lookup. See [Accelerating Queries - Using Materialized views for lookups](/use-cases/observability/schema-design#using-materialized-views-incremental--for-fast-lookups) for further details.
115115
:::
116116

117-
<Image img={observability_19} alt="Trace Details" size="lg"/>
117+
<Image img={observability_19} alt="Trace Details" size="lg" border/>
118118

119119
### Traces to logs {#traces-to-logs}
120120

@@ -128,15 +128,15 @@ WHERE ( traceID = '<trace_id>' )
128128
ORDER BY timestamp ASC LIMIT 1000
129129
```
130130

131-
<Image img={observability_20} alt="Traces to logs" size="lg"/>
131+
<Image img={observability_20} alt="Traces to logs" size="lg" border/>
132132

133133
## Dashboards {#dashboards}
134134

135135
Users can build dashboards in Grafana using the ClickHouse data source. We recommend the Grafana and ClickHouse [data source documentation](https://github.com/grafana/clickhouse-datasource) for further details, especially the [concept of macros](https://github.com/grafana/clickhouse-datasource?tab=readme-ov-file#macros) and [variables](https://grafana.com/docs/grafana/latest/dashboards/variables/).
136136

137137
The plugin provides several out-of-the-box dashboards, including an example dashboard, "Simple ClickHouse OTel dashboarding," for logging and tracing data conforming to the OTel specification. This requires users to conform to the default column names for OTel and can be installed from the data source configuration.
138138

139-
<Image img={observability_21} alt="Dashboards" size="lg"/>
139+
<Image img={observability_21} alt="Dashboards" size="lg" border/>
140140

141141
We provide some simple tips for building visualizations below.
142142

@@ -157,7 +157,7 @@ ORDER BY time ASC
157157
LIMIT 100000
158158
```
159159

160-
<Image img={observability_22} alt="Time series" size="lg"/>
160+
<Image img={observability_22} alt="Time series" size="lg" border/>
161161

162162
### Multi-line charts {#multi-line-charts}
163163

@@ -182,7 +182,7 @@ ORDER BY time ASC
182182
LIMIT 100000
183183
```
184184

185-
<Image img={observability_23} alt="Multi-line charts" size="lg"/>
185+
<Image img={observability_23} alt="Multi-line charts" size="lg" border/>
186186

187187
### Visualizing geo data {#visualizing-geo-data}
188188

@@ -206,4 +206,4 @@ FROM coords
206206
GROUP BY hash
207207
```
208208

209-
<Image img={observability_24} alt="Visualizing geo data" size="lg"/>
209+
<Image img={observability_24} alt="Visualizing geo data" size="lg" border/>

docs/use-cases/observability/introduction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,6 @@ Each trace consists of several spans, with the initial span associated with the
9191

9292
Most observability vendors visualize this information as a waterfall, with relative timing shown using horizontal bars of proportional size. For example, in Grafana:
9393

94-
<Image img={observability_2} alt="Example trace" size="lg"/>
94+
<Image img={observability_2} alt="Example trace" size="lg" border/>
9595

9696
For users needing to familiarize themselves deeply with the concepts of logs and traces, we highly recommend the [OpenTelemetry documentation](https://opentelemetry.io/docs/concepts/).

src/theme/IdealImage/index.tsx

Lines changed: 66 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ export default function IdealImage(
129129
const [isZoomed, setIsZoomed] = useState(false);
130130
const [isLoaded, setIsLoaded] = useState(false);
131131
const imageRef = useRef<HTMLDivElement>(null);
132+
const [networkType, setNetworkType] = useState<string | null>(null);
132133

133134
useEffect(() => {
134135
if (!imageRef.current) return;
@@ -186,7 +187,12 @@ export default function IdealImage(
186187
};
187188

188189
const img_component = force ? (
189-
<img width={currentImage.width ?? 100} alt={alt} src={currentImage.path} />
190+
<img
191+
width={currentImage.width ?? 100}
192+
alt={alt}
193+
src={currentImage.path}
194+
style={imageStyles}
195+
/>
190196
) : (
191197
<ReactIdealImage
192198
{...propsRest}
@@ -202,17 +208,66 @@ export default function IdealImage(
202208
style={imageStyles}
203209
/>
204210
);
205-
let connection = null;
206-
if ("connection" in navigator) {
207-
connection =
208-
navigator.connection ||
209-
navigator.mozConnection ||
210-
navigator.webkitConnection;
211-
}
211+
212+
useEffect(() => {
213+
if ("connection" in navigator) {
214+
const connection =
215+
navigator.connection ||
216+
navigator.mozConnection ||
217+
navigator.webkitConnection;
218+
setNetworkType(connection.effectiveType);
219+
} else {
220+
const controller = new AbortController();
221+
const signal = controller.signal;
222+
const timeout = setTimeout(() => {
223+
console.log("Timeout reached, aborting fetch...");
224+
controller.abort();
225+
setNetworkType("3g");
226+
}, 1000); // 1 second timeout
227+
228+
const testSpeed = async () => {
229+
console.log("Downloading...");
230+
const url = currentImage.path!;
231+
const startTime = performance.now();
232+
233+
try {
234+
const response = await fetch(url, { signal, cache: "force-cache" });
235+
const endTime = performance.now();
236+
const duration = (endTime - startTime) / 1000;
237+
238+
clearTimeout(timeout);
239+
240+
if (duration > 1) {
241+
console.log("Took too long, setting as 3g");
242+
setNetworkType("3g");
243+
} else {
244+
console.log("Loaded quickly, setting as 4g");
245+
setNetworkType("4g");
246+
}
247+
} catch (error) {
248+
if (error.name === "AbortError") {
249+
console.log("Fetch aborted due to timeout.");
250+
setNetworkType("3g");
251+
} else {
252+
console.error("Fetch failed:", error);
253+
setNetworkType("3g");
254+
}
255+
}
256+
};
257+
258+
testSpeed();
259+
260+
return () => {
261+
clearTimeout(timeout);
262+
controller.abort();
263+
};
264+
}
265+
}, [currentImage.path]);
266+
212267
return (
213268
<div style={containerStyles}>
214269
{/* Zoomed Image */}
215-
{connection && connection.effectiveType == "4g" && (
270+
{networkType == "4g" && (
216271
<ControlledZoom
217272
isZoomed={isZoomed}
218273
onZoomChange={handleZoomChange}
@@ -232,17 +287,9 @@ export default function IdealImage(
232287
)}
233288
<div
234289
ref={imageRef}
235-
onClick={() =>
236-
connection &&
237-
connection.effectiveType == "4g" &&
238-
isLoaded &&
239-
setIsZoomed(true)
240-
}
290+
onClick={() => networkType == "4g" && isLoaded && setIsZoomed(true)}
241291
style={{
242-
cursor:
243-
connection && connection.effectiveType == "4g" && isLoaded
244-
? "zoom-in"
245-
: "default",
292+
cursor: networkType == "4g" && isLoaded ? "zoom-in" : "default",
246293
}}
247294
>
248295
{img_component}

src/theme/IdealImage/styles.module.css

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
.customZoom [data-rmiz-modal-img] {
33
transition-duration: 0.2s;
44
transition-timing-function: linear;
5-
background-color: rgb(0, 0, 0);
5+
background-color: rgb(31 31 28);
66
}
77
.customZoom [data-rmiz-modal-overlay="hidden"] {
8-
background-color: rgb(0, 0, 0);
8+
background-color: rgb(31 31 28);
99
}
1010
.customZoom [data-rmiz-modal-overlay="visible"] {
11-
background-color: rgb(0, 0, 0);
11+
background-color: rgb(31 31 28);
1212
}
1313
.customZoom [data-rmiz-btn-unzoom] {
1414
display: none;
1515
}
1616

1717
.customWhiteZoom [data-rmiz-modal-img] {
18-
background-color: rgb(31 31 28) !important;
18+
background-color: rgb(255 255 255) !important;
1919
}

0 commit comments

Comments
 (0)