Skip to content
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

POC: Flight recording of slow requests (above 500ms) #253

Merged
merged 4 commits into from
May 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

## Unreleased

- Flight recording of slow requests (above 500ms) and dependency updates
- Consistently rename min liqudity filter across pool models & configs to min pool liquidity capitalization (cap)
- Validate token in and out in /router quote endpoints to ensure that they are not equal to each other & clean up tokens/prices
- Hack to fallback to precision of 18 when estimating spot price for Astroport pools via quotes.
Expand Down
2 changes: 1 addition & 1 deletion app/sidecar_query_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (sqs *sideCarQueryServer) Start(context.Context) error {
func NewSideCarQueryServer(appCodec codec.Codec, config domain.Config, logger log.Logger) (SideCarQueryServer, error) {
// Setup echo server
e := echo.New()
middleware := middleware.InitMiddleware(config.CORS)
middleware := middleware.InitMiddleware(config.CORS, config.FlightRecord, logger)
e.Use(middleware.CORS)
e.Use(middleware.InstrumentMiddleware)
e.Use(middleware.TraceWithParamsMiddleware("sqs"))
Expand Down
5 changes: 5 additions & 0 deletions config-testnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
"grpc-gateway-endpoint": "http://localhost:26657",
"chain-id": "osmosis-1",
"chain-registry-assets-url": "https://raw.githubusercontent.com/osmosis-labs/assetlists/main/osmo-test-5/osmo-test-5.assetlist.json",
"flight-recording": {
"enabled": false,
"trace-threshold-ms": 1000,
"trace-file-name": "/tmp/sqs-flight-record.trace"
},
"router": {
"preferred-pool-ids": [],
"max-pools-per-route": 4,
Expand Down
5 changes: 5 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
"grpc-gateway-endpoint": "http://localhost:26657",
"chain-id": "osmosis-1",
"chain-registry-assets-url": "https://raw.githubusercontent.com/osmosis-labs/assetlists/main/osmosis-1/generated/frontend/assetlist.json",
"flight-record": {
"enabled": false,
"trace-threshold-ms": 1000,
"trace-file-name": "/tmp/sqs-flight-record.trace"
},
"router": {
"preferred-pool-ids": [],
"max-pools-per-route": 4,
Expand Down
12 changes: 12 additions & 0 deletions domain/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ type Config struct {
// Chain registry assets firl URL.
ChainRegistryAssetsFileURL string `mapstructure:"chain-registry-assets-url"`

FlightRecord *FlightRecordConfig `mapstructure:"flight-record"`

// Router encapsulates the router config.
Router *RouterConfig `mapstructure:"router"`

Expand Down Expand Up @@ -55,3 +57,13 @@ type CORSConfig struct {
AllowedMethods string `mapstructure:"allowed-methods"`
AllowedOrigin string `mapstructure:"allowed-origin"`
}

// FlightRecordConfig encapsulates the flight recording configuration.
type FlightRecordConfig struct {
// Enabled defines if the flight recording is enabled.
Enabled bool `mapstructure:"enabled"`
// TraceThresholdMS defines the trace threshold in milliseconds.
TraceThresholdMS int `mapstructure:"trace-threshold-ms"`
// TraceFileName defines the trace file name to output to.
TraceFileName string `mapstructure:"trace-file-name"`
}
18 changes: 7 additions & 11 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/osmosis-labs/sqs

go 1.21.4
go 1.21.8

require (
cosmossdk.io/math v1.3.0
Expand All @@ -12,8 +12,8 @@ require (
github.com/labstack/echo/v4 v4.11.4
github.com/osmosis-labs/osmosis/osmomath v0.0.13
github.com/osmosis-labs/osmosis/osmoutils v0.0.13
github.com/osmosis-labs/osmosis/v25 v25.0.0-rc0
github.com/osmosis-labs/sqs/sqsdomain v0.18.4-0.20240518180933-518a93302cf3
github.com/osmosis-labs/osmosis/v25 v25.0.2-0.20240525182212-e39ab0021f3e
github.com/osmosis-labs/sqs/sqsdomain v0.18.4-0.20240525150306-5031af5f1640
github.com/prometheus/client_golang v1.19.1
github.com/sirupsen/logrus v1.9.3
github.com/spf13/viper v1.18.2
Expand Down Expand Up @@ -85,7 +85,7 @@ require (
github.com/cosmos/iavl v1.1.2-0.20240405173644-e52f7630d3b7 // indirect
github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.1.3 // indirect
github.com/cosmos/ibc-apps/modules/async-icq/v7 v7.1.1 // indirect
github.com/cosmos/ibc-go/v7 v7.4.0 // indirect
github.com/cosmos/ibc-go/v7 v7.4.1 // indirect
github.com/cosmos/ics23/go v0.10.0 // indirect
github.com/cosmos/ledger-cosmos-go v0.12.4 // indirect
github.com/cosmos/rosetta-sdk-go v0.10.0 // indirect
Expand Down Expand Up @@ -217,7 +217,7 @@ require (
go.uber.org/goleak v1.3.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.23.0 // indirect
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842
golang.org/x/net v0.25.0 // indirect
golang.org/x/oauth2 v0.17.0 // indirect
golang.org/x/sync v0.7.0 // indirect
Expand Down Expand Up @@ -254,21 +254,17 @@ replace (

// Our cosmos-sdk branch is: https://github.com/osmosis-labs/cosmos-sdk/tree/osmo-v22/v0.47.5, current branch: osmo-v22/v0.47.5. Direct commit link: https://github.com/osmosis-labs/cosmos-sdk/commit/cf358f6fc20cabfb5cb8ce75fc10b2623150869e
// https://github.com/osmosis-labs/cosmos-sdk/releases/tag/v0.47.5-v22-osmo-2
github.com/cosmos/cosmos-sdk => github.com/osmosis-labs/cosmos-sdk v0.47.5-v24-osmo-5
github.com/cosmos/gogoproto => github.com/cosmos/gogoproto v1.4.10
github.com/cosmos/cosmos-sdk => github.com/osmosis-labs/cosmos-sdk v0.47.6-0.20240520015414-d958d4441808
github.com/cosmos/iavl => github.com/cosmos/iavl v1.1.2-0.20240405172238-7f92c6b356ac
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1

// we explicitly follow main branch tags
github.com/osmosis-labs/osmosis/osmomath => github.com/osmosis-labs/osmosis/osmomath v0.0.13
github.com/osmosis-labs/osmosis/osmoutils => github.com/osmosis-labs/osmosis/osmoutils v0.0.13
github.com/osmosis-labs/osmosis/v25 => github.com/osmosis-labs/osmosis/v25 v25.0.0-20240520002618-b177b9e9f1d0
github.com/osmosis-labs/osmosis/v25 => github.com/osmosis-labs/osmosis/v25 v25.0.2-0.20240525182212-e39ab0021f3e

// replace as directed by sdk upgrading.md https://github.com/cosmos/cosmos-sdk/blob/393de266c8675dc16cc037c1a15011b1e990975f/UPGRADING.md?plain=1#L713
github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7

// newer versions of exp treat sorting differently, which is incompatible with the current version of cosmos-sdk
golang.org/x/exp => golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb
)

exclude github.com/cosmos/cosmos-sdk v0.50.1
Expand Down
Loading
Loading