Skip to content

Commit 7cc3c19

Browse files
authored
Merge branch 'main' into dev-fast-parquet-splits
2 parents 431844d + d28aa6a commit 7cc3c19

File tree

16 files changed

+233
-257
lines changed

16 files changed

+233
-257
lines changed

docs/doc/13-monitor/jaeger.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Monitoring with Jaeger
2+
title: Jaeger
33
---
44

55
[Jaeger](https://github.com/jaegertracing/jaeger) is an open-source, end-to-end distributed tracing tool that originated from [Uber](https://www.uber.com/). It helps monitor and troubleshoot microservices-based applications.
@@ -16,9 +16,9 @@ This tutorial uses the All In One image to deploy Jaeger in Docker. If you alrea
1616
docker run -d -p6831:6831/udp -p6832:6832/udp -p16686:16686 jaegertracing/all-in-one:latest
1717
```
1818

19-
### Step 2. Deploy Databend
19+
### Step 2. Set Environment Variables
2020

21-
1. Set the following environment variables according to your actual tracing level requirements and Jaeger endpoint.
21+
Set the following environment variables according to your actual tracing level requirements and Jaeger endpoint.
2222
- `RUST_LOG`: Sets the log level.
2323
- `DATABEND_JAEGER_AGENT_ENDPOINT`: Sets the endpoint the Jaeger agent is listening on.
2424

@@ -27,17 +27,19 @@ export RUST_LOG=DEBUG
2727
export DATABEND_JAEGER_AGENT_ENDPOINT=localhost:6831
2828
```
2929

30-
2. Follow the [Deployment Guide](https://databend.rs/doc/deploy) to deploy Databend.
30+
### Step 3. Deploy Databend
3131

32-
3. Run the following SQL statements:
32+
1. Follow the [Deployment Guide](https://databend.rs/doc/deploy) to deploy Databend.
33+
34+
2. Run the following SQL statements:
3335

3436
```sql
3537
CREATE TABLE t1(a INT);
3638
INSERT INTO t1 VALUES(1);
3739
INSERT INTO t1 SELECT * FROM t1;
3840
```
3941

40-
### Step 3. Check Tracing Information on Jaegar
42+
### Step 4. Check Tracing Information on Jaegar
4143

4244
1. Go to <http://127.0.0.1:16686/> and select the **Search** tab.
4345

docs/doc/13-monitor/sentry.md

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,51 @@
11
---
2-
title: Monitoring with Sentry
2+
title: Sentry
33
---
44

5-
With automated error reporting, you can not only get alerted when something breaks, but also access the details you need to reproduce the issue.
5+
[Sentry](https://sentry.io/welcome/) is a developer-first error tracking and performance monitoring platform that helps developers see what actually matters, solve quicker, and learn continuously about their applications.
66

7-
## Sentry
7+
Databend provides integration with both Cloud and self-hosted Sentry solutions. The following tutorial walks you through the integration process.
88

9-
Databend provides integration with [Sentry](https://github.com/getsentry/sentry), a developer-first error tracking and performance monitoring platform.
9+
## Tutorial: Monitor Databend with Sentry
1010

11-
### Deploy Sentry
11+
### Step 1. Deploy Sentry
1212

13-
You can use Sentry as a cloud service by signing up at [sentry.io](https://sentry.io), or you can host it yourself by following the instructions at [Self-Hosted Sentry](https://develop.sentry.dev/self-hosted/).
13+
To deploy an on-premises Sentry, follow the instructions: https://develop.sentry.dev/self-hosted/
1414

15-
<img src="/img/tracing/sentry-hosted.png"/>
15+
This tutorial uses the Sentry service on the cloud. To sign up an account for Cloud Sentry, go to https://sentry.io
1616

17-
### Create a Project
17+
### Step 2. Create a Sentry Project
1818

19-
To use Sentry with Databend, you need to create a project in Sentry and get its DSN (Data Source Name). The DSN is a unique identifier for your project that tells Sentry where to send your data. In this example, the DSN is `http://[email protected]:9000/5`
19+
Once you're logged into Sentry, create a Sentry project for the `Rust` platform to start. For how to create a project on Sentry, see https://docs.sentry.io/product/sentry-basics/integrate-frontend/create-new-project/
2020

21-
<img src="/img/tracing/sentry-get-dsn.png"/>
21+
![Alt text](../../public/img/tracing/sentry-rust.png)
2222

23-
### Start Databend
23+
### Step 3. Set Environment Variables
2424

25-
You can start Databend with Sentry in two ways:
25+
1. Get the DSN (Data Source Name) of your project. For what DSN is and where to find it, see https://docs.sentry.io/product/sentry-basics/dsn-explainer/
2626

27-
- **Enable Error Tracking Only**
27+
2. Set environment variables.
2828

29-
This option will only use the `sentry-log` feature, which will send error logs to Sentry.
29+
- To enable the error-tracking feature, run the following commands:
3030

31-
```bash
32-
export DATABEND_SENTRY_DSN="<your-sentry-dsn>"
33-
```
31+
```bash
32+
export DATABEND_SENTRY_DSN="<your-DSN>"
33+
```
3434

35-
<img src="/img/tracing/sentry-error.png"/>
35+
- To enable the performance monitoring feature, run the following commands:
3636

37-
- **Also Enable Performance Monitoring**
37+
```bash
38+
export DATABEND_SENTRY_DSN="<your-DSN>"
39+
export SENTRY_TRACES_SAMPLE_RATE=1.0 LOG_LEVEL=DEBUG
40+
```
41+
:::tip
42+
Set `SENTRY_TRACES_SAMPLE_RATE` to a small value in production.
43+
:::
3844

39-
Setting `SENTRY_TRACES_SAMPLE_RATE` greater than `0.0` will allow sentry to perform trace sampling, which will help set up performance monitoring.
45+
### Step 4. Deploy Databend
4046

41-
```bash
42-
export DATABEND_SENTRY_DSN="<your-sentry-dsn>"
43-
export SENTRY_TRACES_SAMPLE_RATE=1.0 LOG_LEVEL=DEBUG
44-
```
47+
Follow the [Deployment Guide](https://databend.rs/doc/deploy) to deploy Databend.
4548

46-
**Note:** Set `SENTRY_TRACES_SAMPLE_RATE` a to lower value in production.
49+
You're all set now. Check the pages on Sentry for alerts and performce information.
4750

48-
<img src="/img/tracing/sentry-performance.png"/>
51+
![Alt text](../../public/img/tracing/sentry-done.png)
857 KB
Loading
132 KB
Loading

src/meta/api/src/schema_api_impl.rs

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1869,6 +1869,15 @@ impl<KV: kvapi::KVApi<Error = MetaError>> SchemaApi for KV {
18691869
let mut retry = 0;
18701870
let table_id = req.table_id;
18711871

1872+
let mut keys = Vec::with_capacity(req.file_info.len());
1873+
for file in req.file_info.iter() {
1874+
let key = TableCopiedFileNameIdent {
1875+
table_id,
1876+
file: file.0.clone(),
1877+
};
1878+
keys.push(key.to_string_key());
1879+
}
1880+
18721881
while retry < TXN_MAX_RETRY_TIMES {
18731882
retry += 1;
18741883

@@ -1900,25 +1909,32 @@ impl<KV: kvapi::KVApi<Error = MetaError>> SchemaApi for KV {
19001909
// So now, in case that `TableCopiedFileInfo` has expire time, remove `TableCopiedFileLockKey`
19011910
// in each function. In this case there is chance that some `TableCopiedFileInfo` may not be
19021911
// removed in `remove_table_copied_files`, but these data can be purged in case of expire time.
1903-
for (file, file_info) in req.file_info.iter() {
1904-
let key = TableCopiedFileNameIdent {
1905-
table_id,
1906-
file: file.to_owned(),
1907-
};
1908-
let (file_seq, _): (_, Option<TableCopiedFileInfo>) =
1909-
get_pb_value(self, &key).await?;
1910-
1911-
condition.push(txn_cond_seq(&key, Eq, file_seq));
1912-
match &req.expire_at {
1913-
Some(expire_at) => {
1914-
if_then.push(txn_op_put_with_expire(
1915-
&key,
1916-
serialize_struct(file_info)?,
1917-
*expire_at,
1918-
));
1919-
}
1920-
None => {
1921-
if_then.push(txn_op_put(&key, serialize_struct(file_info)?));
1912+
1913+
let mut file_name_infos = req.file_info.clone().into_iter();
1914+
1915+
for c in keys.chunks(DEFAULT_MGET_SIZE) {
1916+
let seq_infos: Vec<(u64, Option<TableCopiedFileInfo>)> =
1917+
mget_pb_values(self, c).await?;
1918+
1919+
for (file_seq, _file_info_opt) in seq_infos {
1920+
let (f_name, file_info) = file_name_infos.next().unwrap();
1921+
1922+
let key = TableCopiedFileNameIdent {
1923+
table_id,
1924+
file: f_name.to_owned(),
1925+
};
1926+
condition.push(txn_cond_seq(&key, Eq, file_seq));
1927+
match &req.expire_at {
1928+
Some(expire_at) => {
1929+
if_then.push(txn_op_put_with_expire(
1930+
&key,
1931+
serialize_struct(&file_info)?,
1932+
*expire_at,
1933+
));
1934+
}
1935+
None => {
1936+
if_then.push(txn_op_put(&key, serialize_struct(&file_info)?));
1937+
}
19221938
}
19231939
}
19241940
}

0 commit comments

Comments
 (0)