-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: active orders observability TODOs #469
Merged
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
da9ed54
fix: active orders overflow bug
p0mvn 8ab9921
chore: active orders observability TODOs
p0mvn 441a784
updates
p0mvn 490f4c7
lint
p0mvn f70e401
Merge remote-tracking branch 'upstream/v25.x' into roman/add-observab…
deividaspetraitis 346d95f
chore: active orders observability TODOs
deividaspetraitis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -131,7 +131,11 @@ func (o *orderbookUseCaseImpl) GetActiveOrders(ctx context.Context, address stri | |
for _, orderbook := range orderbooks { | ||
orders, count, err := o.orderBookClient.GetActiveOrders(context.TODO(), orderbook.ContractAddress, address) | ||
if err != nil { | ||
o.logger.Info("failed to fetch active orders", zap.Any("contract", orderbook.ContractAddress), zap.Any("contract", address), zap.Any("err", err)) | ||
o.logger.Error("failed to fetch active orders", zap.Any("contract", orderbook.ContractAddress), zap.Any("contract", address), zap.Any("err", err)) | ||
|
||
// TODO: (alert) if failed to fetch active orders, add an alert | ||
// Prometheus metric counter and alert | ||
|
||
continue | ||
} | ||
|
||
|
@@ -159,7 +163,7 @@ func (o *orderbookUseCaseImpl) GetActiveOrders(ctx context.Context, address stri | |
if !ok { | ||
o.logger.Info("tick not found", zap.Any("contract", orderbook.ContractAddress), zap.Any("ticks", order.TickId), zap.Any("ok", ok)) | ||
|
||
// TODO: if tick not found, add an alert | ||
// TODO: (alert) if tick not found, add an alert | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider implementing the alert mechanism. The TODO comment suggests adding an alert if a tick is not found. Implementing this will enhance monitoring. Do you want me to generate the alert mechanism code or open a GitHub issue to track this task? |
||
// Prometheus metric counter and alert | ||
} | ||
|
||
|
@@ -178,7 +182,11 @@ func (o *orderbookUseCaseImpl) GetActiveOrders(ctx context.Context, address stri | |
orderbook.ContractAddress, | ||
) | ||
if err != nil { | ||
o.logger.Info("failed to create limit order", zap.Any("order", order), zap.Any("err", err)) | ||
o.logger.Error("failed to create limit order", zap.Any("order", order), zap.Any("err", err)) | ||
|
||
// TODO: (alert) if failed to create limit order, add an alert | ||
// Prometheus metric counter and alert | ||
|
||
continue | ||
} | ||
|
||
|
@@ -221,7 +229,10 @@ func (o *orderbookUseCaseImpl) createLimitOrder( | |
percentClaimed := placedQuantityDec.Sub(quantityDec).Quo(placedQuantityDec) | ||
|
||
// Calculate normalization factor for price | ||
normalizationFactor := osmomath.NewDec(10).Power(uint64(quoteAsset.Decimals - baseAsset.Decimals)) | ||
normalizationFactor, err := o.tokensUsecease.GetSpotPriceScalingFactorByDenom(baseAsset.Symbol, quoteAsset.Symbol) | ||
if err != nil { | ||
return orderbookdomain.LimitOrder{}, fmt.Errorf("error getting spot price scaling factor: %w", err) | ||
} | ||
|
||
// Determine tick values and unrealized cancels based on order direction | ||
var tickEtas, tickUnrealizedCancelled int64 | ||
|
@@ -288,7 +299,7 @@ func (o *orderbookUseCaseImpl) createLimitOrder( | |
} | ||
|
||
// Calculate normalized price | ||
normalizedPrice := price.Dec().Quo(normalizationFactor) | ||
normalizedPrice := price.Dec().Mul(normalizationFactor) | ||
|
||
// Convert placed_at to a nano second timestamp | ||
placedAt, err := strconv.ParseInt(order.PlacedAt, 10, 64) | ||
|
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider implementing the alert mechanism.
The TODO comment suggests adding an alert if processing the orderbook pool fails. Implementing this will enhance monitoring.
Do you want me to generate the alert mechanism code or open a GitHub issue to track this task?