counterspell

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIHandler

type APIHandler struct {
	// contains filtered or unexported fields
}

APIHandler handles HTTP requests for the counterspell API

func NewAPIHandler

func NewAPIHandler(database *sql.DB) *APIHandler

NewAPIHandler creates a new API handler

func (*APIHandler) GetTraceDetails

func (h *APIHandler) GetTraceDetails(c echo.Context) error

GetTraceDetails handles GET /counterspell/api/traces/:trace_id

func (*APIHandler) QueryLogs

func (h *APIHandler) QueryLogs(c echo.Context) error

QueryLogs handles GET /counterspell/api/logs

func (*APIHandler) QueryTraces

func (h *APIHandler) QueryTraces(c echo.Context) error

QueryTraces handles GET /counterspell/api/traces

type APIResponse

type APIResponse struct {
	Metadata map[string]any `json:"metadata"`
	Data     any            `json:"data"`
}

APIResponse represents the standard API response format

type LogData

type LogData struct {
	Timestamp  string
	Level      string
	Message    string
	TraceID    sql.NullString
	SpanID     sql.NullString
	Attributes string
}

LogData represents a log entry for database insertion

type LogItem

type LogItem struct {
	ID         int64          `json:"id"`
	Timestamp  string         `json:"timestamp"`
	Level      string         `json:"level"`
	Message    string         `json:"message"`
	TraceID    *string        `json:"trace_id"`
	SpanID     *string        `json:"span_id"`
	Attributes map[string]any `json:"attributes"`
}

LogItem represents a log entry

type SQLiteLogWriter

type SQLiteLogWriter struct {
	// contains filtered or unexported fields
}

SQLiteLogWriter writes logs to SQLite asynchronously

func NewSQLiteLogWriter

func NewSQLiteLogWriter(database *sql.DB) *SQLiteLogWriter

NewSQLiteLogWriter creates a new log writer

func (*SQLiteLogWriter) Close

func (w *SQLiteLogWriter) Close() error

Close shuts down the writer

func (*SQLiteLogWriter) Write

func (w *SQLiteLogWriter) Write(p []byte) (n int, err error)

Write implements io.Writer

type SQLiteSpanExporter

type SQLiteSpanExporter struct {
	// contains filtered or unexported fields
}

SQLiteSpanExporter implements the OpenTelemetry SpanExporter interface and writes spans to SQLite database asynchronously

func NewSQLiteSpanExporter

func NewSQLiteSpanExporter(database *sql.DB) *SQLiteSpanExporter

NewSQLiteSpanExporter creates a new SQLite span exporter

func (*SQLiteSpanExporter) ExportSpans

func (e *SQLiteSpanExporter) ExportSpans(ctx context.Context, spans []trace.ReadOnlySpan) error

ExportSpans exports spans to the SQLite database This method is called by the OpenTelemetry SDK

func (*SQLiteSpanExporter) ForceFlush

func (e *SQLiteSpanExporter) ForceFlush(ctx context.Context) error

ForceFlush forces the exporter to flush any buffered spans

func (*SQLiteSpanExporter) Shutdown

func (e *SQLiteSpanExporter) Shutdown(ctx context.Context) error

Shutdown gracefully shuts down the exporter

type Service

type Service struct {
	// contains filtered or unexported fields
}

ServiceHandler handles HTTP requests for the counterspell API

func NewService

func NewService(database *sql.DB) *Service

NewServiceHandler creates a new ServiceHandler

func (*Service) GetBlueprint

GetBlueprint

func (*Service) GetTrace

func (*Service) ListBlueprints

GetBlueprints

func (*Service) ListLogs

type SpanData

type SpanData struct {
	SpanID       string
	TraceID      string
	ParentSpanID sql.NullString
	Name         string
	StartTime    string
	EndTime      string
	DurationNs   int64
	Attributes   string
	ServiceName  string
	HasError     bool
}

SpanData represents a span ready to be inserted into the database

type SpanItem

type SpanItem struct {
	SpanID       string         `json:"span_id"`
	TraceID      string         `json:"trace_id"`
	ParentSpanID *string        `json:"parent_span_id"`
	Name         string         `json:"name"`
	StartTime    string         `json:"start_time"`
	EndTime      string         `json:"end_time"`
	DurationNs   int64          `json:"duration_ns"`
	Attributes   map[string]any `json:"attributes"`
	ServiceName  string         `json:"service_name"`
	HasError     bool           `json:"has_error"`
}

SpanItem represents a span in the trace detail view

type TraceDetail

type TraceDetail struct {
	TraceID string     `json:"trace_id"`
	Spans   []SpanItem `json:"spans"`
}

TraceDetail represents detailed trace information

type TraceListItem

type TraceListItem struct {
	TraceID        string  `json:"trace_id"`
	RootSpanName   string  `json:"root_span_name"`
	TraceStartTime string  `json:"trace_start_time"`
	DurationMs     float64 `json:"duration_ms"`
	SpanCount      int64   `json:"span_count"`
	ErrorCount     int64   `json:"error_count"`
	HasError       bool    `json:"has_error"`
}

TraceListItem represents a trace in the list view

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL