Refactor trace package structure and improve trace ID validation
- Updated trace ID validation in `TestEnterStack_RootCreation` to ensure it is at least 8 digits long. - Changed import path for the trace package in `stack.go` for consistency. - Removed the entire `manager.go`, `node.go`, `space.go`, `subscription.go`, `trace.go`, `local/driver.go`, `store/driver.go`, and related types and events files to streamline the trace package, focusing on essential functionality.
This commit is contained in:
parent
c02fbcb63e
commit
b582f0c685
14 changed files with 17 additions and 17 deletions
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/yaoapp/yao/agent/trace"
|
"github.com/yaoapp/yao/trace"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewStack creates a new root stack with the given trace ID and assistant ID
|
// NewStack creates a new root stack with the given trace ID and assistant ID
|
||||||
|
|
|
||||||
|
|
@ -209,9 +209,9 @@ func TestEnterStack_RootCreation(t *testing.T) {
|
||||||
t.Error("Expected traceID to be generated, got empty string")
|
t.Error("Expected traceID to be generated, got empty string")
|
||||||
}
|
}
|
||||||
|
|
||||||
// TraceID should be 8 digits (from trace.GenTraceID)
|
// TraceID should be at least 8 digits (from trace.GenTraceID)
|
||||||
if len(traceID) != 8 {
|
if len(traceID) < 8 {
|
||||||
t.Errorf("Expected traceID length 8, got %d", len(traceID))
|
t.Errorf("Expected traceID length at least 8, got %d", len(traceID))
|
||||||
}
|
}
|
||||||
|
|
||||||
if stack.TraceID != traceID {
|
if stack.TraceID != traceID {
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,8 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/yaoapp/yao/agent/trace"
|
"github.com/yaoapp/yao/trace"
|
||||||
"github.com/yaoapp/yao/agent/trace/types"
|
"github.com/yaoapp/yao/trace/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
@ -191,8 +191,8 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/yaoapp/yao/agent/trace"
|
"github.com/yaoapp/yao/trace"
|
||||||
"github.com/yaoapp/yao/agent/trace/types"
|
"github.com/yaoapp/yao/trace/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
@ -3,7 +3,7 @@ package local
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/yaoapp/yao/agent/trace/types"
|
"github.com/yaoapp/yao/trace/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Driver the local disk storage driver implementation
|
// Driver the local disk storage driver implementation
|
||||||
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
gonanoid "github.com/matoous/go-nanoid/v2"
|
gonanoid "github.com/matoous/go-nanoid/v2"
|
||||||
"github.com/yaoapp/yao/agent/trace/types"
|
"github.com/yaoapp/yao/trace/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// manager implements the Manager interface with unified business logic
|
// manager implements the Manager interface with unified business logic
|
||||||
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/yaoapp/yao/agent/trace/types"
|
"github.com/yaoapp/yao/trace/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// node implements the Node interface for custom node operations
|
// node implements the Node interface for custom node operations
|
||||||
|
|
@ -3,7 +3,7 @@ package trace
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/yaoapp/yao/agent/trace/types"
|
"github.com/yaoapp/yao/trace/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// space implements the Space interface for custom space operations
|
// space implements the Space interface for custom space operations
|
||||||
|
|
@ -3,7 +3,7 @@ package store
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/yaoapp/yao/agent/trace/types"
|
"github.com/yaoapp/yao/trace/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Driver the gou store storage driver implementation
|
// Driver the gou store storage driver implementation
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package trace
|
package trace
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/yaoapp/yao/agent/trace/types"
|
"github.com/yaoapp/yao/trace/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Subscription Operations
|
// Subscription Operations
|
||||||
|
|
@ -7,9 +7,9 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
gonanoid "github.com/matoous/go-nanoid/v2"
|
gonanoid "github.com/matoous/go-nanoid/v2"
|
||||||
"github.com/yaoapp/yao/agent/trace/local"
|
"github.com/yaoapp/yao/trace/local"
|
||||||
"github.com/yaoapp/yao/agent/trace/store"
|
"github.com/yaoapp/yao/trace/store"
|
||||||
"github.com/yaoapp/yao/agent/trace/types"
|
"github.com/yaoapp/yao/trace/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Driver types
|
// Driver types
|
||||||
Loading…
Add table
Reference in a new issue