Skip to content

Add after-call flush mode, shutdown flush, and an option to skip function logs - #97

Open
PetarGK wants to merge 2 commits into
rotel-dev:mainfrom
PetarGK:fix/flush-mode-and-shutdown-flush
Open

PetarGK wants to merge 2 commits into
rotel-dev:mainfrom
PetarGK:fix/flush-mode-and-shutdown-flush

Conversation

@PetarGK

@PetarGK PetarGK commented Oct 7, 2026

Copy link
Copy Markdown
  • ROTEL_LAMBDA_FLUSH_MODE=after-call always flushes when the invocation ends. Adaptive mode can hold telemetry while the environment is frozen. When Lambda reclaimed idle environments, we lost about 5% of spans: the shutdown phase gave exporters only 500 ms, and some buffered data never went out. The default stays adaptive.
  • Shutdown flush: on SHUTDOWN, the extension now flushes buffered telemetry (1.3 s timeout inside the 2 s window) before cancelling the exporters.
  • ROTEL_LAMBDA_FORWARD_FUNCTION_LOGS=false stops the extension subscribing to function Telemetry API records. Functions that already export logs over OTLP (for example through the OpenTelemetry SDK's log provider) were getting every line twice. Platform and extension records are unaffected. The default stays true.
  • Unit tests and README docs cover all three.

Measured on a production-like Python Lambda (arm64) with after-call mode: 225 of 225 spans delivered, 100 of 100 in a burst test, and no shutdown flush timeouts across 38 shutdowns.

🤖 Generated with Claude Code

petarkorudzhiev and others added 2 commits October 7, 2026 10:45
In adaptive mode, once invocations arrive faster than one a minute the extension
flushes at the start of an invocation, at most every 20 s. An environment that
then goes idle holds that telemetry until Lambda reclaims it. On SHUTDOWN the
pipelines were cancelled and the exporters given 500 ms to drain, which was
often not enough to reconnect and export, so the batch was dropped
("Exporters did not exit on channel close, cancelling.").

- ROTEL_LAMBDA_FLUSH_MODE=adaptive|after-call (default adaptive, unchanged).
  after-call always exports after the response, so nothing is buffered while
  the environment is frozen.
- On SHUTDOWN, force-flush logs, pipelines and exporters (bounded to 1.3 s of
  the 2 s shutdown budget) before cancelling.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CBAmNpXHPvXfhFq4havtNT
Functions that already export their logs over OTLP get every line twice:
once from the SDK and once from the Telemetry API function stream. When
the setting is false the extension does not subscribe to function
records; platform records (which drive flushing) and the extension's own
logs are unchanged. Defaults to true.

Also documents ROTEL_LAMBDA_FLUSH_MODE and the shutdown flush.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CBAmNpXHPvXfhFq4havtNT
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.

2 participants