Documentation
¶
Index ¶
- Constants
- func DefaultValue[T any]() T
- func DefaultWeaveWorksServerCfg() server.Config
- func LabelForParts(parts ...interface{}) string
- func LabelWithIndex(index int, parts ...interface{}) string
- func NewBlockWithOverride(name []string, label string, args component.Arguments) *builder.Block
- func NewBlockWithOverrideFn(name []string, label string, args component.Arguments, ...) *builder.Block
- func NewDiscoveryExports(expr string) discovery.Exports
- func NewDiscoveryTargets(expr string) []discovery.Target
- func PrettyPrint(in []byte) ([]byte, diag.Diagnostics)
- func SanitizeIdentifierPanics(in string) string
- func ToHttpClientConfig(httpClientConfig *prom_config.HTTPClientConfig) *config.HTTPClientConfig
- func ToProxyConfig(proxyConfig prom_config.ProxyConfig) *config.ProxyConfig
- func ToTLSConfig(tlsConfig *prom_config.TLSConfig) *config.TLSConfig
- func ValidateHttpClientConfig(httpClientConfig *prom_config.HTTPClientConfig) diag.Diagnostics
- func ValidateNodes(f *builder.File) diag.Diagnostics
- func ValidateSupported(validationType int, value1 any, value2 any, name string, message string) diag.Diagnostics
- func ValidateWeaveWorksServerCfg(cfg server.Config) diag.Diagnostics
- func WeaveworksServerToAlloyServer(config server.Config) *fnet.ServerConfig
- type ConvertAppendable
- type ConvertLogsReceiver
- type ConvertTargets
- type CustomTokenizer
Constants ¶
const ( Equals = iota NotEquals DeepEquals NotDeepEquals )
Variables ¶
This section is empty.
Functions ¶
func DefaultValue ¶
func DefaultValue[T any]() T
DefaultValue returns the default value for a given type. If *T implements syntax.Defaulter, a value will be returned with defaults applied. If *T does not implement syntax.Defaulter, the zero value of T is returned.
T must not be a pointer type.
func LabelForParts ¶
func LabelForParts(parts ...interface{}) string
LabelForParts generates a consistent component label for a set of parts delimited with an underscore.
func LabelWithIndex ¶
LabelWithIndex generates a consistent component label for a set of parts delimited with an underscore and suffixed with the provided index. If the index is 0, the label is generated without the index.
func NewBlockWithOverride ¶
NewBlockWithOverride generates a new *builder.Block using a hook to override specific types.
func NewBlockWithOverrideFn ¶
func NewBlockWithOverrideFn(name []string, label string, args component.Arguments, fn builder.ValueOverrideHook) *builder.Block
NewBlockWithOverrideFn generates a new *builder.Block using a hook fn to override specific types.
func NewDiscoveryExports ¶
NewDiscoveryExports will return a new discovery.Exports with a specific key for converter component exports. The argument will be tokenized as a component export string rather than the standard discovery.Target AlloyTokenize.
func NewDiscoveryTargets ¶
NewDiscoveryTargets will return a new [[]discovery.Target] with a specific key for converter component exports. The argument will be tokenized as a component export string rather than the standard discovery.Target AlloyTokenize.
func PrettyPrint ¶
func PrettyPrint(in []byte) ([]byte, diag.Diagnostics)
PrettyPrint parses Alloy config and returns it in a standardize format. If PrettyPrint fails, the input is returned unmodified.
func ToHttpClientConfig ¶
func ToHttpClientConfig(httpClientConfig *prom_config.HTTPClientConfig) *config.HTTPClientConfig
func ToProxyConfig ¶
func ToProxyConfig(proxyConfig prom_config.ProxyConfig) *config.ProxyConfig
func ToTLSConfig ¶
func ToTLSConfig(tlsConfig *prom_config.TLSConfig) *config.TLSConfig
func ValidateHttpClientConfig ¶
func ValidateHttpClientConfig(httpClientConfig *prom_config.HTTPClientConfig) diag.Diagnostics
ValidateHttpClientConfig returns diag.Diagnostics for currently unsupported Alloy features available in Prometheus.
func ValidateNodes ¶
func ValidateNodes(f *builder.File) diag.Diagnostics
ValidateNodes will look at the final nodes and ensure that there are no duplicate labels.
func ValidateSupported ¶
func ValidateSupported(validationType int, value1 any, value2 any, name string, message string) diag.Diagnostics
ValidateSupported will return a diagnostic error if the validationType specified results in a match for value1 and value2.
For example, if using validationType Equals and value1 is equal to value2, then a diagnostic error will be returned.
func ValidateWeaveWorksServerCfg ¶
func ValidateWeaveWorksServerCfg(cfg server.Config) diag.Diagnostics
func WeaveworksServerToAlloyServer ¶
func WeaveworksServerToAlloyServer(config server.Config) *fnet.ServerConfig
Types ¶
type ConvertAppendable ¶
type ConvertAppendable struct { storage.Appendable Expr string // The specific string to return during tokenization. }
ConvertAppendable implements both the builder.Tokenizer and storage.Appendable interfaces. This allows us to set component.Arguments that leverage storage.Appendable with an implementation that can be tokenized as a specific string.
func (ConvertAppendable) AlloyCapsule ¶
func (f ConvertAppendable) AlloyCapsule()
func (ConvertAppendable) AlloyTokenize ¶
func (f ConvertAppendable) AlloyTokenize() []builder.Token
type ConvertLogsReceiver ¶
type ConvertLogsReceiver struct { loki.LogsReceiver Expr string }
ConvertLogsReceiver allows us to override how the loki.LogsReceiver is tokenized. See ConvertAppendable as another example with more details in comments.
func (ConvertLogsReceiver) AlloyCapsule ¶
func (f ConvertLogsReceiver) AlloyCapsule()
func (ConvertLogsReceiver) AlloyTokenize ¶
func (f ConvertLogsReceiver) AlloyTokenize() []builder.Token
type ConvertTargets ¶
ConvertTargets implements builder.Tokenizer. This allows us to set component.Arguments with an implementation that can be tokenized with custom behaviour for converting.
func (ConvertTargets) AlloyCapsule ¶
func (f ConvertTargets) AlloyCapsule()
func (ConvertTargets) AlloyTokenize ¶
func (f ConvertTargets) AlloyTokenize() []builder.Token
type CustomTokenizer ¶
type CustomTokenizer struct {
Expr string
}
func (CustomTokenizer) AlloyTokenize ¶
func (f CustomTokenizer) AlloyTokenize() []builder.Token