Coder Social home page Coder Social logo

rules_prometheus's Introduction

Prometheus bazel rules

Prometheus/Alertmanager rules for Bazel

TODO

  • integrate alertmanager and amtool into rules and workspace binaries (todo with sergey)
  • implement local backfiller (todo with alexander)
  • start alertmanager with input configs
  • unit test rules and toolchains
  • add linux toolchain
  • run some binary tests macros against prometheus server and alertmanager for smoke/integration/load testing
  • make toolchains work in containers

Initial project setup

You will need recent Bazel release, otherwise rules will download and discover dependent required tools

otherwise, refer to release page

Rules

promtool_config_test

promtool_config_test(name, srcs)

Run "promtool check config" against config targets

Example:

//examples:test_config_yml

load("//prometheus:defs.bzl", "promtool_config_test")
promtool_config_test(
    name = "test_config_yml",
    srcs = ["prometheus.yml"],
)
bazel test //examples:test_config_yml

//examples:test_config_yml                                      PASSED in 0.1s

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
srcs List of prometheus configuration targets List of labels required

promtool_rules_test

promtool_rules_test(name, srcs)

Run "promtool check rules" against rules targets

Example:

//examples:test_rules_yml
promtool_rules_test(
    name = "test_rules_yml",
    srcs = ["rules.yml"],
)
bazel test //examples:test_rules_yml

//examples:unit_test_rules_yml                                           PASSED in 0.3s

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
srcs List of Prometheus rules file targets List of labels required

promtool_unit_test

promtool_unit_test(name, rules, srcs)

Run "promtool test rules" against test targets and rules files

Example:

//examples:unit_test_rules_yml

load("//prometheus:defs.bzl", "promtool_unit_test")
promtool_unit_test(
name = "unit_test_rules_yml",
srcs = [
"tests.yml",
],
rules = ["rules.yml"],
)
bazel test //examples:unit_test_rules_yml

//examples:unit_test_rules_yml                                                PASSED in 0.1s

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
rules List of Rules-under-Test file targets List of labels required
srcs List of Prometheus Unit Test file targets List of labels required

prometheus

prometheus(name, kwargs)

Prometheus runner which will launch prometheus server

This will emit runnable sh_binary target which will invoke prometheus server with all arguments passed along. Tool will have access to workspace. It is intended for convenient in-workspace usage by human and not to be invoked programmatically.

Example:

load("//prometheus:defs.bzl", "prometheus")

package(default_visibility = ["//visibility:public"])

prometheus(
    name = "prometheus",
)

PARAMETERS

Name Description Default Value
name A unique name for this target. none
kwargs Attributes to be passed along none

promtool

promtool(name, kwargs)

Promtool runner which will launch promtool

This rule will emit runnable sh_binary target which will invoke promtool binary and all passed arguments along. Tool will have access to workspace. It is intended for convenient in-workspace usage by human and not to be invoked programmatically.

Example:

//:promtool
load("//prometheus:defs.bzl", "promtool")

package(default_visibility = ["//visibility:public"])

promtool(
    name = "promtool",
)

PARAMETERS

Name Description Default Value
name A unique name for this target. none
kwargs Attributes to be passed along none

Examples

Here

rules_prometheus's People

Contributors

5h4d0w4rt avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.