Skip to content

grobinson-grafana/matchers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

matchers

matchers is a simple package to parse Prometheus-like matchers.

Example

package main

import (
	"fmt"
	"os"

	"github.com/grobinson-grafana/matchers"
	"github.com/prometheus/common/model"
)

func main() {
	labels := model.LabelSet{"foo": "bar"}
	m, err := matchers.Parse("{foo=~\"[a-z]+\"}")
	if err != nil {
		fmt.Fprint(os.Stderr, err)
		os.Exit(1)
	}
	ok := m.Matches(labels)
	fmt.Println(ok)
}

About

A simple package to parse Prometheus-like matchers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages