Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
37c7045
Issue-256 - Add test tools for echo command
huntharo Jan 4, 2025
4725ee7
Issue-256 - Add access log and debug request
huntharo Jan 4, 2025
2b42d9b
Issue-256 - Drop some log levels
huntharo Jan 4, 2025
77fed60
Issue-256 - Add initial access log
huntharo Jan 4, 2025
a511f57
Issue-256 - Update package-lock for demo-app
huntharo Jan 4, 2025
71cddae
Issue-256 - Update the yarn.lock
huntharo Jan 4, 2025
4e05ba4
Issue-256 - Remove clone from param names
huntharo Jan 4, 2025
393282e
Issue-256 - Add comment on image source
huntharo Jan 4, 2025
9942737
Issue-256 - Log response bytes and request bytes
huntharo Jan 5, 2025
84d204b
Issue-256 - Fix latency tracking
huntharo Jan 5, 2025
4c3c7d3
Issue-256 - Add additional logging
huntharo Jan 5, 2025
e0ecd44
Issue-256 - Update log message
huntharo Jan 5, 2025
11d9c57
Issue-256 - Add better exception message for hang
huntharo Jan 5, 2025
e82c5a1
Issue-256 - Add timing info to crash location
huntharo Jan 5, 2025
8febfdd
Issue-256 - Split logging of read/write exceptions
huntharo Jan 5, 2025
e403e59
Issue-256 - Improve RelayResponseFromLambda logs
huntharo Jan 5, 2025
ef6dd84
Issue-256 - Add debug logging for /echo
huntharo Jan 5, 2025
1397490
Issue-256 - Drop AWS log settings
huntharo Jan 5, 2025
9900ff7
Issue-256 - Add debug logging to extension
huntharo Jan 5, 2025
a7dfe62
Issue-256 - Router - Add access logs
huntharo Jan 6, 2025
ba3fab2
Issue-256 - Additional logging
huntharo Jan 6, 2025
c7fc4fd
Issue-256 - Catch exceptions on CTS and TCS
huntharo Jan 6, 2025
67d16bd
Issue-256 - Fix body bytes count on header overflow
huntharo Jan 6, 2025
b2b03ab
Issue-256 - Make it clear what is being read
huntharo Jan 6, 2025
2d086e2
Issue-256 - Log request relay to lambda
huntharo Jan 6, 2025
5bee016
Issue-256 - Fix warning
huntharo Jan 6, 2025
5f92dc7
Issue-256 - Add values to identify router build
huntharo Jan 6, 2025
dccd4b1
Issue-256 - Add back the PR label for router
huntharo Jan 6, 2025
931ebc1
Issue-256 - Catch more TCS exceptions
huntharo Jan 6, 2025
224f834
Issue-256 - Remove access to incomingrequest
huntharo Jan 6, 2025
dc6d403
Issue-256 - Possible TransferEncoding fix
huntharo Jan 6, 2025
e2df9b5
Issue-256 - Add more debug logs
huntharo Jan 6, 2025
0c5050d
Issue-256 - Try to fix captured values issue
huntharo Jan 6, 2025
016aa84
Issue-256 - Replace Console with Logger
huntharo Jan 6, 2025
2a850c4
Issue-256 - Grant permission to the log group
huntharo Jan 6, 2025
e9da16e
Issue-256 - Set the LogGroup name
huntharo Jan 6, 2025
3182b55
Issue-256 - Fix log message
huntharo Jan 6, 2025
c479412
Issue-256 - Add exception log
huntharo Jan 6, 2025
1c0ec17
Issue-256 - Fix up Router Test Client
huntharo Jan 7, 2025
6cd0069
Issue-256 - Fix echo-local chunked response
huntharo Jan 7, 2025
93bda29
Issue-256 - Make full duplex http/1.1 test client
huntharo Jan 7, 2025
c249e36
Issue-256 - echo-local
huntharo Jan 7, 2025
8e92081
Issue-256 - Update test client readme
huntharo Jan 7, 2025
71140b2
Issue-256 - TestClient - Update logs
huntharo Jan 8, 2025
db37dde
Issue-256 - Add demo-app ECS task
huntharo Jan 11, 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
18 changes: 15 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Set up values to identify image build
id: image-ids
run: |
echo "BUILD_TIME=$(date)" >> $GITHUB_OUTPUT
echo "GIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT

- name: Configure AWS Credentials
if: needs.check-access.outputs.has-token-access == 'true'
uses: aws-actions/configure-aws-credentials@v4
Expand Down Expand Up @@ -146,7 +152,10 @@ jobs:
with:
context: .
file: ./DockerfileRouter
build-args: BUILD_ARCH=${{ matrix.build_arch }}
build-args: |
BUILD_ARCH=${{ matrix.build_arch }}
BUILD_TIME=${{ steps.image-ids.outputs.BUILD_TIME }}
GIT_HASH=${{ steps.image-ids.outputs.GIT_HASH }}
platforms: ${{ matrix.platform }}
outputs: |
type=image,name=${{ env.PRIVATE_REGISTRY_IMAGE }},push-by-digest=${{ needs.check-access.outputs.has-token-access == 'true' }},name-canonical=true,push=${{ needs.check-access.outputs.has-token-access == 'true' }}
Expand All @@ -157,7 +166,10 @@ jobs:
with:
context: .
file: ./DockerfileRouter
build-args: BUILD_ARCH=${{ matrix.build_arch }}
build-args: |
BUILD_ARCH=${{ matrix.build_arch }}
BUILD_TIME=${{ steps.image-ids.outputs.BUILD_TIME }}
GIT_HASH=${{ steps.image-ids.outputs.GIT_HASH }}
platforms: ${{ matrix.platform }}
outputs: |
type=image,name=${{ env.PUBLIC_REGISTRY_IMAGE }},push-by-digest=${{ needs.check-access.outputs.has-token-access == 'true' }},name-canonical=true,push=${{ needs.check-access.outputs.has-token-access == 'true' }}
Expand Down Expand Up @@ -236,7 +248,7 @@ jobs:
enable=${{ github.event_name == 'release' }},type=raw,value=latest
type=ref,event=branch
type=semver,pattern={{version}}
# Custom combined PR+SHA tag
type=ref,event=pr
type=ref,event=pr,suffix=-{{sha}}
labels: |
org.opencontainers.image.source=${{ github.event.repository.html_url }}
Expand Down
22 changes: 21 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,32 @@
"LAMBDA_DISPATCH_FunctionName": "arn:aws:lambda:us-east-2:220761759939:function:dogs",
"LAMBDA_DISPATCH_InstanceCountMultiplier": "1",
"LAMBDA_DISPATCH_MaxConcurrentCount": "1",
"LAMBDA_DISPATCH_AllowInsecureControlChannel": "true",
"LAMBDA_DISPATCH_PreferredControlChannelScheme": "http",
"AWS_ACCESS_KEY_ID": "test-access-key-id",
"AWS_SECRET_ACCESS_KEY": "test-secret-access-key",
"AWS_SESSION_TOKEN": "test-session-token",
"AWS_LAMBDA_SERVICE_URL": "http://localhost:5051"
// "AWS_LAMBDA_SERVICE_URL": "http://host.docker.internal:5051"
}
},
},
{
"name": "Router (test request)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build-router-test",
"program": "${workspaceFolder}/test/PwrDrvr.LambdaDispatch.Router.TestClient/bin/Debug/net8.0/PwrDrvr.LambdaDispatch.Router.TestClient.dll",
"args": [
"https://lambdadispatch-pr-257.ghpublic.pwrdrvr.com/echo-local",
//"http://localhost:5001/echo-local?foo=bar",
"./src/demo-app/public/silly-test-6MB.jpg",
"--verbose"
],
"cwd": "${workspaceFolder}",
"console": "internalConsole",
"stopAtEntry": false,
"env": {
},
},
{
"name": ".NET Core Attach",
Expand Down
13 changes: 13 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,19 @@
],
"problemMatcher": "$msCompile"
},
{
"label": "build-router-test",
"command": "dotnet",
"type": "process",
"args": [
"build",
"test/PwrDrvr.LambdaDispatch.Router.TestClient",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary;ForceNoAlign",
"/property:TestRunners=true",
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
Expand Down
4 changes: 3 additions & 1 deletion DockerfileLambdaDemoApp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ COPY src/demo-app/ ./
# Build the app
RUN npm run build


#
# During GitHub Actions this gets swapped in for the PR built extension, using sed
#
FROM lambda-dispatch-extension AS extension

#
Expand Down
10 changes: 10 additions & 0 deletions docker-compose-demo-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: '3.3'
services:
# This is just for testing the demo-app as a non-Lambda express app
lambdademoapp:
platform: linux/arm64
build:
context: .
dockerfile: DockerfileLambdaDemoApp
ports:
- 3002:3001
7 changes: 4 additions & 3 deletions extension/src/app_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub async fn read_until_req_headers(
pool_id: &str,
lambda_id: &str,
channel_id: &str,
) -> Result<(hyper::http::request::Builder, bool, Vec<u8>), LambdaRequestError> {
) -> Result<(hyper::http::request::Builder, bool, Vec<u8>, String), LambdaRequestError> {
let mut buf = Vec::<u8>::with_capacity(32 * 1024);

while let Some(chunk) =
Expand Down Expand Up @@ -51,7 +51,7 @@ pub async fn read_until_req_headers(
match req.parse(&buf) {
Ok(httparse::Status::Complete(offset)) => {
if req.path.unwrap() == "/_lambda_dispatch/goaway" {
return Ok((Request::builder(), true, Vec::<u8>::new()));
return Ok((Request::builder(), true, Vec::<u8>::new(), String::new()));
}

log::debug!(
Expand All @@ -66,6 +66,7 @@ pub async fn read_until_req_headers(
// Next.js, for one, gives a 308 redirect if you give it `http://localhost:3000/`
// and it mangles that to `http:/localhost:3000/`
let app_url = format!("{}{}", app_endpoint, req.path.unwrap());
let app_url_str = app_url.clone();
let app_url = Uri::from_str(app_url.as_str()).unwrap();

let mut app_req_bld = Request::builder()
Expand Down Expand Up @@ -103,7 +104,7 @@ pub async fn read_until_req_headers(
);
}

return Ok((app_req_bld, false, left_over_buf));
return Ok((app_req_bld, false, left_over_buf, app_url_str));
}
Ok(httparse::Status::Partial) => {
log::debug!("Partial header received, waiting for more data");
Expand Down
2 changes: 1 addition & 1 deletion extension/src/app_start.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ pub async fn health_check_contained_app(

match send_healthcheck(app_client, healthcheck_url).await {
Ok(_) => {
log::info!("Health check - Complete - Success");
log::debug!("Health check - Complete - Success");
return true;
}
Err(_) => {
Expand Down
8 changes: 4 additions & 4 deletions extension/src/lambda_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ impl LambdaService {
}

if request.init_only {
log::info!(
log::debug!(
"PoolId: {}, LambdaId: {} - Returning from init-only request",
request.pool_id,
request.lambda_id
Expand All @@ -147,8 +147,8 @@ impl LambdaService {
if self.options.local_env
&& request.sent_time.timestamp_millis() < (current_time_millis() - 5000).try_into().unwrap()
{
log::info!(
"PoolId: {}, LambdaId: {} - Returning from stale request",
log::error!(
"PoolId: {}, LambdaId: {} - Returning from stale Invoke",
request.pool_id,
request.lambda_id
);
Expand Down Expand Up @@ -232,7 +232,7 @@ impl LambdaService {

// Print final stats
log::info!(
"LambdaId: {}, Requests: {}, Elapsed: {} ms, RPS: {:.1} - Returning from run",
"LambdaId: {}, Requests: {}, Elapsed: {} ms, RPS: {:.1} - Returning from Invoke",
request.lambda_id,
lambda_request.count.load(Ordering::Acquire),
lambda_request.elapsed(),
Expand Down
6 changes: 3 additions & 3 deletions extension/src/ping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ pub async fn send_ping_requests(
}
}

log::info!(
log::debug!(
"PoolId: {}, LambdaId: {}, Requests: {}, GoAway: {}, Reqs in Flight: {}, Elapsed: {} ms, RPS: {} - Ping Loop - Looping",
pool_id,
lambda_id,
Expand All @@ -289,7 +289,7 @@ pub async fn send_ping_requests(
tokio::select! {
_ = cancel_token.cancelled() => {
// The token was cancelled
log::info!("PoolId: {}, LambdaId: {}, Requests: {}, GoAway: {}, Reqs in Flight: {}, Elapsed: {} ms, RPS: {} - Ping Loop - Cancelled",
log::debug!("PoolId: {}, LambdaId: {}, Requests: {}, GoAway: {}, Reqs in Flight: {}, Elapsed: {} ms, RPS: {} - Ping Loop - Cancelled",
pool_id,
lambda_id,
count,
Expand All @@ -308,7 +308,7 @@ pub async fn send_ping_requests(

let count = count.load(Ordering::Acquire);
let elapsed = time::current_time_millis() - start_time;
log::info!(
log::debug!(
"PoolId: {}, LambdaId: {}, Requests: {}, GoAway: {}, Reqs in Flight: {}, Elapsed: {} ms, RPS: {:.1} - Ping Loop - Exiting",
pool_id,
lambda_id,
Expand Down
Loading
Loading