api

package
v0.1.35 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPageSize = 100 // used when a requested page size is non-positive
	MaxPageSize     = 500 // hard upper bound
)
View Source
const (
	ConnectorStateRunning    = "RUNNING"
	ConnectorStateFailed     = "FAILED"
	ConnectorStatePaused     = "PAUSED"
	ConnectorStateStopped    = "STOPPED"
	ConnectorStateUnassigned = "UNASSIGNED"
	ConnectorStateRestarting = "RESTARTING"
	ConnectorStateDestroyed  = "DESTROYED"
)

Connector/task lifecycle states as reported by the Connect REST API.

View Source
const (
	GroupStateStable              = "Stable"
	GroupStatePreparingRebalance  = "PreparingRebalance"
	GroupStateCompletingRebalance = "CompletingRebalance"
	GroupStateEmpty               = "Empty"
	GroupStateDead                = "Dead"
	GroupStateUnknown             = "Unknown"
)

Canonical consumer-group states. Sarama returns backend-specific state strings; datasources normalize them to these values (falling back to GroupStateUnknown for anything unrecognized).

View Source
const ConnectorSecretPlaceholder = "********"

ConnectorSecretPlaceholder is substituted for masked secret values.

View Source
const DefaultTailRate = 20

DefaultTailRate is the live-tail delivery cap in messages per second.

View Source
const RateUnknown = -1.0

RateUnknown marks a rate field whose value has not been (or cannot be) collected, distinguishing "unknown" from a real zero rate. It matches the convention already used by ClusterOverview.

Variables

This section is empty.

Functions

func ByteRateDelay added in v0.1.34

func ByteRateDelay(byteCount, maxBytesPerSec int) time.Duration

ByteRateDelay returns how long to pause after consuming byteCount bytes to respect maxBytesPerSec. A non-positive limit or byte count yields no delay.

func ClampPageSize added in v0.1.34

func ClampPageSize(n int) int

ClampPageSize returns a valid page size: non-positive requests fall back to DefaultPageSize and requests above MaxPageSize are capped at MaxPageSize.

func ComputeSkew added in v0.1.34

func ComputeSkew(brokerCount int, avg float64, totalPartitions int) *float64

ComputeSkew returns the percentage deviation of a single broker's count from the per-role average, rounded half-up to one decimal place:

((brokerCount - avg) / avg) * 100

It returns nil (absent) when totalPartitions is below the significance threshold or when the average is zero, so callers can render "N/A"/"-".

func MaskConnectorConfig added in v0.1.34

func MaskConnectorConfig(config map[string]string) map[string]string

MaskConnectorConfig returns a copy of config with secret-like values replaced by ConnectorSecretPlaceholder. Key matching is case-insensitive substring matching against a fixed set of patterns (password, secret, token, key, credential, sasl.jaas.config). Non-secret keys are left untouched. Empty values are left untouched. A nil config yields nil.

func RoundHalfUp added in v0.1.34

func RoundHalfUp(v float64, decimals int) float64

RoundHalfUp rounds v to the given number of decimal places, rounding halves away from zero (so 12.35 -> 12.4, -12.35 -> -12.4).

func SortMessages added in v0.1.34

func SortMessages(msgs []Message, descending bool)

SortMessages orders a fetched page for display. When descending is true (backward modes: newest, to-offset, to-timestamp) messages are ordered newest-first; otherwise oldest-first. The sort is stable and, within a single partition, always preserves offset order regardless of equal timestamps.

func ValidateACLEntry added in v0.1.34

func ValidateACLEntry(e ACLEntry) error

ValidateACLEntry validates the shared, backend-agnostic invariants of an ACL binding: a well-formed principal and non-empty resource type/name, operation and permission. Host and PatternType defaulting is the caller's concern.

func ValidateClusterOverride added in v0.1.34

func ValidateClusterOverride(ds KafkaDataSource, override string) error

ValidateClusterOverride checks that override (if non-empty) names a real configured context on ds, so callers can fail fast on a typo'd --cluster/-c instead of silently falling back to a default cluster.

func ValidatePrincipal added in v0.1.34

func ValidatePrincipal(principal string) error

ValidatePrincipal checks that a principal is a non-empty "<type>:<name>" pair. The name part may itself contain colons (e.g. an SSL DN such as "User:CN=alice,OU=eng").

func ValidateQuotaEntity added in v0.1.34

func ValidateQuotaEntity(e ClientQuotaEntity) error

ValidateQuotaEntity checks that at least one of the entity's identifiers is set (non-nil). A fully-absent entity yields a QuotaValidationError.

Types

type ACLEntry added in v0.1.34

type ACLEntry struct {
	Principal    string // e.g. "User:CN=devuser,..."
	Host         string // e.g. "*" or specific IP
	ResourceType string // "Topic", "Group", "Cluster", etc.
	ResourceName string // resource name or "*"
	PatternType  string // "Literal", "Prefixed", etc.
	Operation    string // "Read", "Write", "Describe", etc.
	Permission   string // "Allow" or "Deny"
}

ACLEntry represents a single Kafka ACL binding.

func ExpandConsumerACLs added in v0.1.34

func ExpandConsumerACLs(principal, host string, topics, groups []string, topicPrefix, groupPrefix string) ([]ACLEntry, error)

ExpandConsumerACLs expands a consumer intent: READ+DESCRIBE on the given topics and groups. Lists become Literal bindings; the prefixes become Prefixed bindings. It rejects supplying both a list and a prefix for the same resource kind.

func ExpandProducerACLs added in v0.1.34

func ExpandProducerACLs(principal, host string, topics []string, topicPrefix, txID, txIDPrefix string, idempotent bool) ([]ACLEntry, error)

ExpandProducerACLs expands a producer intent: WRITE+DESCRIBE+CREATE on the topics, WRITE+DESCRIBE on the transactional id (exact or prefix), and, when idempotent, IDEMPOTENT_WRITE on the cluster.

func ExpandStreamAppACLs added in v0.1.34

func ExpandStreamAppACLs(principal, host, appID string, inputTopics, outputTopics []string) ([]ACLEntry, error)

ExpandStreamAppACLs expands a Kafka Streams application intent: READ on input topics (Literal), WRITE on output topics (Literal), and ALL on Prefixed appID for both Topic and Group resource types (internal topics/changelogs).

type ACLFilter added in v0.1.34

type ACLFilter struct {
	ResourceType string // "Topic", "Group", ... ("" = any)
	ResourceName string // exact resource name ("" = any)
	PatternType  string // "Literal", "Prefixed", ... ("" = any)
}

ACLFilter narrows an ACL listing by resource dimensions. An empty field matches any value.

type ACLNotFoundError added in v0.1.34

type ACLNotFoundError struct {
	Entry ACLEntry
	Cause error
}

ACLNotFoundError is returned when a delete targets a binding that does not exist (the broker matched zero ACLs).

func (ACLNotFoundError) Error added in v0.1.34

func (e ACLNotFoundError) Error() string

func (ACLNotFoundError) Unwrap added in v0.1.34

func (e ACLNotFoundError) Unwrap() error

type ACLValidationError added in v0.1.34

type ACLValidationError struct {
	Field  string
	Reason string
	Cause  error
}

ACLValidationError is returned when an ACL binding fails validation before any broker call (bad principal, empty field, unrecognized enum value).

func (ACLValidationError) Error added in v0.1.34

func (e ACLValidationError) Error() string

func (ACLValidationError) Unwrap added in v0.1.34

func (e ACLValidationError) Unwrap() error

type AccessDeniedError added in v0.1.34

type AccessDeniedError struct {
	Resource string
	Name     string // resource name, empty for unnamed/create checks
	Action   string
	Cause    error
}

AccessDeniedError is returned by the local authorization Gate when the active permission profile does not grant the attempted action on a resource. It is a self-imposed guardrail, not broker-side enforcement.

func (AccessDeniedError) Error added in v0.1.34

func (e AccessDeniedError) Error() string

func (AccessDeniedError) Unwrap added in v0.1.34

func (e AccessDeniedError) Unwrap() error

type AnalysisAlreadyRunningError added in v0.1.34

type AnalysisAlreadyRunningError struct {
	TopicName string
}

AnalysisAlreadyRunningError is returned when a topic analysis is started while one is already in progress for the same topic. (TP-29)

func (AnalysisAlreadyRunningError) Error added in v0.1.34

type AnalysisProgress added in v0.1.34

type AnalysisProgress struct {
	StartTime        time.Time
	ProcessedOffsets int64
	TotalOffsets     int64
	MessagesScanned  int64
	BytesScanned     int64
}

AnalysisProgress is a point-in-time snapshot of a running analysis.

func (AnalysisProgress) Percentage added in v0.1.34

func (p AnalysisProgress) Percentage() float64

Percentage returns the completion percentage, capped to [0,100]. When the total is unknown (0) it returns 0.

type AnalysisState added in v0.1.34

type AnalysisState string

AnalysisState is the lifecycle state of a topic analysis. (TP-29/TP-30)

const (
	AnalysisRunning   AnalysisState = "running"
	AnalysisCompleted AnalysisState = "completed"
	AnalysisFailed    AnalysisState = "failed"
)

type AuthenticationError added in v0.1.34

type AuthenticationError struct {
	Message string
	Method  string
}

AuthenticationError represents an authentication-related error

func NewAuthenticationError added in v0.1.34

func NewAuthenticationError(message, method string) AuthenticationError

NewAuthenticationError creates a new authentication error

func (AuthenticationError) Error added in v0.1.34

func (e AuthenticationError) Error() string

type AuthorizationError added in v0.1.34

type AuthorizationError struct {
	Message  string
	Resource string
	Action   string
}

AuthorizationError represents an authorization-related error

func NewAuthorizationError added in v0.1.34

func NewAuthorizationError(message, resource, action string) AuthorizationError

NewAuthorizationError creates a new authorization error

func (AuthorizationError) Error added in v0.1.34

func (e AuthorizationError) Error() string

type BrokerConfigEntry added in v0.1.34

type BrokerConfigEntry struct {
	Name      string
	Value     string
	Source    string
	Sensitive bool
	ReadOnly  bool
	Synonyms  []BrokerConfigSynonym
}

BrokerConfigEntry is a single broker configuration key/value with metadata.

type BrokerConfigSynonym added in v0.1.34

type BrokerConfigSynonym struct {
	Name   string
	Value  string
	Source string
}

BrokerConfigSynonym is one entry in a config value's synonym chain.

type BrokerDiskUsage added in v0.1.34

type BrokerDiskUsage struct {
	BrokerID         int32
	TotalSegmentSize int64
	SegmentCount     int
}

BrokerDiskUsage is per-broker log-directory usage.

type BrokerInfo added in v0.1.34

type BrokerInfo struct {
	ID           int32
	Host         string
	Port         int32
	Rack         string
	IsController bool
}

BrokerInfo describes a single Kafka broker as returned by a cluster describe.

type BrokerLogDir added in v0.1.34

type BrokerLogDir struct {
	Path   string
	Error  string
	Topics []BrokerLogDirTopic
}

BrokerLogDir describes one log directory on a broker. Error is the non-empty error string reported by the broker for that directory, if any.

type BrokerLogDirPartition added in v0.1.34

type BrokerLogDirPartition struct {
	Partition int32
	Size      int64
	OffsetLag int64
}

BrokerLogDirPartition describes a single partition's log within a directory.

type BrokerLogDirTopic added in v0.1.34

type BrokerLogDirTopic struct {
	Topic      string
	Partitions []BrokerLogDirPartition
}

BrokerLogDirTopic groups a topic's partition logs within a directory.

type BrokerMetrics added in v0.1.34

type BrokerMetrics struct {
	ID             int32
	LeaderCount    int
	ReplicaCount   int
	SegmentSize    int64
	BytesInPerSec  float64 // RateUnknown unless a metrics endpoint is configured
	BytesOutPerSec float64 // RateUnknown unless a metrics endpoint is configured
}

BrokerMetrics is per-broker collected metrics. It is adapted from the broker-stats primitive; byte rates require a configured metrics endpoint and are otherwise RateUnknown.

type BrokerNotFoundError added in v0.1.34

type BrokerNotFoundError struct {
	BrokerID int32
	Cause    error
}

BrokerNotFoundError is returned when a broker ID is unknown to the cluster.

func (BrokerNotFoundError) Error added in v0.1.34

func (e BrokerNotFoundError) Error() string

func (BrokerNotFoundError) Unwrap added in v0.1.34

func (e BrokerNotFoundError) Unwrap() error

type BrokerStats added in v0.1.34

type BrokerStats struct {
	SegmentSize        int64
	SegmentCount       int
	LeaderCount        int
	ReplicaCount       int
	InSyncReplicaCount int
	ReplicaSkew        *float64
	LeaderSkew         *float64
}

BrokerStats holds per-broker partition-distribution and disk-usage statistics. ReplicaSkew and LeaderSkew are pointers so an absent value ("not computed", e.g. fewer than 50 partitions in the cluster) is distinguishable from 0%.

type BrokerSummary added in v0.1.34

type BrokerSummary struct {
	BrokerCount      int
	ControllerID     *int32
	ClusterVersion   string
	OnlinePartitions int
	TotalPartitions  int
	UnderReplicated  int
	InSyncReplicas   int
	TotalReplicas    int
	OutOfSync        int
	ControllerType   string // "KRaft" | "ZooKeeper" | "Unknown"
}

BrokerSummary aggregates cluster-wide broker/partition health for the summary panel.

type BrowseEvent added in v0.1.34

type BrowseEvent struct {
	Phase       BrowsePhase
	Description string
	Stats       BrowseStats
	Done        bool
}

BrowseEvent is emitted during a browse to report progress. The datasource pushes these through the consume pipeline; the UI renders them.

type BrowsePhase added in v0.1.34

type BrowsePhase string
const (
	PhaseCreatingConsumer BrowsePhase = "creating-consumer"
	PhasePolling          BrowsePhase = "polling"
	PhaseDone             BrowsePhase = "done"
)

type BrowseSession added in v0.1.34

type BrowseSession struct {
	Topic      string
	Seek       SeekMode
	Partitions []int32
	Filter     string
	KeySerde   string
	ValueSerde string
	PageSize   int

	// NextPositions holds the next offset to poll per partition. It is updated
	// by RecordPage as pages are consumed.
	NextPositions map[int32]int64
	// contains filtered or unexported fields
}

BrowseSession preserves the query context of a browse so follow-up pages reuse the exact original query. It is the in-process equivalent of a cursor.

func NewBrowseSession added in v0.1.34

func NewBrowseSession(topic string, flags ConsumeFlags, filter string, pageSize int) *BrowseSession

NewBrowseSession builds a session from the flags that started a browse.

func (*BrowseSession) HasMore added in v0.1.34

func (s *BrowseSession) HasMore() bool

HasMore reports whether a next page may be available.

func (*BrowseSession) IsStale added in v0.1.34

func (s *BrowseSession) IsStale(topic string, seek SeekMode) bool

IsStale reports whether the session no longer matches the active query and therefore must not be continued.

func (*BrowseSession) RecordPage added in v0.1.34

func (s *BrowseSession) RecordPage(nextPositions map[int32]int64, more bool)

RecordPage stores the next per-partition positions to poll and whether more data may remain beyond this page.

type BrowseStats added in v0.1.34

type BrowseStats struct {
	MessagesConsumed int64
	BytesConsumed    int64
	FilterErrors     int64
	ElapsedMs        int64
}

BrowseStats accumulates counters over the lifetime of a browse fetch.

func (*BrowseStats) AddMessage added in v0.1.34

func (s *BrowseStats) AddMessage(m Message)

AddMessage folds one consumed message into the running totals.

type Capability added in v0.1.34

type Capability string

Capability names an optional feature a cluster supports. UI sections are gated on these.

const (
	CapSchemaRegistry Capability = "schema-registry"
	CapKafkaConnect   Capability = "kafka-connect"
	CapKsqlDB         Capability = "ksqldb"
	CapMetrics        Capability = "metrics"
	CapTopicDeletion  Capability = "topic-deletion"
	CapACLView        Capability = "acl-view"
	CapACLEdit        Capability = "acl-edit"
)

type CleanupPolicyError added in v0.1.34

type CleanupPolicyError struct {
	TopicName string
	Policy    string
}

CleanupPolicyError is returned when a message-purge is attempted on a topic whose cleanup.policy does not include "delete". (TP-9)

func (CleanupPolicyError) Error added in v0.1.34

func (e CleanupPolicyError) Error() string

type ClientQuotaEntity added in v0.1.34

type ClientQuotaEntity struct {
	User     *string
	ClientID *string
	IP       *string
}

ClientQuotaEntity identifies the target of a client quota. Each identifier is nil when absent, a pointer to the empty string for the <default> entity, and a pointer to a concrete value otherwise.

type ClientQuotaEntry added in v0.1.34

type ClientQuotaEntry struct {
	Entity ClientQuotaEntity
	Quotas map[string]float64
}

ClientQuotaEntry is a quota entity together with its configured quota values (e.g. "producer_byte_rate" -> 1048576).

type ClusterInfo added in v0.1.34

type ClusterInfo struct {
	Name              string
	Brokers           []string
	SchemaRegistryURL string
	IsCurrent         bool
	ReadOnly          bool
}

ClusterInfo holds the configuration details of a single Kafka cluster/context.

type ClusterMetrics added in v0.1.34

type ClusterMetrics struct {
	Cluster          string
	CollectedAt      time.Time
	BrokerCount      int
	TopicCount       int
	PartitionCount   int
	MessageCount     int64
	MessagesInPerSec float64 // RateUnknown until a second collection cycle establishes a delta
	BytesInPerSec    float64 // RateUnknown unless a metrics endpoint is configured
	BytesOutPerSec   float64 // RateUnknown unless a metrics endpoint is configured
	Topics           []TopicMetrics
	Brokers          []BrokerMetrics
}

ClusterMetrics is the display-oriented metrics snapshot for one cluster, cached by the background collector and read by the metrics page. Rate fields use RateUnknown (-1) to mean "not yet / not collected".

type ClusterNotFoundError added in v0.1.34

type ClusterNotFoundError struct {
	Name      string
	Available []string // known cluster names, when the caller has them handy
	Cause     error
}

ClusterNotFoundError is returned when a cluster/context name is unknown.

func (ClusterNotFoundError) Error added in v0.1.34

func (e ClusterNotFoundError) Error() string

func (ClusterNotFoundError) Unwrap added in v0.1.34

func (e ClusterNotFoundError) Unwrap() error

type ClusterOverview added in v0.1.34

type ClusterOverview struct {
	Name                 string
	Status               ClusterStatus
	LastError            string
	BrokerCount          int
	OnlinePartitionCount int
	TopicCount           int
	BytesInPerSec        float64
	BytesOutPerSec       float64
	MessagesInPerSec     float64
	ReadOnly             bool
	Version              string
	Capabilities         []Capability
}

ClusterOverview is the cached, display-oriented summary of a cluster shown on the dashboard. Rate fields use -1 to mean "unknown/not yet collected".

func (ClusterOverview) HasCapability added in v0.1.34

func (o ClusterOverview) HasCapability(c Capability) bool

HasCapability reports whether the overview lists the given capability.

type ClusterReadOnlyError added in v0.1.34

type ClusterReadOnlyError struct {
	Cluster   string
	Operation string
	Cause     error
}

ClusterReadOnlyError is returned when a mutating operation is attempted on a cluster configured as read-only.

func (ClusterReadOnlyError) Error added in v0.1.34

func (e ClusterReadOnlyError) Error() string

func (ClusterReadOnlyError) Unwrap added in v0.1.34

func (e ClusterReadOnlyError) Unwrap() error

type ClusterStatistics added in v0.1.34

type ClusterStatistics struct {
	BrokerCount               int
	ControllerID              int32
	OnlinePartitions          int
	OfflinePartitions         int
	InSyncReplicas            int
	OutOfSyncReplicas         int
	UnderReplicatedPartitions int
	DiskUsage                 []BrokerDiskUsage
	Version                   string
	CoordinationType          string // "kraft", "zookeeper", or "unknown"
}

ClusterStatistics is a freshly-collected detailed snapshot of a cluster.

type ClusterStatus added in v0.1.34

type ClusterStatus string

ClusterStatus is the health status of a cluster as tracked by the background collector.

const (
	ClusterInitializing ClusterStatus = "initializing"
	ClusterOnline       ClusterStatus = "online"
	ClusterOffline      ClusterStatus = "offline"
)

type ClusterValidation added in v0.1.34

type ClusterValidation struct {
	Cluster string
	Results []ValidationResult
}

ClusterValidation groups the per-component probe results for one cluster.

type CompatibilityLevel added in v0.1.34

type CompatibilityLevel string

CompatibilityLevel is a schema-registry compatibility setting. The zero value is invalid; use one of the constants below.

const (
	CompatibilityBackward           CompatibilityLevel = "BACKWARD"
	CompatibilityBackwardTransitive CompatibilityLevel = "BACKWARD_TRANSITIVE"
	CompatibilityForward            CompatibilityLevel = "FORWARD"
	CompatibilityForwardTransitive  CompatibilityLevel = "FORWARD_TRANSITIVE"
	CompatibilityFull               CompatibilityLevel = "FULL"
	CompatibilityFullTransitive     CompatibilityLevel = "FULL_TRANSITIVE"
	CompatibilityNone               CompatibilityLevel = "NONE"
)

func CompatibilityLevels added in v0.1.34

func CompatibilityLevels() []CompatibilityLevel

CompatibilityLevels lists every valid compatibility level in the order a UI selector should present them.

func (CompatibilityLevel) Valid added in v0.1.34

func (l CompatibilityLevel) Valid() bool

Valid reports whether l is one of the seven defined compatibility levels.

type ConnectCluster added in v0.1.34

type ConnectCluster struct {
	Name           string
	Address        string
	Version        string
	Commit         string
	KafkaClusterID string
	Reachable      bool

	// Aggregated statistics (only set when withStats=true).
	ConnectorCount       int
	FailedConnectorCount int
	TaskCount            int
	FailedTaskCount      int
}

ConnectCluster describes one Kafka Connect cluster together with optional aggregated statistics. Stats fields are populated only when requested (GetConnectClusters(withStats=true)); Reachable is false when the cluster's root endpoint could not be contacted, in which case the runtime fields (Version, Commit, KafkaClusterID) are empty.

type ConnectClusterNotFoundError added in v0.1.34

type ConnectClusterNotFoundError struct {
	Connect string // the Connect cluster name that was not found
	Cluster string // the active Kafka cluster/context it was looked up in
	Cause   error
}

ConnectClusterNotFoundError is returned when an operation references a Connect cluster name that is not configured for the active Kafka cluster.

func (ConnectClusterNotFoundError) Error added in v0.1.34

func (ConnectClusterNotFoundError) Unwrap added in v0.1.34

type ConnectionError added in v0.1.34

type ConnectionError struct {
	Message string
	Cause   error
}

ConnectionError represents a connection-related error

func NewConnectionError added in v0.1.34

func NewConnectionError(message string) ConnectionError

NewConnectionError creates a new connection error

func NewConnectionErrorWithCause added in v0.1.34

func NewConnectionErrorWithCause(message string, cause error) ConnectionError

NewConnectionErrorWithCause creates a new connection error with a cause

func (ConnectionError) Error added in v0.1.34

func (e ConnectionError) Error() string

func (ConnectionError) Unwrap added in v0.1.34

func (e ConnectionError) Unwrap() error

type Connector added in v0.1.34

type Connector struct {
	ConnectCluster  string
	Name            string
	Class           string
	Type            ConnectorType
	Topics          []string
	State           string
	WorkerID        string
	Trace           string
	TaskCount       int
	FailedTaskCount int
	ConsumerGroup   string // derived for sink connectors from the configured pattern
}

Connector is one connector as shown in the aggregated listing. Trace carries the connector-level error trace when the connector is FAILED.

type ConnectorAlreadyExistsError added in v0.1.34

type ConnectorAlreadyExistsError struct {
	Connector string
	Connect   string
	Cause     error
}

ConnectorAlreadyExistsError is returned when creating a connector whose name already exists on the Connect cluster.

func (ConnectorAlreadyExistsError) Error added in v0.1.34

func (ConnectorAlreadyExistsError) Unwrap added in v0.1.34

type ConnectorConfigKeyValidation added in v0.1.34

type ConnectorConfigKeyValidation struct {
	Name              string
	Value             string
	Errors            []string
	RecommendedValues []string
	Visible           bool
}

ConnectorConfigKeyValidation is the validation outcome for a single config key, mirroring the Connect REST API's per-value block.

type ConnectorDetails added in v0.1.34

type ConnectorDetails struct {
	ConnectCluster string
	Name           string
	Class          string
	Type           ConnectorType
	Config         map[string]string
	State          string
	WorkerID       string
	Trace          string
	Tasks          []ConnectorTask
	Topics         []string
	ConsumerGroup  string
}

ConnectorDetails combines a connector's configuration, status, tasks and topics. Config values are masked (secret-like keys replaced) before return.

type ConnectorNotFoundError added in v0.1.34

type ConnectorNotFoundError struct {
	Connector string
	Connect   string
	Cause     error
}

ConnectorNotFoundError is returned when a connector name is unknown to the Connect cluster.

func (ConnectorNotFoundError) Error added in v0.1.34

func (e ConnectorNotFoundError) Error() string

func (ConnectorNotFoundError) Unwrap added in v0.1.34

func (e ConnectorNotFoundError) Unwrap() error

type ConnectorNotStoppedError added in v0.1.34

type ConnectorNotStoppedError struct {
	Connector string
	Connect   string
	State     string
	Cause     error
}

ConnectorNotStoppedError is returned when an operation requiring a STOPPED connector (e.g. resetting offsets) is attempted on a connector in another state. It carries the connector's current state.

func (ConnectorNotStoppedError) Error added in v0.1.34

func (e ConnectorNotStoppedError) Error() string

func (ConnectorNotStoppedError) Unwrap added in v0.1.34

func (e ConnectorNotStoppedError) Unwrap() error

type ConnectorPlugin added in v0.1.34

type ConnectorPlugin struct {
	Class   string
	Type    string // source | sink
	Version string
}

ConnectorPlugin describes an installed connector plugin.

type ConnectorTask added in v0.1.34

type ConnectorTask struct {
	ID       int
	WorkerID string
	State    string // RUNNING | FAILED | PAUSED | RESTARTING | UNASSIGNED
	Trace    string
}

ConnectorTask is a single connector task with its runtime status.

type ConnectorType added in v0.1.34

type ConnectorType string

ConnectorType distinguishes source connectors (into Kafka) from sink connectors (out of Kafka).

const (
	ConnectorTypeSource  ConnectorType = "source"
	ConnectorTypeSink    ConnectorType = "sink"
	ConnectorTypeUnknown ConnectorType = "unknown"
)

type ConnectorValidationResult added in v0.1.34

type ConnectorValidationResult struct {
	Name       string
	ErrorCount int
	Groups     []string
	Configs    []ConnectorConfigKeyValidation
}

ConnectorValidationResult is the outcome of validating a candidate config against a plugin. ErrorCount is the total number of per-field errors; Configs holds the per-field definitions with any error messages.

type ConsumeFlags

type ConsumeFlags struct {
	Follow        bool
	Tail          int32
	OffsetFlag    string
	GroupFlag     string
	LimitMessages int64 // stop after N messages (0 = unlimited, runs until HWM or idle timeout)

	// Typed seek model (MSG-1). When Seek is set it takes precedence over
	// OffsetFlag for per-partition offset resolution; OffsetFlag remains for
	// backward compatibility with existing callers.
	Seek          SeekMode
	SeekOffset    *int64     // required for SeekFromOffset / SeekToOffset
	SeekTimestamp *time.Time // required for SeekFromTimestamp / SeekToTimestamp
	Partitions    []int32    // empty = all partitions
}

func DefaultConsumeFlags

func DefaultConsumeFlags() ConsumeFlags

func (ConsumeFlags) Validate added in v0.1.34

func (f ConsumeFlags) Validate() error

Validate checks that offset/timestamp seek modes carry their required value.

type ConsumerGroup

type ConsumerGroup struct {
	Name      string
	State     string
	Consumers int

	// Enrichment fields populated lazily by GetConsumerGroupDetails for the
	// visible page of rows. Lag is nil when undefined (no committed offsets).
	MemberCount       int
	TopicCount        int
	Lag               *int64
	CoordinatorID     int32
	PartitionAssignor string
	IsSimple          bool
}

type ConsumerGroupDetail added in v0.1.34

type ConsumerGroupDetail struct {
	GroupID           string
	State             string // canonical GroupState* value
	ProtocolType      string
	PartitionAssignor string
	IsSimple          bool // protocol type is not "consumer"
	CoordinatorID     int32
	Members           []GroupMember
	TopicOffsets      []PartitionOffset
}

ConsumerGroupDetail is the full description of a single consumer group.

type GroupLag added in v0.1.34

type GroupLag struct {
	TotalLag *int64
	PerTopic map[string]*int64
}

GroupLag is an aggregate lag view of a consumer group. TotalLag / PerTopic entries are nil when lag is undefined.

type GroupMember added in v0.1.34

type GroupMember struct {
	ConsumerID  string // MemberId assigned by the coordinator
	ClientID    string // ClientId from the member's join request
	Host        string // ClientHost
	Assignments []TopicPartition
}

GroupMember is a single active member of a consumer group.

type GroupNotEmptyError added in v0.1.34

type GroupNotEmptyError struct {
	GroupID string
	State   string
	Cause   error
}

GroupNotEmptyError is returned when a mutating operation (e.g. offset reset) requires an inactive group but the group still has active members. It carries the group's current state.

func (GroupNotEmptyError) Error added in v0.1.34

func (e GroupNotEmptyError) Error() string

func (GroupNotEmptyError) Unwrap added in v0.1.34

func (e GroupNotEmptyError) Unwrap() error

type GroupNotFoundError added in v0.1.34

type GroupNotFoundError struct {
	GroupID string
	Cause   error
}

GroupNotFoundError is returned when a consumer group id is unknown to the cluster.

func (GroupNotFoundError) Error added in v0.1.34

func (e GroupNotFoundError) Error() string

func (GroupNotFoundError) Unwrap added in v0.1.34

func (e GroupNotFoundError) Unwrap() error

type InvalidConfigError added in v0.1.34

type InvalidConfigError struct {
	Key    string
	Reason string
	Cause  error
}

InvalidConfigError is returned when the cluster rejects a config change. It carries the cluster's own rejection message in Reason.

func (InvalidConfigError) Error added in v0.1.34

func (e InvalidConfigError) Error() string

func (InvalidConfigError) Unwrap added in v0.1.34

func (e InvalidConfigError) Unwrap() error

type InvalidOffsetResetError added in v0.1.34

type InvalidOffsetResetError struct {
	Reason string
	Cause  error
}

InvalidOffsetResetError is returned when an offset reset request fails validation (unknown mode, missing timestamp/offsets, etc.).

func (InvalidOffsetResetError) Error added in v0.1.34

func (e InvalidOffsetResetError) Error() string

func (InvalidOffsetResetError) Unwrap added in v0.1.34

func (e InvalidOffsetResetError) Unwrap() error

type InvalidReplicationFactorError added in v0.1.34

type InvalidReplicationFactorError struct {
	TopicName string
	Reason    string
}

InvalidReplicationFactorError is returned when a requested replication factor fails validation (equal to current, < 1, or > available brokers). (TP-11)

func (InvalidReplicationFactorError) Error added in v0.1.34

type InvalidSeekError added in v0.1.34

type InvalidSeekError struct {
	Mode   string
	Reason string
	Cause  error
}

InvalidSeekError is returned when ConsumeFlags carry an invalid seek model (unknown mode, or an offset/timestamp mode missing its value). (MSG-1)

func (InvalidSeekError) Error added in v0.1.34

func (e InvalidSeekError) Error() string

func (InvalidSeekError) Unwrap added in v0.1.34

func (e InvalidSeekError) Unwrap() error

type KafkaDataSource

type KafkaDataSource interface {
	Init(cfgOption string)
	GetTopics() (map[string]Topic, error)
	// GetTopicNames returns only topic names using a lightweight metadata request.
	// This is significantly faster than GetTopics() on large clusters because it
	// skips per-partition replica details. Use it to show names immediately, then
	// call GetTopics() asynchronously to fill in partition/replication details.
	GetTopicNames() ([]string, error)
	GetContexts() ([]string, error)
	GetContext() string
	SetContext(contextName string) error
	// GetClusterDetails returns configuration details for the named cluster.
	// Used by the context view to display broker addresses and schema registry URL.
	GetClusterDetails(clusterName string) (ClusterInfo, error)
	GetConsumerGroups() ([]ConsumerGroup, error)
	// GetConsumerGroupDetail returns the full description of ONE consumer group,
	// including per-partition committed/end offsets and lag. It describes only
	// the named group (never the whole listing) and returns a GroupNotFoundError
	// when the group id is unknown.
	GetConsumerGroupDetail(groupID string) (ConsumerGroupDetail, error)
	// GetConsumerGroupDetails enriches a batch of groups (the currently visible
	// page of list rows) with real state, member/topic counts, lag, coordinator
	// and assignor. It is a bounded fan-out — pass only the visible names, never
	// the entire cluster. Groups that fail to describe keep state Unknown and nil
	// lag rather than failing the whole batch.
	GetConsumerGroupDetails(groupIDs []string) ([]ConsumerGroup, error)
	// GetConsumerGroupsForTopic returns groups related to a topic: a group is
	// related if any active member is assigned a partition of the topic or the
	// group has committed offsets for it. This inherently fans out and should be
	// invoked only on explicit user request.
	GetConsumerGroupsForTopic(topic string) ([]ConsumerGroup, error)
	// DeleteConsumerGroup deletes a consumer group. It returns a GroupNotEmptyError
	// when the group still has active members and a GroupNotFoundError when unknown.
	DeleteConsumerGroup(groupID string) error
	// DeleteConsumerGroupOffsets deletes the committed offsets of a single topic
	// for a group, leaving other topics' offsets and the group itself intact.
	DeleteConsumerGroupOffsets(groupID string, topic string) error
	// ResetConsumerGroupOffsets resets a group's committed offsets for a topic.
	// The group must be inactive (Empty or Dead); otherwise a GroupNotEmptyError
	// is returned. Invalid requests yield an InvalidOffsetResetError.
	ResetConsumerGroupOffsets(ctx context.Context, req OffsetResetRequest) error
	ConsumeTopic(ctx context.Context, topicName string, flags ConsumeFlags, handleMessage MessageHandlerFunc, onError func(err any)) error
	// ProduceMessage produces a single record to the topic. It validates that
	// the topic exists and that any explicit partition is in range, returning a
	// TopicNotFoundError, PartitionError, or ProduceError respectively.
	ProduceMessage(ctx context.Context, topic string, rec ProduceRecord) error
	// GetTopicMessageCounts fetches approximate message counts for a set of topics.
	// It accepts a map of topicName → numPartitions (already known from GetTopics).
	// Counts are computed as sum(newestOffset - oldestOffset) across all partitions.
	// Returns a best-effort map: topics that fail are omitted rather than failing the whole call.
	GetTopicMessageCounts(topics map[string]int32) (map[string]int64, error)
	// GetSchemas returns all registered schema subjects from the schema registry.
	// It fetches only subject names — no version/ID/type details — so it completes
	// with a single HTTP request even for large registries.
	// Returns an empty slice (not an error) when no schema registry is configured.
	GetSchemas() ([]Schema, error)
	// GetSchemaDetails fetches the latest version metadata (version, id, schemaType)
	// for a specific set of subjects. Used to lazily populate table rows for the
	// current page rather than loading details for all subjects at once.
	GetSchemaDetails(subjects []string) ([]Schema, error)
	// GetSchemaContent fetches the full schema definition string (Avro JSON, Protobuf IDL, etc.)
	// for the given subject. Pass version=0 to retrieve the latest version.
	GetSchemaContent(subject string, version int) (string, error)
	// GetSchemaVersions lists all registered versions of a subject (metadata only;
	// Schema text is left empty — fetch it lazily via GetSchemaContent). Returns a
	// SubjectNotFoundError for an unknown subject and a
	// SchemaRegistryNotConfiguredError when no registry is configured. (SR-4)
	GetSchemaVersions(subject string) ([]SchemaVersion, error)
	// GetGlobalCompatibility returns the registry's global compatibility level. (SR-5)
	GetGlobalCompatibility() (CompatibilityLevel, error)
	// GetSubjectCompatibility returns a subject's effective compatibility level.
	// When the subject has no own setting it falls back to the global level and
	// returns isSubjectSpecific=false. (SR-5)
	GetSubjectCompatibility(subject string) (level CompatibilityLevel, isSubjectSpecific bool, err error)
	// RegisterSchema registers a new schema under the subject, creating the subject
	// if new or a new version otherwise. schemaType may be empty for AVRO. It maps
	// a 409 to SchemaIncompatibleError and a 422 to SchemaValidationError. (SR-7)
	RegisterSchema(subject, schemaText, schemaType string) (Schema, error)
	// CheckSchemaCompatibility tests a candidate schema against the subject's latest
	// version without registering it, returning the verbose messages on failure. (SR-8)
	CheckSchemaCompatibility(subject, schemaText, schemaType string) (compatible bool, messages []string, err error)
	// DeleteSubject deletes all versions of a subject. permanent=true performs a
	// hard delete (requires a prior soft delete). It returns the deleted version
	// numbers. (SR-9)
	DeleteSubject(subject string, permanent bool) ([]int, error)
	// DeleteSchemaVersion deletes a single version. Pass version=-1 to delete the
	// latest version. permanent=true performs a hard delete. (SR-9)
	DeleteSchemaVersion(subject string, version int, permanent bool) error
	// SetGlobalCompatibility sets the registry's global compatibility level. It
	// validates the level before making any HTTP call. (SR-10)
	SetGlobalCompatibility(level CompatibilityLevel) error
	// SetSubjectCompatibility sets a subject's compatibility level. It validates
	// the level before making any HTTP call. (SR-10)
	SetSubjectCompatibility(subject string, level CompatibilityLevel) error
	// GetACLs returns all ACL bindings for the current cluster.
	// Returns an empty slice (not an error) when the broker returns no ACLs
	// or the connected user lacks the DESCRIBE ACL on cluster resources.
	GetACLs() ([]ACLEntry, error)
	// GetACLsFiltered returns ACL bindings matching the given filter. Empty
	// filter fields match any value; GetACLs is the match-any case.
	GetACLsFiltered(filter ACLFilter) ([]ACLEntry, error)
	// CreateACL creates a single ACL binding. The entry is validated (principal
	// format, non-empty resource/operation/permission); an empty PatternType
	// defaults to Literal. Invalid entries yield an ACLValidationError.
	CreateACL(entry ACLEntry) error
	// DeleteACL deletes the ACL binding exactly matching the full entry
	// definition. It returns an ACLNotFoundError when no binding matches.
	DeleteACL(entry ACLEntry) error
	// GetClientQuotas returns all configured client quotas, deterministically
	// ordered (user -> client-id -> ip, absent identifiers last).
	GetClientQuotas() ([]ClientQuotaEntry, error)
	// AlterClientQuotas upserts the quota values for an entity with replace
	// semantics: the submitted map becomes the entity's complete property set
	// (absent properties are cleared); an empty/nil map deletes the entity.
	// A QuotaValidationError is returned when no entity identifier is set.
	AlterClientQuotas(entity ClientQuotaEntity, quotas map[string]float64) error
	// GetMessageSchemaInfo retrieves schema information for a message's key and value
	// Returns nil for non-Avro messages or when schema information is not available
	GetMessageSchemaInfo(keySchemaID, valueSchemaID string) (*MessageSchemaInfo, error)
	// DecodeMessage decodes the raw bytes of a message (e.g. Avro) into human-readable
	// Key/Value strings. If the message is already decoded or has no raw bytes to decode,
	// it is returned unchanged. This is used for lazy, on-demand decoding of visible messages.
	DecodeMessage(ctx context.Context, msg Message) (Message, error)
	// ListSerdes returns the names of the serdes available for decoding message
	// keys/values (for the topic-page serde selector). The UI offers "auto"
	// (auto-detection) in addition to these explicit names.
	ListSerdes() []string
	// GetClusterStatistics collects a fresh detailed snapshot of the named cluster.
	// No caching happens here; the background collector (pkg/cluster) owns caching.
	GetClusterStatistics(ctx context.Context, clusterName string) (ClusterStatistics, error)
	// GetClusterCapabilities probes which optional features the named cluster supports.
	GetClusterCapabilities(ctx context.Context, clusterName string) ([]Capability, error)
	// ValidateClusterConnection independently probes each component (broker, schema
	// registry, ...) of the named cluster and returns one result per component.
	// Works for non-active clusters without switching the active context.
	ValidateClusterConnection(ctx context.Context, clusterName string) ([]ValidationResult, error)

	// GetBrokers returns the brokers currently online in the active cluster,
	// with IsController set on the active controller.
	GetBrokers() ([]BrokerInfo, error)
	// GetBrokerStats returns per-broker partition-distribution / disk statistics
	// plus a cluster-wide BrokerSummary. Skew fields are absent (nil) when the
	// cluster has too few partitions to be meaningful.
	GetBrokerStats() (map[int32]BrokerStats, BrokerSummary, error)
	// GetBrokerLogDirs returns log directories for the given broker IDs. An empty
	// brokerIDs slice means "all brokers"; unknown IDs are silently dropped. On
	// timeout it returns an empty result rather than an error.
	GetBrokerLogDirs(brokerIDs []int32) (map[int32][]BrokerLogDir, error)
	// GetBrokerConfig returns the configuration entries for a broker. Unknown
	// broker IDs yield a BrokerNotFoundError.
	GetBrokerConfig(brokerID int32) ([]BrokerConfigEntry, error)
	// AlterBrokerConfig sets a single dynamic broker config key, preserving other
	// dynamic configs. A cluster rejection yields an InvalidConfigError.
	AlterBrokerConfig(brokerID int32, key, value string) error
	// AlterReplicaLogDir moves a topic-partition replica to a different log dir
	// on the target broker.
	AlterReplicaLogDir(brokerID int32, topic string, partition int32, logDir string) error
	// GetBrokerMetrics returns a JSON metrics snapshot for a broker, or a
	// MetricsNotAvailableError when metrics collection is not available.
	GetBrokerMetrics(brokerID int32) (string, error)

	// GetTopicConfig returns the topic's configuration entries with metadata
	// (default value derived from synonyms, source, sensitive, read-only). It
	// returns an empty slice (not an error) on authorization failure.
	GetTopicConfig(topicName string) ([]TopicConfigEntry, error)
	// GetTopicDetails returns per-partition detail plus topic-wide health
	// metrics. It returns a TopicNotFoundError when the topic does not exist.
	GetTopicDetails(topicName string) (TopicDetails, error)
	// GetTopicSizes returns the on-disk size (leader replicas only) per topic.
	// Best-effort: topics that fail are omitted from the result map.
	GetTopicSizes(topicNames []string) (map[string]int64, error)
	// CreateTopic creates a topic. A replicationFactor of -1 requests the
	// cluster default. Empty-valued config entries must be stripped by the
	// caller. It polls metadata until the topic is visible.
	CreateTopic(name string, numPartitions int32, replicationFactor int16, configs map[string]*string) error
	// DeleteTopic deletes a topic.
	DeleteTopic(name string) error
	// IsTopicDeletionEnabled reports whether the cluster permits topic deletion
	// (delete.topic.enable). Missing/unparseable config defaults to true.
	IsTopicDeletionEnabled() (bool, error)
	// UpdateTopicConfig incrementally alters the given topic config entries,
	// leaving unrelated entries untouched.
	UpdateTopicConfig(name string, entries map[string]*string) error
	// IncreasePartitions raises the topic's total partition count. It rejects a
	// decrease (PartitionDecreaseError) or a no-op (PartitionNoopError).
	IncreasePartitions(name string, totalCount int32) error
	// PurgeTopicMessages deletes records up to the high-watermark. A partition of
	// -1 purges all partitions. It returns a CleanupPolicyError for compact-only
	// topics.
	PurgeTopicMessages(name string, partition int32) error
	// RecreateTopic deletes and re-creates a topic preserving its partition
	// count, replication factor, and non-default configs.
	RecreateTopic(name string) error
	// ChangeReplicationFactor changes the replication factor of every partition
	// via a computed balanced reassignment across online brokers.
	ChangeReplicationFactor(name string, newFactor int16) error

	// StartTopicAnalysis begins a background scan+aggregation of the topic. It
	// returns an AnalysisAlreadyRunningError if one is already in progress and a
	// TopicNotFoundError for an unknown topic.
	StartTopicAnalysis(ctx context.Context, topicName string) error
	// GetTopicAnalysis returns the latest analysis (running/completed/failed) for
	// the topic, or (nil, nil) when none has ever been started.
	GetTopicAnalysis(topicName string) (*TopicAnalysis, error)
	// CancelTopicAnalysis cancels a running analysis, releasing its resources and
	// retaining no result.
	CancelTopicAnalysis(topicName string) error

	// GetConnectClusters lists the Connect clusters configured for the active
	// Kafka cluster. Each cluster is probed for its runtime info (version, commit,
	// kafka_cluster_id); an unreachable cluster is still listed with Reachable=false
	// and empty runtime fields (never failing the whole call). When withStats is
	// true it additionally computes per-cluster connector/task counts, which is
	// more expensive as it fetches connector status.
	GetConnectClusters(withStats bool) ([]ConnectCluster, error)
	// GetConnectorNames returns the connector names of a single Connect cluster
	// (fast, names only). Unknown cluster name yields a ConnectClusterNotFoundError.
	GetConnectorNames(connect string) ([]string, error)
	// GetConnectors returns connectors aggregated across all configured Connect
	// clusters, each enriched with type, topics, status and task counts. Unreachable
	// clusters are omitted (their connectors dropped) rather than failing the call.
	GetConnectors() ([]Connector, error)
	// GetConnectorDetails combines a connector's config, status, tasks and topics.
	// Config values are masked. Missing status yields state UNASSIGNED with an
	// empty task list rather than an error.
	GetConnectorDetails(connect, name string) (ConnectorDetails, error)
	// CreateConnector creates a connector from the given config. A duplicate name
	// yields a ConnectorAlreadyExistsError.
	CreateConnector(connect, name string, config map[string]string) (Connector, error)
	// UpdateConnectorConfig replaces a connector's configuration. The supplied
	// config is sent unmasked; masked placeholders must be resolved by the caller.
	UpdateConnectorConfig(connect, name string, config map[string]string) (Connector, error)
	// DeleteConnector deletes a connector. Unknown connector yields a
	// ConnectorNotFoundError.
	DeleteConnector(connect, name string) error
	// PauseConnector pauses a connector and its tasks.
	PauseConnector(connect, name string) error
	// ResumeConnector resumes a paused/stopped connector.
	ResumeConnector(connect, name string) error
	// StopConnector stops a connector (STOPPED state), a prerequisite for offset
	// reset.
	StopConnector(connect, name string) error
	// RestartConnector restarts the connector instance (not its tasks).
	RestartConnector(connect, name string) error
	// RestartConnectorTask restarts a single task of a connector by task id.
	RestartConnectorTask(connect, name string, taskID int) error
	// ResetConnectorOffsets resets a connector's offsets. The connector must be in
	// the STOPPED state; otherwise a ConnectorNotStoppedError is returned without
	// calling the API. Unknown connector yields a ConnectorNotFoundError.
	ResetConnectorOffsets(connect, name string) error
	// GetConnectorPlugins lists the connector plugins installed on a Connect cluster.
	GetConnectorPlugins(connect string) ([]ConnectorPlugin, error)
	// ValidateConnectorConfig validates a candidate configuration against a named
	// plugin class and returns the per-field validation outcome.
	ValidateConnectorConfig(connect, pluginClass string, config map[string]string) (ConnectorValidationResult, error)

	// ListKsqlStreams lists the ksqlDB streams for the active cluster (posts LIST
	// STREAMS; to /ksql). Not-configured yields a KsqlNotConfiguredError.
	ListKsqlStreams() ([]KsqlStream, error)
	// ListKsqlTables lists the ksqlDB tables for the active cluster (posts LIST
	// TABLES; to /ksql). Not-configured yields a KsqlNotConfiguredError.
	ListKsqlTables() ([]KsqlTable, error)
	// ExecuteKsql validates and executes a single ksqlDB statement, delivering all
	// outcomes (schema, data rows, statement responses, and errors) as
	// KsqlResultTables on the returned channel. Validation runs first and routing
	// (SELECT -> streaming query; everything else -> statement) is internal.
	// SELECT queries stream a schema table followed by one table per data row until
	// the query ends or ctx is cancelled; cancelling ctx terminates the server-side
	// query and closes the channel. A KsqlNotConfiguredError is returned (with a
	// nil channel) when no endpoint is configured.
	ExecuteKsql(ctx context.Context, sql string, props map[string]string) (<-chan KsqlResultTable, error)
}

type KsqlNoInstancesError added in v0.1.34

type KsqlNoInstancesError struct {
	Configured int
	Cause      error
}

KsqlNoInstancesError is returned when none of the configured ksqlDB endpoints could be reached (connection-level failure on every URL). Configured is the number of endpoints that were tried.

func (KsqlNoInstancesError) Error added in v0.1.34

func (e KsqlNoInstancesError) Error() string

func (KsqlNoInstancesError) Unwrap added in v0.1.34

func (e KsqlNoInstancesError) Unwrap() error

type KsqlNotConfiguredError added in v0.1.34

type KsqlNotConfiguredError struct {
	Cause error
}

KsqlNotConfiguredError is returned when a ksqlDB operation is attempted on a cluster that has no ksqlDB endpoint configured.

func (KsqlNotConfiguredError) Error added in v0.1.34

func (e KsqlNotConfiguredError) Error() string

func (KsqlNotConfiguredError) Unwrap added in v0.1.34

func (e KsqlNotConfiguredError) Unwrap() error

type KsqlResultTable added in v0.1.34

type KsqlResultTable struct {
	Title   string
	Columns []string
	Rows    [][]string
	IsError bool
}

KsqlResultTable is the universal result unit for every ksqlDB execution outcome. A schema announcement, a batch of data rows, a statement response, and an error all travel as this one type so the UI has a single render path.

IsError marks the table as an error report (rendered as a status-bar error rather than a data grid). A table with no columns is a placeholder the UI renders as "no results".

type KsqlServerError added in v0.1.34

type KsqlServerError struct {
	StatusCode int
	ErrorCode  int
	Message    string
	Raw        string
	Cause      error
}

KsqlServerError carries a ksqlDB REST non-2xx response. ksqlDB returns {"error_code": ..., "message": ...} bodies; ErrorCode is 0 when unparseable and Raw holds the verbatim response body.

func (KsqlServerError) Error added in v0.1.34

func (e KsqlServerError) Error() string

func (KsqlServerError) Unwrap added in v0.1.34

func (e KsqlServerError) Unwrap() error

type KsqlStream added in v0.1.34

type KsqlStream struct {
	Name        string
	Topic       string
	KeyFormat   string
	ValueFormat string
}

KsqlStream is one ksqlDB stream as reported by LIST STREAMS. KeyFormat is empty when the server reports only a single legacy `format` field (mapped to ValueFormat).

type KsqlTable added in v0.1.34

type KsqlTable struct {
	Name        string
	Topic       string
	KeyFormat   string
	ValueFormat string
	Windowed    bool
}

KsqlTable is one ksqlDB table as reported by LIST TABLES. Windowed reports whether the table is windowed.

type LogDirNotFoundError added in v0.1.34

type LogDirNotFoundError struct {
	Path  string
	Cause error
}

LogDirNotFoundError is returned when a log directory path is unknown.

func (LogDirNotFoundError) Error added in v0.1.34

func (e LogDirNotFoundError) Error() string

func (LogDirNotFoundError) Unwrap added in v0.1.34

func (e LogDirNotFoundError) Unwrap() error

type Message

type Message struct {
	Key   string
	Value string
	// RawKey and RawValue hold the original Kafka bytes for Avro-encoded messages.
	// They are populated at consumption time and decoded lazily via DecodeMessage.
	RawKey        []byte
	RawValue      []byte
	Offset        int64
	Partition     int32
	KeySchemaID   string
	ValueSchemaID string
	Headers       []MessageHeader
	// Timestamp is the message's broker timestamp. Zero when unknown. Used by the
	// analysis engine for time-range and hourly-bucket aggregation.
	Timestamp time.Time
	// TimestampType records how Timestamp was assigned (create vs log-append).
	TimestampType TimestampType
	// KeySize/ValueSize hold the raw byte sizes of the key/value. They are nil
	// when the key/value is null (as opposed to an empty byte slice, size 0).
	KeySize   *int
	ValueSize *int
	// HeadersSize is the summed byte size of all header keys and values.
	HeadersSize int
	// KeyNull/ValueNull distinguish a null key/value from an empty one.
	KeyNull   bool
	ValueNull bool
	// KeySerde/ValueSerde name the serde used to render the key/value. Until the
	// serde framework lands these carry the active decoder name (e.g. "avro").
	KeySerde   string
	ValueSerde string
}

type MessageHandlerFunc

type MessageHandlerFunc func(msg Message)

type MessageHeader added in v0.1.32

type MessageHeader struct {
	Key   string
	Value string
}

type MessageHeaders added in v0.1.32

type MessageHeaders []MessageHeader

type MessageSchemaInfo added in v0.1.34

type MessageSchemaInfo struct {
	KeySchema   *SchemaInfo `json:"keySchema,omitempty"`
	ValueSchema *SchemaInfo `json:"valueSchema,omitempty"`
}

MessageSchemaInfo contains schema information for a message's key and value

type MetadataTimeoutError added in v0.1.34

type MetadataTimeoutError struct {
	TopicName string
	Cause     error
}

MetadataTimeoutError is returned when a created topic does not become visible in cluster metadata within the bounded retry window. (TP-5)

func (MetadataTimeoutError) Error added in v0.1.34

func (e MetadataTimeoutError) Error() string

func (MetadataTimeoutError) Unwrap added in v0.1.34

func (e MetadataTimeoutError) Unwrap() error

type MetricPoint added in v0.1.34

type MetricPoint struct {
	Time  time.Time
	Value float64
}

MetricPoint is a single timestamped sample in a time series.

type MetricsNotAvailableError added in v0.1.34

type MetricsNotAvailableError struct {
	BrokerID int32
	Cause    error
}

MetricsNotAvailableError is returned when per-broker metrics cannot be retrieved.

func (MetricsNotAvailableError) Error added in v0.1.34

func (e MetricsNotAvailableError) Error() string

func (MetricsNotAvailableError) Unwrap added in v0.1.34

func (e MetricsNotAvailableError) Unwrap() error

type MetricsNotConfiguredError added in v0.1.34

type MetricsNotConfiguredError struct {
	Cluster string
	Cause   error
}

MetricsNotConfiguredError is returned by accessors that require a configured metrics endpoint (e.g. byte-rate scraping / range graphs) when the active cluster has no metrics configuration. Offset-delta metrics remain available without configuration, so this is only used by the endpoint-dependent paths.

func (MetricsNotConfiguredError) Error added in v0.1.34

func (MetricsNotConfiguredError) Unwrap added in v0.1.34

func (e MetricsNotConfiguredError) Unwrap() error

type NotSupportedError added in v0.1.34

type NotSupportedError struct {
	Operation string
}

NotSupportedError is returned by datasource stubs for capabilities not yet implemented by that backend.

func (NotSupportedError) Error added in v0.1.34

func (e NotSupportedError) Error() string

type OffsetResetMode added in v0.1.34

type OffsetResetMode string

OffsetResetMode selects how target offsets are computed for a reset.

const (
	OffsetResetEarliest  OffsetResetMode = "earliest"
	OffsetResetLatest    OffsetResetMode = "latest"
	OffsetResetTimestamp OffsetResetMode = "timestamp"
	OffsetResetExplicit  OffsetResetMode = "explicit"
)

type OffsetResetRequest added in v0.1.34

type OffsetResetRequest struct {
	GroupID          string
	Topic            string
	Mode             OffsetResetMode
	Partitions       []int32
	Timestamp        *time.Time      // required for OffsetResetTimestamp
	PartitionOffsets map[int32]int64 // required for OffsetResetExplicit
}

OffsetResetRequest describes a consumer-group offset reset. An empty Partitions slice targets all partitions of the topic.

type PartitionAnalysis added in v0.1.34

type PartitionAnalysis struct {
	Partition    int32
	MessageCount int64
	MinOffset    int64
	MaxOffset    int64
}

PartitionAnalysis holds the aggregated stats scoped to a single partition.

type PartitionDecreaseError added in v0.1.34

type PartitionDecreaseError struct {
	TopicName string
	Current   int32
	Requested int32
}

PartitionDecreaseError is returned when a partition-count change would reduce the number of partitions, which Kafka does not permit. (TP-8)

func (PartitionDecreaseError) Error added in v0.1.34

func (e PartitionDecreaseError) Error() string

type PartitionError added in v0.1.34

type PartitionError struct {
	Message     string
	TopicName   string
	PartitionID int32
}

PartitionError represents a partition-related error

func NewPartitionError added in v0.1.34

func NewPartitionError(message, topicName string, partitionID int32) PartitionError

NewPartitionError creates a new partition error

func (PartitionError) Error added in v0.1.34

func (e PartitionError) Error() string

type PartitionInfo added in v0.1.34

type PartitionInfo struct {
	ID              int32
	Leader          int32
	Replicas        []int32
	ISR             []int32
	OfflineReplicas []int32
	EarliestOffset  int64
	LatestOffset    int64
}

PartitionInfo is the per-partition detail of a topic. (TP-3)

func (PartitionInfo) IsUnderReplicated added in v0.1.34

func (p PartitionInfo) IsUnderReplicated() bool

IsUnderReplicated reports whether the partition has fewer in-sync replicas than assigned replicas.

func (PartitionInfo) MessageCount added in v0.1.34

func (p PartitionInfo) MessageCount() int64

MessageCount returns LatestOffset - EarliestOffset (never negative).

type PartitionNoopError added in v0.1.34

type PartitionNoopError struct {
	TopicName string
	Current   int32
}

PartitionNoopError is returned when the requested partition count equals the current count. (TP-8)

func (PartitionNoopError) Error added in v0.1.34

func (e PartitionNoopError) Error() string

type PartitionOffset added in v0.1.34

type PartitionOffset struct {
	Topic           string
	Partition       int32
	CommittedOffset *int64
	EndOffset       int64
	Lag             *int64
	MemberID        string // consumer assigned to this partition, if any
	MemberHost      string
}

PartitionOffset holds the committed/end offsets and derived lag for one partition of a consumer group.

CommittedOffset is nil when the group has no committed offset for the partition (e.g. a partition assigned to a member that has not committed yet). Lag is nil when it is undefined (no committed offset). These pointers keep "no value" distinguishable from a genuine 0.

type ProduceError added in v0.1.34

type ProduceError struct {
	Topic  string
	Reason string
	Cause  error
}

ProduceError is returned when producing a record to a topic fails. (MSG-30)

func (ProduceError) Error added in v0.1.34

func (e ProduceError) Error() string

func (ProduceError) Unwrap added in v0.1.34

func (e ProduceError) Unwrap() error

type ProduceRecord added in v0.1.34

type ProduceRecord struct {
	Key       []byte
	Value     []byte
	Headers   []MessageHeader
	Partition *int32 // nil = let the partitioner choose
}

ProduceRecord is a message to be produced to a topic. A nil Key or Value produces a null record, which is distinct from an empty (non-nil) slice.

type QuotaValidationError added in v0.1.34

type QuotaValidationError struct {
	Reason string
	Cause  error
}

QuotaValidationError is returned when a client-quota request fails validation before any broker call (e.g. no entity identifier set).

func (QuotaValidationError) Error added in v0.1.34

func (e QuotaValidationError) Error() string

func (QuotaValidationError) Unwrap added in v0.1.34

func (e QuotaValidationError) Unwrap() error

type RateLimiter added in v0.1.34

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

RateLimiter enforces a fixed maximum delivery rate. Wait blocks until the next slot is available or the context is done. A rate of zero disables it.

func NewRateLimiter added in v0.1.34

func NewRateLimiter(perSecond int) *RateLimiter

NewRateLimiter builds a limiter capped at perSecond deliveries. perSecond <= 0 yields an unlimited (no-op) limiter.

func (*RateLimiter) Wait added in v0.1.34

func (r *RateLimiter) Wait(ctx context.Context) error

Wait blocks until the caller may deliver the next message.

type RecreateTimeoutError added in v0.1.34

type RecreateTimeoutError struct {
	TopicName string
	Cause     error
}

RecreateTimeoutError is returned when a recreated topic's prior instance does not finish deleting before the bounded retry window expires. (TP-10)

func (RecreateTimeoutError) Error added in v0.1.34

func (e RecreateTimeoutError) Error() string

func (RecreateTimeoutError) Unwrap added in v0.1.34

func (e RecreateTimeoutError) Unwrap() error

type Schema added in v0.1.34

type Schema struct {
	Subject    string `json:"subject"`
	Version    int    `json:"version"`
	ID         int    `json:"id"`
	SchemaType string `json:"schemaType"` // AVRO, PROTOBUF, JSON — empty means AVRO
	// Compatibility is the subject's effective compatibility level (falling back
	// to the global level when the subject has no own setting). Empty when not
	// resolved. (SR-6)
	Compatibility string `json:"compatibility,omitempty"`
}

type SchemaIncompatibleError added in v0.1.34

type SchemaIncompatibleError struct {
	Subject string
	Message string
	Cause   error
}

SchemaIncompatibleError is returned when a candidate schema is incompatible with the subject's existing versions (registry HTTP 409). It carries the registry's own explanation in Message.

func (SchemaIncompatibleError) Error added in v0.1.34

func (e SchemaIncompatibleError) Error() string

func (SchemaIncompatibleError) Unwrap added in v0.1.34

func (e SchemaIncompatibleError) Unwrap() error

type SchemaInfo added in v0.1.34

type SchemaInfo struct {
	ID         int    `json:"id"`
	Schema     string `json:"schema"`
	Subject    string `json:"subject"`
	Version    int    `json:"version"`
	RecordName string `json:"recordName"` // The type name (e.g., AddedItemToChartEvent)
}

type SchemaRegistryNotConfiguredError added in v0.1.34

type SchemaRegistryNotConfiguredError struct {
	Cause error
}

SchemaRegistryNotConfiguredError is returned when a schema-registry operation is attempted on a cluster that has no schema registry configured. Listing calls may return empty instead, but content and mutation calls must error.

func (SchemaRegistryNotConfiguredError) Error added in v0.1.34

func (SchemaRegistryNotConfiguredError) Unwrap added in v0.1.34

type SchemaValidationError added in v0.1.34

type SchemaValidationError struct {
	Message string
	Cause   error
}

SchemaValidationError is returned when the registry rejects a schema as invalid (registry HTTP 422). It carries the registry's message.

func (SchemaValidationError) Error added in v0.1.34

func (e SchemaValidationError) Error() string

func (SchemaValidationError) Unwrap added in v0.1.34

func (e SchemaValidationError) Unwrap() error

type SchemaVersion added in v0.1.34

type SchemaVersion struct {
	Version    int    `json:"version"`
	ID         int    `json:"id"`
	SchemaType string `json:"schemaType"` // AVRO, PROTOBUF, JSON — empty means AVRO
	Schema     string `json:"schema"`
}

SchemaVersion is the metadata for a single registered version of a subject. Schema holds the full definition text; it may be empty when only metadata was requested (fetch the text lazily via GetSchemaContent).

type SchemaVersionNotFoundError added in v0.1.34

type SchemaVersionNotFoundError struct {
	Subject string
	Version int
	Cause   error
}

SchemaVersionNotFoundError is returned when a subject exists but the requested version does not.

func (SchemaVersionNotFoundError) Error added in v0.1.34

func (SchemaVersionNotFoundError) Unwrap added in v0.1.34

func (e SchemaVersionNotFoundError) Unwrap() error

type SeekMode added in v0.1.34

type SeekMode string

SeekMode selects where a browse starts (and, for backward modes, ends).

const (
	SeekNewest        SeekMode = "newest"         // most recent messages (default)
	SeekOldest        SeekMode = "oldest"         // from the earliest available offset
	SeekLive          SeekMode = "live"           // tail newly produced messages
	SeekFromOffset    SeekMode = "from-offset"    // forward from a given offset
	SeekToOffset      SeekMode = "to-offset"      // backward window ending at a given offset
	SeekFromTimestamp SeekMode = "from-timestamp" // forward from a given timestamp
	SeekToTimestamp   SeekMode = "to-timestamp"   // backward window ending at a given timestamp
)

func (SeekMode) Backward added in v0.1.34

func (m SeekMode) Backward() bool

Backward reports whether the seek mode reads newest-first (results ordered descending).

type SizeDistribution added in v0.1.34

type SizeDistribution struct {
	Count int64
	Sum   int64
	Min   int64
	Max   int64
	Avg   float64
	P50   int64
	P75   int64
	P95   int64
	P99   int64
	P999  int64
}

SizeDistribution summarises a set of byte sizes.

type SubjectNotFoundError added in v0.1.34

type SubjectNotFoundError struct {
	Subject string
	Cause   error
}

SubjectNotFoundError is returned when a subject is unknown to the registry.

func (SubjectNotFoundError) Error added in v0.1.34

func (e SubjectNotFoundError) Error() string

func (SubjectNotFoundError) Unwrap added in v0.1.34

func (e SubjectNotFoundError) Unwrap() error

type Summary added in v0.1.34

type Summary struct {
	Min   float64
	Max   float64
	Avg   float64
	Last  float64
	Count int
	OK    bool
}

Summary aggregates a time-series window. OK is false for an empty series.

type TimeSeries added in v0.1.34

type TimeSeries struct {
	Points []MetricPoint
}

TimeSeries is a time-ordered sequence of samples (oldest first) used to feed sparklines and summary aggregates on the metrics page.

func (TimeSeries) Summary added in v0.1.34

func (ts TimeSeries) Summary() Summary

Summary computes min/max/avg/last over the retained window. Negative ("unknown", RateUnknown) samples are skipped so a gap does not poison the aggregate; a series that is entirely unknown yields OK=false.

func (TimeSeries) Values added in v0.1.34

func (ts TimeSeries) Values() []float64

Values returns just the sample values in order, convenient for sparkline rendering.

type TimeoutError added in v0.1.34

type TimeoutError struct {
	Message string
	Timeout string
}

TimeoutError represents a timeout-related error

func NewTimeoutError added in v0.1.34

func NewTimeoutError(message, timeout string) TimeoutError

NewTimeoutError creates a new timeout error

func (TimeoutError) Error added in v0.1.34

func (e TimeoutError) Error() string

type TimestampType added in v0.1.34

type TimestampType string

TimestampType describes how a message's Timestamp was assigned by the broker.

const (
	TimestampTypeNone      TimestampType = "none"       // no timestamp available
	TimestampTypeCreate    TimestampType = "create"     // CreateTime (producer-assigned)
	TimestampTypeLogAppend TimestampType = "log-append" // LogAppendTime (broker-assigned)
)

type Topic

type Topic struct {
	// NumPartitions contains the number of partitions to create in the topic
	NumPartitions int32
	// ReplicationFactor contains the number of replicas to create for each partition
	ReplicationFactor int16
	// ReplicaAssignment contains the manual partition assignment, or the empty
	// array if we are using automatic assignment.
	ReplicaAssignment map[int32][]int32
	// ConfigEntries contains the custom topic configurations to set.
	ConfigEntries map[string]*string
	// Num of messages in the topic across all partitions
	MessageCount int64
}

type TopicAlreadyExistsError added in v0.1.34

type TopicAlreadyExistsError struct {
	TopicName string
	Cause     error
}

TopicAlreadyExistsError is returned when creating a topic that already exists. (TP-5)

func (TopicAlreadyExistsError) Error added in v0.1.34

func (e TopicAlreadyExistsError) Error() string

func (TopicAlreadyExistsError) Unwrap added in v0.1.34

func (e TopicAlreadyExistsError) Unwrap() error

type TopicAnalysis added in v0.1.34

type TopicAnalysis struct {
	Topic    string
	State    AnalysisState
	Progress AnalysisProgress
	Result   *TopicAnalysisResult
	Err      string
	ErrAt    time.Time
}

TopicAnalysis is the state + payload returned by GetTopicAnalysis. Exactly one of Result / Err is meaningful depending on State.

type TopicAnalysisResult added in v0.1.34

type TopicAnalysisResult struct {
	Topic                string
	MessageCount         int64
	MinOffset            int64
	MaxOffset            int64
	MinTimestamp         time.Time
	MaxTimestamp         time.Time
	NullKeys             int64
	NullValues           int64
	ApproxDistinctKeys   int64
	ApproxDistinctValues int64
	KeySize              SizeDistribution
	ValueSize            SizeDistribution
	// HourlyCounts maps a Unix-hour bucket (seconds truncated to the hour) to a
	// message count, retained only for the last 14 days.
	HourlyCounts map[int64]int64
	Partitions   []PartitionAnalysis
	CompletedAt  time.Time
}

TopicAnalysisResult is the completed aggregation of a topic scan.

type TopicConfigEntry added in v0.1.34

type TopicConfigEntry struct {
	Name      string
	Value     string
	Default   string
	Source    string
	Sensitive bool
	ReadOnly  bool
}

TopicConfigEntry describes a single topic configuration key with the metadata needed to render it: its effective value, the derived default, the config source, and whether it is sensitive (masked) or read-only. (TP-2)

type TopicDeletionDisabledError added in v0.1.34

type TopicDeletionDisabledError struct {
	TopicName string
}

TopicDeletionDisabledError is returned when topic deletion is attempted on a cluster with delete.topic.enable=false. (TP-6)

func (TopicDeletionDisabledError) Error added in v0.1.34

type TopicDetails added in v0.1.34

type TopicDetails struct {
	Name                      string
	Partitions                []PartitionInfo
	ReplicationFactor         int16
	IsInternal                bool
	UnderReplicatedPartitions int
	InSyncReplicas            int
	TotalReplicas             int
}

TopicDetails aggregates per-partition detail plus topic-wide health metrics. (TP-3)

func (TopicDetails) MessageCount added in v0.1.34

func (d TopicDetails) MessageCount() int64

MessageCount is the sum of per-partition (latest-earliest) message counts.

type TopicError added in v0.1.34

type TopicError struct {
	Message   string
	TopicName string
}

TopicError represents a topic-related error

func NewTopicError added in v0.1.34

func NewTopicError(message, topicName string) TopicError

NewTopicError creates a new topic error

func (TopicError) Error added in v0.1.34

func (e TopicError) Error() string

type TopicMetrics added in v0.1.34

type TopicMetrics struct {
	Name             string
	PartitionCount   int32
	MessageCount     int64
	MessagesInPerSec float64 // derived from message-count deltas; RateUnknown until a prior sample exists
}

TopicMetrics is per-topic collected metrics for one cluster.

type TopicNotFoundError added in v0.1.34

type TopicNotFoundError struct {
	TopicName string
	Cause     error
}

TopicNotFoundError is returned when a topic name is unknown to the cluster. (TP-3)

func (TopicNotFoundError) Error added in v0.1.34

func (e TopicNotFoundError) Error() string

func (TopicNotFoundError) Unwrap added in v0.1.34

func (e TopicNotFoundError) Unwrap() error

type TopicPartition added in v0.1.34

type TopicPartition struct {
	Topic     string
	Partition int32
}

TopicPartition identifies a single partition of a topic.

type TopicValidationError added in v0.1.34

type TopicValidationError struct {
	TopicName string
	Reason    string
	Cause     error
}

TopicValidationError is returned when the broker rejects a topic create/alter request as invalid (bad name, invalid config, too-high replication factor). (TP-5)

func (TopicValidationError) Error added in v0.1.34

func (e TopicValidationError) Error() string

func (TopicValidationError) Unwrap added in v0.1.34

func (e TopicValidationError) Unwrap() error

type ValidationReport added in v0.1.34

type ValidationReport struct {
	Clusters []ClusterValidation
}

ValidationReport is the outcome of probing a candidate configuration, with one entry per cluster. An empty candidate yields an empty report (nil Clusters).

type ValidationResult added in v0.1.34

type ValidationResult struct {
	Component string // "broker", "schema-registry", "tls", "connect:<name>", "ksql", "metrics"
	OK        bool
	Err       string
}

ValidationResult is the outcome of probing one component of a cluster connection.

Jump to

Keyboard shortcuts

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