feat: yield expiry, bulk epochs endpoint, and OpenTelemetry tracing - #897
Merged
Jayy4rl merged 2 commits intoJul 26, 2026
Merged
Conversation
…, OTel tracing (StellarYield#825, StellarYield#826) StellarYield#823 — Track unclaimed yield expiry per epoch - Migration 029_epoch_expiry.sql adds nullable expires_at to epochs - YIELD_CLAIM_EXPIRY_DAYS env var (null = never expires) wired through config - recordEpoch() populates expires_at from the env var when set - getUserPendingYield() filters out expired epochs via expires_at > NOW() StellarYield#824 — Bulk epoch data endpoint - YieldService.getEpochsBulk() returns epochs in an inclusive [from, to] range - GET /api/v1/yields/:contractId/epochs/bulk?from=&to= returns up to 500 epochs - Returns HTTP 400 when the range exceeds 500 or params are invalid StellarYield#825 — OpenTelemetry tracing for Express - Added @opentelemetry/sdk-node and auto-instrumentations-node packages - src/instrumentation.ts initialises the OTel SDK; exports to OTLP when OTEL_EXPORTER_OTLP_ENDPOINT is set, no-ops otherwise - Imported as first line of src/index.ts so all auto-instrumentation hooks fire StellarYield#826 — Trace context propagation to DB queries - query() in db/index.ts now opens a child db.query span with db.statement and db.response.rows attributes, attached to the active trace context - Span is ended (and error-marked on throw) in a finally block
|
@Gbangbolaoluwagbemiga Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Resolves four assigned issues across epoch data management and observability.
#823 — Track unclaimed yield expiry per epoch
029_epoch_expiry.sql: nullableexpires_at TIMESTAMPTZcolumn onepochsYIELD_CLAIM_EXPIRY_DAYSenv var (optional, default null = never expires) added to configrecordEpoch()calculates and storesexpires_atwhen the env var is setgetUserPendingYield()query filtersexpires_at > NOW()so expired epochs never appear in pending yield#824 — Add bulk epoch data endpoint
YieldService.getEpochsBulk(contractId, from, to)returns epochs in the inclusive rangeGET /api/v1/yields/:contractId/epochs/bulk?from=<epoch>&to=<epoch>— no pagination, single responseto - from > 500or params are invalid;frommust be ≤toyieldAmount,totalShares,yieldPerShare,distributedAt#825 — Add OpenTelemetry tracing to Express middleware
@opentelemetry/sdk-node,@opentelemetry/auto-instrumentations-node,@opentelemetry/api, and@opentelemetry/exporter-trace-otlp-httpto dependenciessrc/instrumentation.tsinitialises the OTel SDK; exports traces to OTLP whenOTEL_EXPORTER_OTLP_ENDPOINTis set, no-ops when absentsrc/index.tsso all auto-instrumentation patches apply before any other module loads#826 — Add trace context propagation to DB queries
query()indb/index.tsnow wraps every SQL call in adb.querychild spandb.statement(first 80 chars of SQL) anddb.response.rowscontext.active()so it appears as a child of the current HTTP request spanfinallyCloses #823
Closes #824
Closes #825
Closes #826