Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnalyzeResponse ¶
type AnalyzeResponse struct {
ContentType string `json:"content_type"`
}
AnalyzeResponse for content analysis
type CompressRequest ¶
type CompressRequest struct {
Input string `json:"input"`
Mode string `json:"mode,omitempty"` // "minimal" or "aggressive"
Budget int `json:"budget,omitempty"` // Target token budget
}
CompressRequest for compression API
type CompressResponse ¶
type CompressResponse struct {
Output string `json:"output"`
OriginalTokens int `json:"original_tokens"`
FinalTokens int `json:"final_tokens"`
TokensSaved int `json:"tokens_saved"`
ReductionPercent float64 `json:"reduction_percent"`
ProcessingTimeMs int64 `json:"processing_time_ms"`
}
CompressResponse for compression results
type Config ¶
type Config struct {
Port int
APIKey string // Optional API key for authentication (empty = no auth)
LogLevel string // "debug", "info", "error"
Version string
RateLimit int // Requests per minute (0 = unlimited)
PipelineConfig filter.PipelineConfig
}
Config holds server configuration
type HealthResponse ¶
HealthResponse for health checks
type LogEntry ¶
type LogEntry struct {
Time string `json:"time"`
Level string `json:"level"`
Message string `json:"message"`
Fields map[string]any `json:"fields,omitempty"`
}
LogEntry represents a structured log entry
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger provides structured logging
type Metrics ¶
type Metrics struct {
// Counters
TotalRequests int64
TotalCompressions int64
TotalTokensIn int64
TotalTokensOut int64
TotalTokensSaved int64
TotalErrors int64
// Histograms (simplified as maps)
ProcessingTimes []time.Duration
ReductionPercents []float64
// Gauges
ActiveConnections int64
// Content type distribution
ContentTypeCounts map[string]int64
// Start time for uptime
StartTime time.Time
// contains filtered or unexported fields
}
Metrics holds server observability data
func (*Metrics) PrometheusFormat ¶
PrometheusFormat returns metrics in Prometheus text format
func (*Metrics) RecordCompression ¶
func (m *Metrics) RecordCompression(original, final int, duration time.Duration, contentType string)
RecordCompression tracks a compression operation
func (*Metrics) Snapshot ¶
func (m *Metrics) Snapshot() MetricsSnapshot
Snapshot returns a point-in-time copy of metrics
type MetricsSnapshot ¶
type MetricsSnapshot struct {
Uptime time.Duration `json:"uptime"`
TotalRequests int64 `json:"total_requests"`
TotalCompressions int64 `json:"total_compressions"`
TotalTokensIn int64 `json:"total_tokens_in"`
TotalTokensOut int64 `json:"total_tokens_out"`
TotalTokensSaved int64 `json:"total_tokens_saved"`
TotalErrors int64 `json:"total_errors"`
AvgProcessingMs int64 `json:"avg_processing_ms"`
AvgReductionPct float64 `json:"avg_reduction_pct"`
ContentTypeCounts map[string]int64 `json:"content_type_counts"`
}
MetricsSnapshot is a point-in-time view of metrics
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server provides REST API for token compression
type StatsResponse ¶
StatsResponse for server stats
Click to show internal directories.
Click to hide internal directories.