Skip to content

Commit

Permalink
remove internal trace
Browse files Browse the repository at this point in the history
  • Loading branch information
RodrigoVillar committed Nov 22, 2024
1 parent 2bc62c7 commit b9c8d9a
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 225 deletions.
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ require (
github.com/spf13/viper v1.12.0
github.com/stretchr/testify v1.8.4
go.opentelemetry.io/otel v1.22.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.22.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.22.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.22.0
go.opentelemetry.io/otel/sdk v1.22.0
go.opentelemetry.io/otel/trace v1.22.0
go.uber.org/atomic v1.11.0
go.uber.org/zap v1.26.0
Expand Down Expand Up @@ -136,7 +132,11 @@ require (
github.com/urfave/cli/v2 v2.25.7 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.22.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.22.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.22.0 // indirect
go.opentelemetry.io/otel/metric v1.22.0 // indirect
go.opentelemetry.io/otel/sdk v1.22.0 // indirect
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
go.uber.org/mock v0.4.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
Expand Down
14 changes: 7 additions & 7 deletions internal/mempool/mempool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import (
"testing"

"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/trace"
"github.com/stretchr/testify/require"

"github.com/ava-labs/hypersdk/codec"
"github.com/ava-labs/hypersdk/internal/trace"
)

var testSponsor = codec.CreateAddress(1, ids.GenerateTestID())
Expand Down Expand Up @@ -51,7 +51,7 @@ func TestMempool(t *testing.T) {
require := require.New(t)

ctx := context.TODO()
tracer, _ := trace.New(&trace.Config{Enabled: false})
tracer, _ := trace.New(trace.Config{Enabled: false})
txm := New[*TestItem](tracer, 3, 16)

for _, i := range []int64{100, 200, 300, 400} {
Expand All @@ -69,7 +69,7 @@ func TestMempool(t *testing.T) {
func TestMempoolAddDuplicates(t *testing.T) {
require := require.New(t)
ctx := context.TODO()
tracer, _ := trace.New(&trace.Config{Enabled: false})
tracer, _ := trace.New(trace.Config{Enabled: false})
txm := New[*TestItem](tracer, 3, 16)
// Generate item
item := GenerateTestItem(testSponsor, 300)
Expand All @@ -89,7 +89,7 @@ func TestMempoolAddExceedMaxSponsorSize(t *testing.T) {
// Sponsor2 is exempt from max size
require := require.New(t)
ctx := context.TODO()
tracer, _ := trace.New(&trace.Config{Enabled: false})
tracer, _ := trace.New(trace.Config{Enabled: false})
sponsor := codec.CreateAddress(4, ids.GenerateTestID())
// Non exempt sponsors max of 4
txm := New[*TestItem](tracer, 20, 4)
Expand All @@ -105,7 +105,7 @@ func TestMempoolAddExceedMaxSponsorSize(t *testing.T) {
func TestMempoolAddExceedMaxSize(t *testing.T) {
require := require.New(t)
ctx := context.TODO()
tracer, _ := trace.New(&trace.Config{Enabled: false})
tracer, _ := trace.New(trace.Config{Enabled: false})

txm := New[*TestItem](tracer, 3, 20)
// Add more tx's than txm.maxSize
Expand Down Expand Up @@ -133,7 +133,7 @@ func TestMempoolAddExceedMaxSize(t *testing.T) {
func TestMempoolRemoveTxs(t *testing.T) {
require := require.New(t)
ctx := context.TODO()
tracer, _ := trace.New(&trace.Config{Enabled: false})
tracer, _ := trace.New(trace.Config{Enabled: false})

txm := New[*TestItem](tracer, 3, 20)
// Add
Expand All @@ -151,7 +151,7 @@ func TestMempoolRemoveTxs(t *testing.T) {
func TestMempoolSetMinTimestamp(t *testing.T) {
require := require.New(t)
ctx := context.TODO()
tracer, _ := trace.New(&trace.Config{Enabled: false})
tracer, _ := trace.New(trace.Config{Enabled: false})

txm := New[*TestItem](tracer, 20, 20)
// Add more tx's than txm.maxSize
Expand Down
62 changes: 0 additions & 62 deletions internal/trace/exporter.go

This file was deleted.

45 changes: 0 additions & 45 deletions internal/trace/exporter_type.go

This file was deleted.

20 changes: 0 additions & 20 deletions internal/trace/noop.go

This file was deleted.

80 changes: 0 additions & 80 deletions internal/trace/tracer.go

This file was deleted.

4 changes: 2 additions & 2 deletions state/tstate/tstate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import (

"github.com/ava-labs/avalanchego/database"
"github.com/ava-labs/avalanchego/database/memdb"
"github.com/ava-labs/avalanchego/trace"
"github.com/ava-labs/avalanchego/utils/maybe"
"github.com/ava-labs/avalanchego/utils/units"
"github.com/ava-labs/avalanchego/x/merkledb"
"github.com/stretchr/testify/require"

"github.com/ava-labs/hypersdk/internal/trace"
"github.com/ava-labs/hypersdk/keys"
"github.com/ava-labs/hypersdk/state"
)
Expand Down Expand Up @@ -540,7 +540,7 @@ func TestCreateView(t *testing.T) {

ctx := context.TODO()
ts := New(10)
tracer, err := trace.New(&trace.Config{Enabled: false})
tracer, err := trace.New(trace.Config{Enabled: false})
require.NoError(err)
db, err := merkledb.New(ctx, memdb.New(), merkledb.Config{
BranchFactor: merkledb.BranchFactor16,
Expand Down
2 changes: 1 addition & 1 deletion vm/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import (
"encoding/json"
"time"

"github.com/ava-labs/avalanchego/trace"
"github.com/ava-labs/avalanchego/utils/profiler"
"github.com/ava-labs/avalanchego/utils/units"

"github.com/ava-labs/hypersdk/chain"
"github.com/ava-labs/hypersdk/internal/trace"
)

type Config struct {
Expand Down
7 changes: 3 additions & 4 deletions vm/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/ava-labs/avalanchego/snow"
"github.com/ava-labs/avalanchego/snow/consensus/snowman"
"github.com/ava-labs/avalanchego/snow/engine/common"
"github.com/ava-labs/avalanchego/trace"
"github.com/ava-labs/avalanchego/utils/crypto/bls"
"github.com/ava-labs/avalanchego/utils/profiler"
"github.com/ava-labs/avalanchego/utils/set"
Expand All @@ -38,7 +39,6 @@ import (
"github.com/ava-labs/hypersdk/internal/gossiper"
"github.com/ava-labs/hypersdk/internal/mempool"
"github.com/ava-labs/hypersdk/internal/pebble"
"github.com/ava-labs/hypersdk/internal/trace"
"github.com/ava-labs/hypersdk/internal/validators"
"github.com/ava-labs/hypersdk/internal/validitywindow"
"github.com/ava-labs/hypersdk/internal/workers"
Expand All @@ -48,7 +48,6 @@ import (
"github.com/ava-labs/hypersdk/utils"

avacache "github.com/ava-labs/avalanchego/cache"
avatrace "github.com/ava-labs/avalanchego/trace"
avautils "github.com/ava-labs/avalanchego/utils"
internalfees "github.com/ava-labs/hypersdk/internal/fees"
)
Expand Down Expand Up @@ -104,7 +103,7 @@ type VM struct {
authEngine map[uint8]AuthEngine
network *p2p.Network

tracer avatrace.Tracer
tracer trace.Tracer
mempool *mempool.Mempool[*chain.Transaction]

// We cannot use a map here because we may parse blocks up in the ancestry
Expand Down Expand Up @@ -247,7 +246,7 @@ func (vm *VM) Initialize(
snowCtx.Log.Info("initialized hypersdk config", zap.Any("config", vm.config))

// Setup tracer
vm.tracer, err = trace.New(&vm.config.TraceConfig)
vm.tracer, err = trace.New(vm.config.TraceConfig)
if err != nil {
return err
}
Expand Down

0 comments on commit b9c8d9a

Please sign in to comment.