caddy_datadog

package module
v0.0.0-...-ee5b56e Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2022 License: MIT Imports: 14 Imported by: 0

README

Datadog plugin for Caddy HTTP/2 web server

Datadog plugin allow Caddy HTTP/2 web server to send some metrics to Datadog via statsd, and optionally also send traces to Datadog APM.


Configuration

In your Caddy configuration file, you have to use the directive datadog to enable Datadog metric harvester on each configuration blocks where it was needed.

In the following example, all requests on example-d.com won't be harvested.

example-a.com {
  datadog "area"              # area is optional
}

example-b.com {
  datadog "area" {                # area is optional
    statsd        127.0.0.1:8125  # Optional - can be any valid hostname with port
    tags          tag1 tag2 tagN  # Optional
    namespace     caddy.          # Optional
    trace_enabled                 # Optional - whether to enable tracing to Datadog APM
    trace_agent   127.0.0.1:8126  # Optional - can be any valid hostname with port
    service_name  caddy           # Optional
  }
}

example-c.com {
  datadog
}

example-d.com {
}

Note: As you can see on the previous example, the directive datadog can be configured only once.

Metrics

The plugin send following metrics to Datadog:

Metric Type Unit
caddy.requests.per_s Gauge requests per second
caddy.responses.1xx Gauge requests
caddy.responses.2xx Gauge requests
caddy.responses.3xx Gauge requests
caddy.responses.4xx Gauge requests
caddy.responses.5xx Gauge requests
caddy.responses.size_byte Gauge bytes
caddy.responses.duration Gauge nanoseconds

License

This project is released under terms of the MIT license.

Documentation

Overview

* The MIT License (MIT) * * Copyright (c) 2017 PayinTech * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE.

* The MIT License (MIT) * * Copyright (c) 2017 PayinTech * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE.

* The MIT License (MIT) * * Copyright (c) 2017 PayinTech * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE.

Index

Constants

View Source
const (
	STATSD_SERVER    = "127.0.0.1:8125"
	STATSD_RATE      = 1.0
	STATSD_NAMESPACE = "caddy."
	TICKER_INTERVAL  = 10.0
	TRACE_AGENT      = "127.0.0.1:8126"
	SERVICE_NAME     = "caddy"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DatadogMetrics

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

type DatadogModule

type DatadogModule struct {
	Next    httpserver.Handler
	Metrics *DatadogMetrics
}

func (DatadogModule) ServeHTTP

func (datadog DatadogModule) ServeHTTP(responseWriter http.ResponseWriter, request *http.Request) (int, error)

Jump to

Keyboard shortcuts

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