Documentation
¶
Overview ¶
Package omnisignal provides a unified interface for ingesting operational signals from various external systems (alerting, ticketing, security, monitoring).
omnisignal follows the same architectural pattern as omnillm:
- Provider interface defines the contract for signal sources
- Registry allows dynamic provider registration
- Thick providers use official SDKs (PagerDuty, Datadog)
- Thin providers use native HTTP for sources without Go SDKs
Example usage:
import (
"github.com/plexusone/omnisignal"
_ "github.com/plexusone/omnisignal/provider/pagerduty" // Register PagerDuty
)
provider, err := omnisignal.New("pagerduty", omnisignal.Config{
APIKey: os.Getenv("PAGERDUTY_API_KEY"),
})
signals, err := provider.Fetch(ctx, omnisignal.FetchOptions{
Since: time.Now().Add(-24 * time.Hour),
})
Index ¶
- Constants
- Variables
- func ClearRegistry()
- func GetPriority(name string) int
- func IsCurated(metadata map[string]any) bool
- func IsRegistered(name string) bool
- func List() []string
- func Register(name string, factory ProviderFactory, priority int)
- func Unregister(name string)
- func WrapErrorByMessage(err error, context string) error
- func WrapHTTPError(err error, resp *http.Response, context string) error
- type Capabilities
- type Config
- type FetchOptions
- type Provider
- type ProviderFactory
- type SubscribeOptions
Constants ¶
const ( // OptCustomerMappings maps organization/account names to customer refs. OptCustomerMappings = "customer_mappings" // OptCapabilityMappings maps components/labels to capability refs. OptCapabilityMappings = "capability_mappings" // OptMarketMappings maps categories to market refs. OptMarketMappings = "market_mappings" )
Well-known config option keys for cross-repo reference mappings. These map source system values to typed refs (e.g., "Acme Corp" → "customer:acme-001").
const ( PriorityThin = 0 // Native HTTP implementations PriorityThick = 10 // SDK-based implementations )
Priority levels for provider registration. Higher priority providers override lower priority ones.
const ( // MetaCurated indicates a pre-consolidated signal that should skip // the clustering stage of the consolidation pipeline. Use for signals // from sources that already aggregate user feedback (e.g., Aha Ideas // with votes and watchers). Value: bool. MetaCurated = "curated" )
Well-known metadata keys for signal classification.
Variables ¶
var ( ErrNotSupported = errors.New("operation not supported by this provider") ErrInvalidConfig = errors.New("invalid provider configuration") ErrAuthentication = errors.New("authentication failed") ErrRateLimited = errors.New("rate limited by provider") ErrProviderNotFound = errors.New("provider not found in registry") )
Common errors returned by providers.
Functions ¶
func ClearRegistry ¶
func ClearRegistry()
ClearRegistry removes all providers from the registry. Primarily useful for testing.
func GetPriority ¶
GetPriority returns the priority of a registered provider. Returns -1 if the provider is not registered.
func IsCurated ¶ added in v0.2.0
IsCurated checks if a signal is marked as curated (pre-consolidated). Curated signals should skip clustering and map directly to canonical signals.
func IsRegistered ¶
IsRegistered checks if a provider is registered.
func Register ¶
func Register(name string, factory ProviderFactory, priority int)
Register adds a provider factory to the global registry.
If a provider with the same name exists, the one with higher priority wins. For equal priorities, the later registration wins.
Example:
func init() {
omnisignal.Register("pagerduty", NewProvider, omnisignal.PriorityThick)
}
func Unregister ¶
func Unregister(name string)
Unregister removes a provider from the registry. Primarily useful for testing.
func WrapErrorByMessage ¶ added in v0.2.0
WrapErrorByMessage wraps an error based on error message patterns when HTTP response is not available. Detects auth and rate-limit errors from common error message patterns.
func WrapHTTPError ¶ added in v0.2.0
WrapHTTPError wraps an error based on HTTP status code, returning a sentinel error (ErrAuthentication, ErrRateLimited) where appropriate. If resp is nil or the status doesn't match a sentinel, returns the original error wrapped with context.
Types ¶
type Capabilities ¶
type Capabilities struct {
// SupportsStreaming indicates real-time signal streaming via Subscribe.
SupportsStreaming bool
// SupportsBatchFetch indicates efficient batch fetching.
SupportsBatchFetch bool
// SupportsFiltering indicates server-side filtering support.
SupportsFiltering bool
// SupportsAcknowledge indicates the ability to acknowledge signals.
SupportsAcknowledge bool
// MaxBatchSize is the maximum signals per fetch request.
// Zero means no limit or unknown.
MaxBatchSize int
// RateLimitPerMinute is the provider's rate limit.
// Zero means no limit or unknown.
RateLimitPerMinute int
// SignalTypes lists the signal types this provider can emit.
SignalTypes []signal.Type
}
Capabilities describes what features a provider supports.
type Config ¶
type Config struct {
// APIKey is the primary authentication credential.
APIKey string
// APISecret is a secondary credential (if required).
APISecret string
// BaseURL overrides the default API endpoint.
// Empty uses the provider's default.
BaseURL string
// Timeout for API requests. Zero uses provider default.
Timeout time.Duration
// RetryMax is the maximum number of retry attempts.
// Zero means use provider default.
RetryMax int
// Options contains provider-specific configuration.
Options map[string]any
}
Config holds provider configuration.
func (Config) GetStringMap ¶ added in v0.2.0
GetStringMap retrieves a map[string]string option. Handles both map[string]string and map[string]any with string values.
func (Config) GetStringOption ¶
GetStringOption retrieves a string option with a default fallback.
type FetchOptions ¶
type FetchOptions struct {
// Since filters signals observed after this time (inclusive).
Since time.Time
// Until filters signals observed before this time (exclusive).
// Zero value means no upper bound.
Until time.Time
// Limit is the maximum number of signals to return.
// Zero means no limit (fetch all matching signals).
Limit int
// Statuses filters by signal status in the source system.
// Empty means all statuses.
Statuses []string
// Severities filters by severity level.
// Empty means all severities.
Severities []string
// Filters contains provider-specific filter parameters.
// Keys and values are provider-dependent.
Filters map[string]string
}
FetchOptions configures a fetch operation.
type Provider ¶
type Provider interface {
// Name returns the provider identifier (e.g., "pagerduty", "jira", "newrelic").
Name() string
// Fetch retrieves signals matching the given options.
// Returns signals in chronological order (oldest first).
// Implementations should handle pagination internally.
Fetch(ctx context.Context, opts FetchOptions) ([]signal.Signal, error)
// Subscribe opens a real-time stream of signals.
// Returns ErrNotSupported if the provider doesn't support streaming.
// The returned channel is closed when the context is canceled.
Subscribe(ctx context.Context, opts SubscribeOptions) (<-chan signal.Signal, error)
// Capabilities returns what this provider supports.
Capabilities() Capabilities
// Close releases any resources held by the provider.
Close() error
}
Provider defines the interface for signal ingestion providers.
Implementations should be safe for concurrent use.
type ProviderFactory ¶
ProviderFactory creates a new provider instance from configuration.
type SubscribeOptions ¶
type SubscribeOptions struct {
// BufferSize is the channel buffer size for incoming signals.
// Default is 100 if not specified.
BufferSize int
// Filters contains provider-specific filter parameters.
Filters map[string]string
}
SubscribeOptions configures a subscription.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package consolidate provides a pipeline for consolidating raw signals into canonical root causes through embedding, clustering, summarization, and review.
|
Package consolidate provides a pipeline for consolidating raw signals into canonical root causes through embedding, clustering, summarization, and review. |
|
Package metrics provides a formula registry for computing derived signal metrics.
|
Package metrics provides a formula registry for computing derived signal metrics. |
|
provider
|
|
|
analyst
Package analyst provides an analyst findings provider for omnisignal.
|
Package analyst provides an analyst findings provider for omnisignal. |
|
competitive
Package competitive provides a competitive intelligence provider for omnisignal.
|
Package competitive provides a competitive intelligence provider for omnisignal. |
|
jira
Package jira provides a Jira signal provider for omnisignal.
|
Package jira provides a Jira signal provider for omnisignal. |
|
pagerduty
Package pagerduty provides a PagerDuty signal provider for omnisignal.
|
Package pagerduty provides a PagerDuty signal provider for omnisignal. |