Skip to content

Commit e85c97b

Browse files
authored
Merge pull request #26 from rubytogether/segiddins/clickhouse
Add tests + functionality for streaming to clickhouse
2 parents b15f690 + b13c1ef commit e85c97b

17 files changed

+3357
-732
lines changed

Cargo.lock

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

Cargo.toml

+8-3
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,25 @@ default-run = "kirby"
1010
argparse = "0.2.2"
1111
aws_lambda_events = "0.16.0"
1212
enum-map = { version = "0.4.1", features = ["serde"] }
13+
expect-test = "1.5.1"
1314
flate2 = { version = "1.0", features = ["zlib-rs"], default-features = false }
1415
lambda_runtime = { version = "0.13.0", features = ["tracing"] }
1516
lazy_static = "1.1.0"
1617
log = "0.4.5"
1718
percent-encoding = "2.1.0"
1819
rayon = "1.0.2"
19-
regex = "1"
20-
rusoto_core = { version="0.48", default-features=false, features=["rustls"] }
21-
rusoto_s3 = { version="0.48", default-features=false, features=["rustls"] }
20+
regex = "^1.11"
2221
serde = "1.0"
2322
serde_derive = "1.0"
2423
serde_json = "1.0"
24+
serde_with = { version = "3.12.0", default-features = false, features = [
25+
"macros",
26+
] }
2527
time = "0.1"
2628
tokio = "1.44.1"
29+
aws-config = { version = "1.6.0", features = ["behavior-version-latest"] }
30+
aws-sdk-s3 = { version = "1.79.0", features = ["rt-tokio"] }
31+
aws-credential-types = "1.2.2"
2732

2833
[profile.release]
2934
debug = false

bin/bench

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
set -euo pipefail
33

4-
command -v hyperfine > /dev/null || (echo "You need to install 'hyperfine' with cargo or brew." && exit 1)
4+
command -v hyperfine >/dev/null || (echo "You need to install 'hyperfine' with cargo or brew." && exit 1)
55

66
if [[ -z "${1:-}" ]]; then
77
mkdir -p logs
@@ -32,7 +32,7 @@ if [[ -n "${PGO:-}" ]]; then
3232

3333
# STEP 4: Use the `.profdata` file for guiding optimizations
3434
RUSTFLAGS="-Cprofile-use=/tmp/pgo-data/merged.profdata" \
35-
cargo build --release --bin kirby
35+
cargo build --release --bin kirby
3636
else
3737
cargo build --bin kirby --release
3838
fi

bin/deploy-lambda

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
#!/bin/bash
22
set -euo pipefail
33

4-
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4+
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
55
"$DIR/build-lambda"
66
echo "Built new lambda binary"
77

88
set -x
99
cd target/x86_64-unknown-linux-musl/release
1010
zip aws_lambda.zip kirby-s3
11+
cp kirby-s3-clickhouse bootstrap
12+
zip aws_lambda_clickhouse.zip bootstrap
13+
rm bootstrap
1114
cd -
1215

1316
aws lambda update-function-code \
1417
--function-name "kirby-s3" \
1518
--zip-file "fileb://target/x86_64-unknown-linux-musl/release/aws_lambda.zip"
19+
aws lambda update-function-code \
20+
--function-name "kirby-s3-clickhouse" \
21+
--zip-file "fileb://target/x86_64-unknown-linux-musl/release/aws_lambda_clickhouse.zip"
1622
set +x
1723
echo "Deployed new lambda binary"

clickhouse_schema.md

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
## Request Line
2+
3+
field|type|description
4+
---|---|---
5+
timestamp|DateTime|Timestamp of the event
6+
request_path|String|Path of the request
7+
request_query|String|Query string of the request
8+
user_agent|UserAgent|User agent of the client
9+
tls_cipher|String|Cipher used for the connection
10+
time_elapsed|u32|Time elapsed for the request
11+
client_continent|String|Continent of the client
12+
client_country|String|Country of the client
13+
client_region|String|Region of the client
14+
client_city|String|City of the client
15+
client_latitude|nullable String|Latitude of the client
16+
client_longitude|nullable String|Longitude of the client
17+
client_timezone|String|Timezone of the client
18+
client_connection|String|Connection type of the client
19+
request|String|Request method
20+
request_host|String|Host of the request
21+
request_bytes|u32|Bytes sent in the request
22+
http2|bool|HTTP/2 support
23+
tls|nullable bool|whether the connection was encrypted
24+
tls_version|String|TLS version used
25+
response_status|u32|HTTP status code
26+
response_text|String|HTTP status text
27+
response_bytes|u32|Bytes sent in the response
28+
response_cache|low cardinality String|Cache status of the response
29+
cache_state|low cardinality String|Cache state of the response
30+
cache_lastuse|f32|Time since the cache was last used
31+
cache_hits|u32|Number of cache hits
32+
server_region|low cardinality String|Region of the server
33+
server_datacenter|low cardinality String|Datacenter of the server
34+
gem|String|Name of the downloaded gem
35+
version|String|Version of the downloaded gem
36+
platform|Platform|Platform of the downloaded gem
37+
38+
## UserAgent
39+
40+
null values will be omitted
41+
42+
field|type|description
43+
---|---|---
44+
agent_name|nullable String|Name of the user agent
45+
agent_version|nullable String|Version of the user agent
46+
bundler|nullable String|Bundler version
47+
rubygems|nullable String|Rubygems version
48+
ruby|nullable String|Ruby version
49+
platform|nullable Platform|Platform
50+
command|nullable String|Bundler command run
51+
options|nullable String|Options passed to the command
52+
jruby|nullable String|JRuby version
53+
truffleruby|nullable String|TruffleRuby version
54+
ci|nullable String|CI system(s), comma separated
55+
gemstash|nullable String|Gemstash version
56+
57+
## Platform
58+
59+
field|type|description
60+
---|---|---
61+
cpu|low cardinality nullable String|CPU architecture
62+
os|low cardinality nullable String|Operating system
63+
os_version|nullable String|Operating system version

0 commit comments

Comments
 (0)