Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Add isTestnet to metric common props (part of #516) #530

Merged
merged 2 commits into from
Oct 13, 2020
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
3 changes: 3 additions & 0 deletions cmd/trade.go
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,8 @@ func runTradeCmd(options inputs) {
guiVersionFlag = guiVersion
}

isTestnet := strings.Contains(botConfig.HorizonURL, "test") && botConfig.IsTradingSdex()

metricsTracker, e := metrics.MakeMetricsTracker(
userID,
amplitudeAPIKey,
Expand All @@ -527,6 +529,7 @@ func runTradeCmd(options inputs) {
botConfig.TickIntervalSeconds,
botConfig.TradingExchange,
botConfig.TradingPair(),
isTestnet,
)
if e != nil {
logger.Fatal(l, fmt.Errorf("could not generate metrics tracker: %s", e))
Expand Down
3 changes: 3 additions & 0 deletions support/metrics/metricsTracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ type commonProps struct {
Exchange string `json:"exchange"`
TradingPair string `json:"trading_pair"`
SecondsSinceStart float64 `json:"seconds_since_start"`
IsTestnet bool `json:"is_testnet"`
}

// updateProps holds the properties for the update Amplitude event.
Expand Down Expand Up @@ -113,6 +114,7 @@ func MakeMetricsTracker(
updateTimeIntervalSeconds int32,
exchange string,
tradingPair string,
isTestnet bool,
) (*MetricsTracker, error) {
props := commonProps{
CliVersion: version,
Expand All @@ -124,6 +126,7 @@ func MakeMetricsTracker(
UpdateTimeIntervalSeconds: updateTimeIntervalSeconds,
Exchange: exchange,
TradingPair: tradingPair,
IsTestnet: isTestnet,
}

return &MetricsTracker{
Expand Down