Skip to content
Merged
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
22 changes: 22 additions & 0 deletions supernode/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ package cmd
import (
"context"
"fmt"
"net/http"
_ "net/http/pprof"
"os"
"os/signal"
"path/filepath"
"strings"
"syscall"

"github.com/LumeraProtocol/supernode/v2/p2p"
Expand Down Expand Up @@ -139,6 +142,25 @@ The supernode will connect to the Lumera network and begin participating in the
return fmt.Errorf("failed to create gateway server: %w", err)
}

// Start profiling server on testnet only
isTestnet := strings.Contains(strings.ToLower(appConfig.LumeraClientConfig.ChainID), "testnet")

if isTestnet {
profilingAddr := "0.0.0.0:6060"

logtrace.Info(ctx, "Starting profiling server", logtrace.Fields{
"address": profilingAddr,
"chain_id": appConfig.LumeraClientConfig.ChainID,
"is_testnet": isTestnet,
})

go func() {
if err := http.ListenAndServe(profilingAddr, nil); err != nil {
logtrace.Error(ctx, "Profiling server error", logtrace.Fields{"error": err.Error()})
}
}()
}

// Start the services
go func() {
if err := RunServices(ctx, grpcServer, cService, *p2pService, gatewayServer); err != nil {
Expand Down
Loading