package module
Version: v0.0.4 Latest Latest

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


Traefik Datadog Event

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


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


Required: true

Your Datadog API key.



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


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


The event title. Limited to 100 characters.


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


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.



Package traefik_datadog_event can trigger Datadog events when some pattern matches



This section is empty.


This section is empty.


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


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)

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL