mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-16 06:45:54 +08:00
feat: add required types for tracefunnels
Signed-off-by: Shivanshu Raj Shrivastava <shivanshu1333@gmail.com>
This commit is contained in:
parent
19ee5860cb
commit
e258d70df5
15
pkg/types/tracefunnel/store.go
Normal file
15
pkg/types/tracefunnel/store.go
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package tracefunnels
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/SigNoz/signoz/pkg/valuer"
|
||||||
|
)
|
||||||
|
|
||||||
|
type TraceFunnelStore interface {
|
||||||
|
Create(context.Context, *Funnel) error
|
||||||
|
Get(context.Context, valuer.UUID) (*Funnel, error)
|
||||||
|
List(context.Context) ([]*Funnel, error)
|
||||||
|
Update(context.Context, *Funnel) error
|
||||||
|
Delete(context.Context, valuer.UUID) error
|
||||||
|
}
|
98
pkg/types/tracefunnel/tracefunnel.go
Normal file
98
pkg/types/tracefunnel/tracefunnel.go
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
package tracefunnels
|
||||||
|
|
||||||
|
import (
|
||||||
|
v3 "github.com/SigNoz/signoz/pkg/query-service/model/v3"
|
||||||
|
"github.com/SigNoz/signoz/pkg/types"
|
||||||
|
"github.com/SigNoz/signoz/pkg/valuer"
|
||||||
|
"github.com/uptrace/bun"
|
||||||
|
)
|
||||||
|
|
||||||
|
// BaseMetadata metadata for funnels
|
||||||
|
type BaseMetadata struct {
|
||||||
|
types.Identifiable // funnel id
|
||||||
|
types.TimeAuditable
|
||||||
|
types.UserAuditable
|
||||||
|
Name string `json:"funnel_name" bun:"name,type:text,notnull"` // funnel name
|
||||||
|
Description string `json:"description" bun:"description,type:text"` // funnel description
|
||||||
|
OrgID valuer.UUID `json:"org_id" bun:"org_id,type:varchar,notnull"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Funnel Core Data Structure (Funnel and FunnelStep)
|
||||||
|
type Funnel struct {
|
||||||
|
bun.BaseModel `bun:"table:trace_funnel"`
|
||||||
|
BaseMetadata
|
||||||
|
Steps []FunnelStep `json:"steps" bun:"steps,type:text,notnull"`
|
||||||
|
Tags string `json:"tags" bun:"tags,type:text"`
|
||||||
|
CreatedByUser *types.User `json:"user" bun:"rel:belongs-to,join:created_by=id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type FunnelStep struct {
|
||||||
|
Id valuer.UUID `json:"id,omitempty"`
|
||||||
|
Name string `json:"name,omitempty"` // step name
|
||||||
|
Description string `json:"description,omitempty"` // step description
|
||||||
|
Order int64 `json:"step_order"`
|
||||||
|
ServiceName string `json:"service_name"`
|
||||||
|
SpanName string `json:"span_name"`
|
||||||
|
Filters *v3.FilterSet `json:"filters,omitempty"`
|
||||||
|
LatencyPointer string `json:"latency_pointer,omitempty"`
|
||||||
|
LatencyType string `json:"latency_type,omitempty"`
|
||||||
|
HasErrors bool `json:"has_errors"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// FunnelRequest represents all possible funnel-related requests
|
||||||
|
type FunnelRequest struct {
|
||||||
|
FunnelID valuer.UUID `json:"funnel_id,omitempty"`
|
||||||
|
Name string `json:"funnel_name,omitempty"`
|
||||||
|
Timestamp int64 `json:"timestamp,omitempty"`
|
||||||
|
Description string `json:"description,omitempty"`
|
||||||
|
Steps []FunnelStep `json:"steps,omitempty"`
|
||||||
|
UserID string `json:"user_id,omitempty"`
|
||||||
|
|
||||||
|
// Analytics specific fields
|
||||||
|
StartTime int64 `json:"start_time,omitempty"`
|
||||||
|
EndTime int64 `json:"end_time,omitempty"`
|
||||||
|
StepAOrder int64 `json:"step_a_order,omitempty"`
|
||||||
|
StepBOrder int64 `json:"step_b_order,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// FunnelResponse represents all possible funnel-related responses
|
||||||
|
type FunnelResponse struct {
|
||||||
|
FunnelID string `json:"funnel_id,omitempty"`
|
||||||
|
FunnelName string `json:"funnel_name,omitempty"`
|
||||||
|
Description string `json:"description,omitempty"`
|
||||||
|
CreatedAt int64 `json:"created_at,omitempty"`
|
||||||
|
CreatedBy string `json:"created_by,omitempty"`
|
||||||
|
UpdatedAt int64 `json:"updated_at,omitempty"`
|
||||||
|
UpdatedBy string `json:"updated_by,omitempty"`
|
||||||
|
OrgID string `json:"org_id,omitempty"`
|
||||||
|
UserEmail string `json:"user_email,omitempty"`
|
||||||
|
Funnel *Funnel `json:"funnel,omitempty"`
|
||||||
|
Steps []FunnelStep `json:"steps,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// TimeRange represents a time range for analytics
|
||||||
|
type TimeRange struct {
|
||||||
|
StartTime int64 `json:"start_time"`
|
||||||
|
EndTime int64 `json:"end_time"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// StepTransitionRequest represents a request for step transition analytics
|
||||||
|
type StepTransitionRequest struct {
|
||||||
|
TimeRange
|
||||||
|
StepAOrder int64 `json:"step_a_order"`
|
||||||
|
StepBOrder int64 `json:"step_b_order"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// UserInfo represents basic user information
|
||||||
|
type UserInfo struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
Email string `json:"email"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type FunnelStepFilter struct {
|
||||||
|
StepNumber int
|
||||||
|
ServiceName string
|
||||||
|
SpanName string
|
||||||
|
LatencyPointer string // "start" or "end"
|
||||||
|
CustomFilters *v3.FilterSet
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user