parser

package
v0.0.0-...-9cf64d8 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractPreservedLabels

func ExtractPreservedLabels(expr string) []string

ExtractPreservedLabels analyzes which labels are preserved through the expression

func IsConstantExpression

func IsConstantExpression(expr string) (bool, string)

IsConstantExpression checks if an expression is a constant (like vector(1))

Types

type Parser

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

func New

func New() *Parser

func (*Parser) GetRulesByName

func (p *Parser) GetRulesByName(name string) []*models.RecordingRule

GetRulesByName returns all rules with the given metric name

func (*Parser) ParseDirectory

func (p *Parser) ParseDirectory(dir string) ([]*models.RuleFile, error)

func (*Parser) ParseFile

func (p *Parser) ParseFile(filename string) (*models.RuleFile, error)

func (*Parser) ParseString

func (p *Parser) ParseString(content string, filename string) (*models.RuleFile, error)

ParseString parses YAML content from a string with an optional filename for reference