Documentation
¶
Index ¶
Constants ¶
const DefaultMaxBackupSizeBytes = 10 * 1024 * 1024 // 10MB
Variables ¶
This section is empty.
Functions ¶
func ParseConfiguration ¶
func ParseConfiguration()
func SanitizeRedisURL ¶ added in v1.1.7
SanitizeRedisURL strips embedded credentials (userinfo) from a Redis URL so it can be safely published as a target attribute or used as a metric label. Scheme, host, port and path (database) are preserved. The full credentials remain in the endpoint configuration and are used for the actual connection.
func SetClusterNodes ¶ added in v1.1.18
func SetClusterNodes(endpoint *RedisEndpoint, nodeURLs []string)
SetClusterNodes records nodeURLs as the current nodes of the cluster reached through endpoint, so actions on a node's target connect with the endpoint's credentials and TLS settings. Nodes previously registered for the same endpoint but no longer listed are dropped, so an address that left the cluster stops resolving to its credentials. Each node endpoint is pinned to standalone mode and db 0: actions keep operating on that single node, and cluster nodes only support db 0.
func ValidateConfiguration ¶
func ValidateConfiguration()
Types ¶
type RedisEndpoint ¶
type RedisEndpoint struct {
URL string `json:"url"` // Redis connection URL (redis:// or rediss://)
Password string `json:"password,omitempty"` // Redis password
Username string `json:"username,omitempty"` // Redis username (Redis 6+ ACL)
DB int `json:"db,omitempty"` // Database number (default 0, ignored in cluster mode)
InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty"` // Skip TLS verification
Name string `json:"name,omitempty"` // Friendly name for this endpoint
// Cluster support
ClusterMode string `json:"clusterMode,omitempty"` // "auto" (default), "standalone", or "cluster"
MaxBackupSizeBytes int64 `json:"maxBackupSizeBytes,omitempty"` // Max total backup size for cache expiration (default 10MB)
}
func GetEndpointByURL ¶
func GetEndpointByURL(rawURL string) *RedisEndpoint
GetEndpointByURL resolves the configured endpoint for a (possibly credential-stripped) URL. Both sides are sanitized before comparison so a published, credential-free target URL still resolves to its endpoint configuration. URLs of discovered cluster nodes resolve to the endpoint registered via SetClusterNodes.
func (*RedisEndpoint) GetMaxBackupSizeBytes ¶ added in v1.1.0
func (e *RedisEndpoint) GetMaxBackupSizeBytes() int64
type Specification ¶
type Specification struct {
// JSON array of Redis endpoints
EndpointsJSON string `json:"endpointsJson" split_words:"true" required:"true"`
Endpoints []RedisEndpoint
// Discovery intervals in seconds
DiscoveryIntervalInstanceSeconds int `json:"discoveryIntervalInstanceSeconds" split_words:"true" default:"30"`
DiscoveryIntervalDatabaseSeconds int `json:"discoveryIntervalDatabaseSeconds" split_words:"true" default:"60"`
// Attribute exclusion patterns
DiscoveryAttributesExcludesInstances []string `json:"discoveryAttributesExcludesInstances" split_words:"true"`
DiscoveryAttributesExcludesDatabases []string `json:"discoveryAttributesExcludesDatabases" split_words:"true"`
}
var (
Config Specification
)