Skip to content

feat: add optional Glue retry with exponential backoff and HTTP-level metrics - #144

Open
jamespfaulkner wants to merge 5 commits into
mainfrom
feat/glue-retry-and-client-metrics
Open

feat: add optional Glue retry with exponential backoff and HTTP-level metrics #144
jamespfaulkner wants to merge 5 commits into
mainfrom
feat/glue-retry-and-client-metrics

Conversation

@jamespfaulkner

@jamespfaulkner jamespfaulkner commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds GlueClientFactory to centralise AWSGlue client construction with optional exponential-backoff retry support
  • Retries are off by default (safe for HMS threads); enable for Dronefly via GLUE_RETRY_ENABLED=true. Retries on ConcurrentModificationException (configurable via GLUE_RETRY_EXCEPTIONS) and standard transient AWS errors using PredefinedRetryPolicies.DEFAULT_BACKOFF_STRATEGY
  • Records each retry via a new glue_listener_retry_attempt Micrometer counter tagged by exception_type
  • Fixes ApiaryGlueSync's CLI constructor building its own separate Glue client instead of reusing the one passed to it

New env vars

Var Default Purpose
GLUE_RETRY_ENABLED unset Set true to enable retries (Dronefly only)
GLUE_RETRY_MAX_ATTEMPTS 3 Max retry attempts per call
GLUE_RETRY_EXCEPTIONS ConcurrentModificationException Comma-separated list of additional exception names to retry

New metrics

Metric Type Tags
glue_listener_retry_attempt Counter exception_type

Test plan

  • All existing tests pass
  • GlueClientFactoryTest — retry condition, ConcurrentModificationException handling, metric recording, disabled-by-default, configurable exceptions
  • MetricServiceTest — new recordGlueRetryAttempt method covered

🤖 Generated with Claude Code

jamespfaulkner and others added 3 commits August 5, 2026 15:40
… metrics

Glue calls occasionally fail with ConcurrentModificationException or timeouts.
Retries are off by default (safe for HMS threads) and enabled via GLUE_RETRY_ENABLED=true
for Dronefly. A RequestHandler2-based GlueMetricRequestHandler records per-operation
call duration and error counts via Micrometer for full observability.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ation

- Switch GlueMetricRequestHandler to beforeAttempt/afterAttempt hooks
  so metrics fire per HTTP attempt (including retries) rather than once
  per logical call
- Clarify 'retries disabled' log: SDK default retries still apply when
  custom policy is off; the custom policy adds CME retry on top
- Fix GlueSyncCli to share a single AWSGlue client across ApiaryGlueSync,
  GluePartitionService, and GlueDatabaseService so the 600s request
  timeout applies to all table operations
- Rename maxAttempts -> maxRetries throughout to match SDK semantics
  (maxErrorRetry is a retry count, not total attempts)
- Unify retry metric tag namespace: use getErrorCode() for
  AmazonServiceException in both retry condition branches

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…counter only

Per-call duration and error total metrics via RequestHandler2 were removed
in favour of the existing ApiaryGlueSync success/failure counters, which
already provide sufficient operational coverage. The glue_listener_retry_attempt
counter from GlueClientFactory is retained to surface CME and throttle retry
activity.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jamespfaulkner
jamespfaulkner force-pushed the feat/glue-retry-and-client-metrics branch from 124317f to 81abea5 Compare August 5, 2026 14:41
Add missing CHANGELOG entry for the Glue retry feature, document the
new GLUE_RETRY_ENABLED/GLUE_RETRY_MAX_ATTEMPTS env vars in the README,
fix a javadoc typo (GLUE_RETRY_MAX_RETRIES -> GLUE_RETRY_MAX_ATTEMPTS),
and log a warning when GLUE_RETRY_MAX_ATTEMPTS is zero/negative instead
of silently falling back to the default.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@jamespfaulkner
jamespfaulkner marked this pull request as ready for review August 5, 2026 16:15
@jamespfaulkner
jamespfaulkner requested a review from a team as a code owner August 5, 2026 16:15
Address PR review comment asking for the retried exception(s) to be
configurable instead of hardcoded, while defaulting to
ConcurrentModificationException when the env var is unset.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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