Skip to content

Commit 0caaf07

Browse files
authored
Lambda maintenance (#5277)
* Update lambda_runtime * Decrease log verbosity * Fix rare race condition on bucket cleanup
1 parent c263c8d commit 0caaf07

File tree

5 files changed

+28
-9
lines changed

5 files changed

+28
-9
lines changed

distribution/lambda/README.md

+14-2
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@ simplify the setup and avoid unstable deployments.
9595
[1]: https://rust-lang-nursery.github.io/rust-cookbook/development_tools/debugging/config_log.html
9696

9797

98+
> [!TIP]
99+
> The Indexer Lambda's logging is quite verbose. To reduce the associated
100+
> CloudWatch costs, you can disable some lower level logs by setting the
101+
> `RUST_LOG` environment variable to `info,quickwit_actors=warn`, or disable
102+
> INFO logs altogether by setting `RUST_LOG=warn`.
103+
98104
Indexer only:
99105
| Variable | Description | Default |
100106
|---|---|---|
@@ -151,12 +157,18 @@ You can query and visualize the Quickwit Searcher Lambda from Grafana by using t
151157

152158
#### Configure Grafana data source
153159

154-
You need to provide the following information.
160+
If you don't have a Grafana instance running yet, you can start one with the Quickwit plugin installed using Docker:
161+
162+
```bash
163+
docker run -e GF_INSTALL_PLUGINS="quickwit-quickwit-datasource" -p 3000:3000 grafana/grafana
164+
```
165+
166+
In the `Connections > Data sources` page, add a new Quickwit data source and configure the following settings:
155167

156168
|Variable|Description|Example|
157169
|--|--|--|
158170
|HTTP URL| HTTP search endpoint for Quickwit Searcher Lambda | https://*******.execute-api.us-east-1.amazonaws.com/api/v1 |
159171
|Custom HTTP Headers| If you configure API Gateway to require an API key, set `x-api-key` HTTP Header | Header: `x-api-key` <br> Value: API key value|
160172
|Index ID| Same as `QW_LAMBDA_INDEX_ID` | hdfs-logs |
161173

162-
After entering these values, click "Save & test" and you can now query your Quickwit Lambda from Grafana!
174+
After entering these values, click "Save & test". You can now query your Quickwit Lambda from Grafana!

distribution/lambda/cdk/cli.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -320,14 +320,16 @@ def _clean_s3_bucket(bucket_name: str, prefix: str = ""):
320320
print(f"Cleaning up bucket {bucket_name}/{prefix}...")
321321
s3 = session.resource("s3")
322322
bucket = s3.Bucket(bucket_name)
323-
bucket.objects.filter(Prefix=prefix).delete()
323+
try:
324+
bucket.objects.filter(Prefix=prefix).delete()
325+
except s3.meta.client.exceptions.NoSuchBucket:
326+
print(f"Bucket {bucket_name} not found, skipping cleanup")
324327

325328

326329
def empty_hdfs_bucket():
327330
bucket_name = _get_cloudformation_output_value(
328331
app.HDFS_STACK_NAME, hdfs_stack.INDEX_STORE_BUCKET_NAME_EXPORT_NAME
329332
)
330-
331333
_clean_s3_bucket(bucket_name)
332334

333335

distribution/lambda/cdk/stacks/examples/mock_data_stack.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,12 @@ def __init__(
165165
index_id=index_id,
166166
index_config_bucket=index_config.s3_bucket_name,
167167
index_config_key=index_config.s3_object_key,
168-
indexer_environment=lambda_env,
168+
indexer_environment={
169+
# the actor system is very verbose when the source is shutting
170+
# down (each Lambda invocation)
171+
"RUST_LOG": "info,quickwit_actors=warn",
172+
**lambda_env,
173+
},
169174
searcher_environment=lambda_env,
170175
indexer_package_location=indexer_package_location,
171176
searcher_package_location=searcher_package_location,

quickwit/Cargo.lock

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

quickwit/quickwit-lambda/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ chrono = { workspace = true }
2626
flate2 = { workspace = true }
2727
http = { workspace = true }
2828
lambda_http = "0.8.0"
29-
lambda_runtime = "0.11.1"
29+
lambda_runtime = "0.13.0"
3030
mime_guess = { workspace = true }
3131
once_cell = { workspace = true }
3232
opentelemetry = { workspace = true }

0 commit comments

Comments
 (0)