Skip to content

Add LMI worker and execution max concurrency counter debug log statement. - #2576

Merged
normj merged 1 commit into
masterfrom
normj/worker-count
Sep 14, 2026
Merged

normj merged 1 commit into
masterfrom
normj/worker-count

Conversation

@normj

@normj normj commented Sep 14, 2026

Copy link
Copy Markdown
Member

Issue #, if available:

Description of changes:

Adds a one-time structured DEBUG log emitted during init that reports how many worker (invoke processing) tasks the runtime started and the execution environment's max concurrency. This gives observability into the worker pool sizing when running in Lambda managed instances (multi-concurrency) mode.

Behavior

  • Emitted only when both conditions hold:
    • The function is running in multi-concurrency mode (AWS_LAMBDA_MAX_CONCURRENCY set), and
    • The JSON log format is configured (AWS_LAMBDA_LOG_FORMAT / the .NET RIC log-format variable resolves to Json).
  • Emitted at Debug level, so it only surfaces when the function log level is Debug/Trace (filtering handled by the console logger writer).
  • Uses the event name runtime_worker_pool_initializing, matching the Java and Python Lambda runtimes so the log is queryable consistently across languages.
  • Structured JSON fields: event, workerCount, executionEnvironmentMaxConcurrency.

Changes

  • Utils.cs: new IsJsonLogFormat and EmitWorkerPoolInitializingLog helpers, plus the event-name and message-template constants.
  • LambdaBootstrap.cs: calls the emitter once during processing-loop setup, after the worker count is determined.
  • Tests: UtilsTest, LogMessageFormatterTests, and LambdaBootstrapMultiConcurrencyTests, plus a new CapturingConsoleLoggerWriter test helper.
  • Adds an autover changelog entry (patch) for Amazon.Lambda.RuntimeSupport.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

…ed DEBUG log during init reporting the worker count and execution environment max concurrency when the JSON log format is enabled.
@normj
normj requested review from a team as code owners September 14, 2026 17:06
@normj
normj requested review from GarrettBeatty and a lite review from Copilot September 14, 2026 17:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No unresolved blocking issues were identified, and focused test coverage is included.

Pull request overview

Adds a one-time structured DEBUG log reporting Lambda worker count and maximum concurrency in JSON multi-concurrency mode.

Changes:

  • Adds log-format detection and worker-pool initialization logging.
  • Integrates emission into bootstrap setup.
  • Adds tests, logging helpers, and a patch changelog entry.
File summaries
File Summary
Libraries/test/Amazon.Lambda.RuntimeSupport.Tests/Amazon.Lambda.RuntimeSupport.UnitTests/UtilsTest.cs Tests log gating and structured arguments.
Libraries/test/Amazon.Lambda.RuntimeSupport.Tests/Amazon.Lambda.RuntimeSupport.UnitTests/TestHelpers/TestMultiConcurrencyRuntimeApiClient.cs Supports logger replacement in tests.
Libraries/test/Amazon.Lambda.RuntimeSupport.Tests/Amazon.Lambda.RuntimeSupport.UnitTests/TestHelpers/CapturingConsoleLoggerWriter.cs Captures log writes for assertions.
Libraries/test/Amazon.Lambda.RuntimeSupport.Tests/Amazon.Lambda.RuntimeSupport.UnitTests/LogMessageFormatterTests.cs Tests JSON field formatting.
Libraries/test/Amazon.Lambda.RuntimeSupport.Tests/Amazon.Lambda.RuntimeSupport.UnitTests/LambdaBootstrapMultiConcurrencyTests.cs Tests bootstrap emission behavior.
Libraries/src/Amazon.Lambda.RuntimeSupport/Helpers/Utils.cs Implements log-format detection and emission helpers.
Libraries/src/Amazon.Lambda.RuntimeSupport/Bootstrap/LambdaBootstrap.cs Emits the initialization log during worker setup.
.autover/changes/9efcd50c-f1a0-4b57-90e1-20b54c382f2e.json Adds the patch changelog entry.
Review details
  • Files reviewed: 8/8 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread Libraries/src/Amazon.Lambda.RuntimeSupport/Helpers/Utils.cs
@normj
normj merged commit 7092c38 into master Sep 14, 2026
9 checks passed
@normj
normj deleted the normj/worker-count branch September 14, 2026 23:45
@normj
normj restored the normj/worker-count branch September 14, 2026 23:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants