Skip to content

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

Draft
jamespfaulkner wants to merge 3 commits into
mainfrom
feat/glue-retry-and-client-metrics
Draft

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

Conversation

@jamespfaulkner

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 and standard transient
    AWS errors using PredefinedRetryPolicies.DEFAULT_BACKOFF_STRATEGY
  • Adds GlueMetricRequestHandler (AWS SDK v1 RequestHandler2) to record HTTP-level call metrics via Micrometer: glue_client_call_duration{operation,result},
    glue_client_error_total{operation,error_code}, and glue_listener_retry_attempt{exception_type}

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

New metrics

Metric Type Tags
glue_client_call_duration Timer operation, result
glue_client_error_total Counter operation, error_code
glue_listener_retry_attempt Counter exception_type

Test plan

  • All 142 existing tests pass
  • GlueClientFactoryTest — retry condition, ConcurrentModificationException handling, metric recording, disabled-by-default
  • GlueMetricRequestHandlerTest — success/error tagging, operation name derivation, zero-duration fallback
  • MetricServiceTest — 3 new methods covered

🤖 Generated with Claude Code

jamespfaulkner and others added 3 commits July 7, 2026 15:10
… 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>
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.

1 participant