traefik_datadog_event

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

README

Traefik Datadog Event

This plugin can be used to generate Datadog events if certain patterns match.

Installation

You're on Github:

  • Go to Datadog Event on Traefik Pilot and click the Install Plugin button.

You're on Traefik Pilot:

  • Click the Install Plugin button.

Plugin options

APIKey

Required: true

Your Datadog API key.

Patterns

CodePattern

This pattern compares the user-defined status code, with the response code.

BodyPattern

This pattern checks if the user-defined regex matches the response body.

If you specify multiple patterns (e.g Code and Body) the plugin will generate a new event only if all of them match.

Event options

Title

The event title. Limited to 100 characters.

Message

The body of the event. Limited to 4000 characters. The text supports markdown.

Priority

Default: normal

The priority of the event. For example, normal or low. Allowed enum values: normal, low

How to contribute

  1. Check for open issues or open a fresh issue to start a discussion around a feature idea or a bug.
  2. Fork the repository on GitHub to start making your changes to the master branch (or branch off of it).
  3. Write a test that shows that the bug was fixed or that the feature works as expected.
  4. Send a pull request and bug me until it gets merged and published.

Documentation

Overview

Package traefik_datadog_event can trigger Datadog events when some pattern matches

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPattern added in v0.0.4

func CheckPattern(pattern, value string) bool

CheckPattern checks if some pattern matches using regexp

func GenerateEventPayload added in v0.0.4

func GenerateEventPayload(a *DatadogEvent) *bytes.Buffer

GenerateEventPayload generates the JSON payload required by the Datadog API

func New

func New(ctx context.Context, next http.Handler, config *Config, name string) (http.Handler, error)

New created a new plugin

func SendEvent added in v0.0.4

func SendEvent(a *DatadogEvent)

SendEvent sends the HTTP event to Datadog

Types

type Config

type Config struct {
	APIKey      string `yaml:"APIKey"`
	CodePattern int    `yaml:"CodePattern"`
	BodyPattern string `yaml:"BodyPattern"`
	Title       string `yaml:"Title"`
	Message     string `yaml:"Message"`
	Priority    string `yaml:"Priority"`
}

Config the plugin configuration.

func CreateConfig

func CreateConfig() *Config

CreateConfig creates the default plugin configuration.

type DatadogEvent

type DatadogEvent struct {
	APIKey      string
	CodePattern int
	BodyPattern string
	Title       string
	Message     string
	Priority    string
	// contains filtered or unexported fields
}

DatadogEvent plugin

func (*DatadogEvent) ServeHTTP

func (a *DatadogEvent) ServeHTTP(rw http.ResponseWriter, req *http.Request)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL