Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
4ca99d0
add otel_grpc param
YaroslavLitvinov Dec 13, 2025
f3743d9
use registry for both logs and spans
YaroslavLitvinov Dec 13, 2025
f41c269
add collector artifacts into gitignore
YaroslavLitvinov Dec 13, 2025
bfbcb92
shitdown tracing provider
YaroslavLitvinov Dec 15, 2025
ac6ba62
fixes for honeycomb
DanCodedThis Dec 15, 2025
7c7e623
tracing: OTLP layers (#91)
DanCodedThis Dec 15, 2025
cb71b11
staged
YaroslavLitvinov Dec 16, 2025
ccc4f44
fix make build
DanCodedThis Dec 16, 2025
2901926
fix make build
DanCodedThis Dec 16, 2025
00194c8
fix make build
DanCodedThis Dec 16, 2025
49420b2
fix make build
DanCodedThis Dec 16, 2025
49d289b
fix make delpoy logs group auto creation
DanCodedThis Dec 16, 2025
a57e880
fix make delpoy logs group auto creation
DanCodedThis Dec 16, 2025
b8dc78a
autoamticl url and hhtp access rule
DanCodedThis Dec 16, 2025
21ab90c
fix final hopefully
DanCodedThis Dec 16, 2025
2d327d9
deploy via cargo command
DanCodedThis Dec 16, 2025
2187740
env exmaple
DanCodedThis Dec 16, 2025
4d2b0af
small readme
DanCodedThis Dec 16, 2025
c53e5e8
fmt
DanCodedThis Dec 16, 2025
4c2822e
fixes
DanCodedThis Dec 16, 2025
4799201
fixes
DanCodedThis Dec 16, 2025
d7ae975
remove experiment files
YaroslavLitvinov Dec 16, 2025
c6b601b
fixes
YaroslavLitvinov Dec 16, 2025
16f6f46
fixes
DanCodedThis Dec 16, 2025
3d3d7a9
fixes
DanCodedThis Dec 16, 2025
e5736ca
fixes
DanCodedThis Dec 16, 2025
d45b05f
fixes
DanCodedThis Dec 16, 2025
44138bd
fixes
DanCodedThis Dec 16, 2025
7d11d82
fixes
DanCodedThis Dec 16, 2025
c1d79ed
fixes
DanCodedThis Dec 16, 2025
7412651
add observability
YaroslavLitvinov Dec 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions config/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
METASTORE_CONFIG=config/metastore.yaml
JWT_SECRET=secret
RUST_LOG=info
TRACING_LEVEL=info
OTEL_SERVICE_NAME=embucket-lambda-api
HONEYCOMB_API_KEY=full_ingest_key
HONEYCOMB_ENDPOINT_URL=api.honeycomb.io:443
1 change: 1 addition & 0 deletions crates/api-snowflake-rest/src/tests/create_test_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ pub fn executor_default_cfg() -> UtilsConfig {
UtilsConfig::default().with_max_concurrency_level(2)
}

#[must_use]
pub fn metastore_default_settings_cfg() -> MetastoreSettingsConfig {
MetastoreSettingsConfig::default()
.with_object_store_connect_timeout(1)
Expand Down
13 changes: 7 additions & 6 deletions crates/embucket-lambda/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ executor = { path = "../executor" }
build-info = { path = "../build-info" }
lambda_http = "0.17"
tokio = { workspace = true }
tracing = { workspace = true }
tracing-subscriber = { version = "0.3", features = ["env-filter", "fmt"] }
base64 = "0.22"
serde = { workspace = true }
serde_json = { workspace = true }
Expand All @@ -26,6 +24,13 @@ flate2 = { version = "1", default-features = false, features = ["rust_backend"]
tower = { workspace = true }
tower-http = { workspace = true }
cfg-if = { workspace = true }
tracing = { workspace = true }
tracing-subscriber = { version = "0.3.20", features = ["env-filter", "registry", "fmt", "json"] }
tracing-opentelemetry = { version = "0.31.0" }
tracing-allocations = { version = "0.1.0", optional = true }
opentelemetry-otlp = { version = "0.30.0", features = ["grpc-tonic"] }
opentelemetry_sdk = { version = "0.30.0" }
opentelemetry = { version = "0.30.0" }

[lints]
workspace = true
Expand Down Expand Up @@ -54,7 +59,3 @@ tracing = "Active"
# Note: include path is relative to workspace root
# Must run deploy from workspace root: cargo lambda deploy --binary-name bootstrap
include = ["config"]

[package.metadata.lambda.deploy.env]
LOG_FORMAT = "json"
METASTORE_CONFIG = "config/metastore.yaml"
34 changes: 31 additions & 3 deletions crates/embucket-lambda/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,47 @@

# Function name (override with: make deploy FUNCTION_NAME=your-function)
FUNCTION_NAME ?= embucket-lambda
ENV_FILE ?= .env

ENV_FILE ?= config/.env
IAM_ROLE ?= arn:aws:iam::767397688925:role/EmbucketLambdaExecRole
# --layer-arn required for flexibiity
# otel-collector-config goes second as it overrides original config from opentelemetry-collector
OTEL_COLLECTOR_LAYERS ?= \
--layer-arn arn:aws:lambda:us-east-2:184161586896:layer:opentelemetry-collector-arm64-0_19_0:1\
--layer-arn arn:aws:lambda:us-east-2:767397688925:layer:otel-collector-config:22\
--layer-arn arn:aws:lambda:us-east-2:580247275435:layer:LambdaInsightsExtension-Arm64:33

# supported features: "streaming"
FEATURES_PARAM := $(if $(FEATURES),--features $(FEATURES))

build:
cd ../.. && cargo lambda build --release --arm64 --manifest-path crates/embucket-lambda/Cargo.toml $(FEATURES_PARAM)
cd ../.. && cargo lambda build --release -p embucket-lambda --arm64 -o zip --include config/metastore.yaml --manifest-path crates/embucket-lambda/Cargo.toml $(FEATURES_PARAM)

# Deploy to AWS (must run from workspace root for include paths to work)
deploy: build deploy-only
@echo "Deployed $(FUNCTION_NAME) to AWS"

# Quick deploy without rebuild
deploy-only:
cd ../.. && cargo lambda deploy --binary-name bootstrap $(FUNCTION_NAME) --env-file $(ENV_FILE)
@test -n "$(FUNCTION_NAME)" || (echo "ERROR: Missing function name. Use: make deploy <function-name>" >&2; exit 1)
cd ../.. && cargo lambda deploy $(OTEL_COLLECTOR_LAYERS) --iam-role $(IAM_ROLE) --env-file $(ENV_FILE) --binary-name bootstrap $(FUNCTION_NAME)
aws logs create-log-group --log-group-name "/aws/lambda/$(FUNCTION_NAME)" >/dev/null 2>&1 || true
@$(MAKE) url FUNCTION_NAME=$(FUNCTION_NAME)

url:
@test -n "$(FUNCTION_NAME)" || (echo "ERROR: Missing function name. Use: make url <function-name>" >&2; exit 1)
@set -e; \
echo "Ensuring Function URL config exists for $(FUNCTION_NAME) (auth: NONE)..." ; \
aws lambda create-function-url-config --function-name "$(FUNCTION_NAME)" --auth-type NONE >/dev/null 2>&1 || \
aws lambda update-function-url-config --function-name "$(FUNCTION_NAME)" --auth-type NONE >/dev/null ; \
echo "Ensuring public invoke permission exists..." ; \
aws lambda add-permission --function-name "$(FUNCTION_NAME)" \
--statement-id AllowPublicURLInvoke \
--action lambda:InvokeFunctionUrl \
--principal "*" \
--function-url-auth-type NONE >/dev/null 2>&1 || true ; \
URL="$$(aws lambda get-function-url-config --function-name "$(FUNCTION_NAME)" --query 'FunctionUrl' --output text)"; \
echo "$$URL"

# Watch locally for development
watch:
Expand All @@ -27,6 +54,7 @@ test:

# Tail lambda logs
logs:
@test -n "$(FUNCTION_NAME)" || (echo "ERROR: Missing function name. Use: make deploy <function-name>" >&2; exit 1)
aws logs tail /aws/lambda/$(FUNCTION_NAME) --since 5m --follow

# Verify deployment with snow CLI
Expand Down
19 changes: 19 additions & 0 deletions crates/embucket-lambda/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ make verify
make logs
```

`make deploy` will build, deploy with .env vars and with the iam-role in the makefile, add logs group, create a url, add allow uri access policy. And volia - it works.
P.S. Don't forget to change host url in the `snowcli` config.

The function name defaults to `embucket-lambda` but can be overridden:
- Via Makefile variable: `make deploy FUNCTION_NAME=my-function`
- Via environment variable: `export FUNCTION_NAME=my-function && make deploy`
Expand Down Expand Up @@ -77,6 +80,21 @@ cargo lambda deploy --binary-name bootstrap
```
- It will deploy envs from `.env` if `ENV_FILE` not specified

### Observability


#### AWS traces
We send events, spans to stdout log in json format, and in case if AWS X-Ray is enabled it enhances traces.
- `RUST_LOG` - Controls verbosity log level. Default to "INFO", possible values: "OFF", "ERROR", "WARN", "INFO", "DEBUG", "TRACE".

#### Exporting telemetry spans to [**honeycomb.io**](https://docs.honeycomb.io/send-data/opentelemetry/collector/)
- Required environment variables configuring remote Observability platform:
* `HONEYCOMB_API_KEY`
* `HONEYCOMB_ENDPOINT_URL`
- Optional:
* `OTEL_SERVICE_NAME`
- `TRACING_LEVEL` - verbosity level, default to "INFO", possible values: "OFF", "ERROR", "WARN", "INFO", "DEBUG", "TRACE".

### Test locally

```bash
Expand Down Expand Up @@ -107,5 +125,6 @@ aws logs tail /aws/lambda/embucket-lambda --since 5m --follow
- `LOG_FORMAT`: json
- `METASTORE_CONFIG`: config/metastore.yaml
- `RUST_LOG`: (optional) Set logging level, defaults to "info"
- `TRACING_LEVEL`: (optional) Set tracing level, defaults to "info"


9 changes: 9 additions & 0 deletions crates/embucket-lambda/extensions/collector-config/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
To update the layer config:
1. `cd crates/embucket-lambda/extensions`
2. `zip -r otel-collector-config-layer.zip collector-config`
3. `cd ../../..`
4. `aws lambda publish-layer-version
--layer-name otel-collector-config
--zip-file fileb://config/layer-root/otel-collector-config-layer.zip
--compatible-runtimes provided.al2 provided.al2023
--compatible-architectures arm64`
23 changes: 23 additions & 0 deletions crates/embucket-lambda/extensions/collector-config/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:4318

processors:
batch:

exporters:
otlp:
endpoint: "${env:HONEYCOMB_ENDPOINT_URL}"
headers:
x-honeycomb-team: "${env:HONEYCOMB_API_KEY}"

service:
pipelines:
traces:
receivers: [otlp]
processors: [batch]
exporters: [otlp]
8 changes: 8 additions & 0 deletions crates/embucket-lambda/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ pub struct EnvConfig {
pub iceberg_catalog_timeout_secs: u64,
pub object_store_timeout_secs: u64,
pub object_store_connect_timeout_secs: u64,
pub otel_grpc: bool,
pub tracing_level: String,
pub log_format: String,
pub log_filter: String,
}

impl EnvConfig {
Expand Down Expand Up @@ -58,6 +62,10 @@ impl EnvConfig {
object_store_timeout_secs: parse_env("OBJECT_STORE_TIMEOUT_SECS").unwrap_or(30),
object_store_connect_timeout_secs: parse_env("OBJECT_STORE_CONNECT_TIMEOUT_SECS")
.unwrap_or(3),
otel_grpc: parse_env("OTEL_GRPC").unwrap_or(true),
tracing_level: env_or_default("TRACING_LEVEL", "INFO"),
log_format: env_or_default("LOG_FORMAT", "json"),
log_filter: parse_env("RUST_LOG").unwrap_or_else(|| "INFO".to_string()),
}
}

Expand Down
Loading