metrics

package
v2.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

* Copyright (c) 2022 Manabu Sonoda * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Setup

func Setup(bs json.RawMessage) (types.FilterPlugin, error)

Types

type DnsMsgLabel

type DnsMsgLabel struct {
	// Label name
	Name string
	// You can see getter names https://pkg.go.dev/github.com/mimuret/dnsutils/getter#DnsMsgGetterName.
	Attribute getter.DnsMsgGetterName
}

Specify if you want to get Prometheus label values from DNS messages.

type DnstapLabel

type DnstapLabel struct {
	// Label name
	Name string
	// getter func name
	// You can see getter names https://pkg.go.dev/github.com/mimuret/dnsutils/getter#DnstapGetterName.
	Attribute getter.DnstapGetterName
}

Specify if you want to get Prometheus label values from DNSTAP messages.

type Metrics

type Metrics struct {
	plugin.PluginCommon
	Rules []*MetricsRule
}

func (*Metrics) Filter

func (f *Metrics) Filter(dm *types.DnstapMessage) *types.DnstapMessage

type MetricsRule

type MetricsRule struct {
	// Use the filter setting if there are messages
	// you want to exclude before calculating the
	// metrics.
	Filters plugin.FilterPlugins
	// Specify if you want to get Prometheus
	// label values from DNSTAP messages.
	DnstapLabels []DnstapLabel
	// Specify if you want to get Prometheus
	// label values from DNS messages.
	DnsMsgLabels []DnsMsgLabel
	// prometheus.CounterOpts
	// Set metrics name, constLabel, etc.
	CounterOps prometheus.CounterOpts
	// contains filtered or unexported fields
}

The Metrics plugin generates metrics. The generated metrics are output at the same time as the dtap metrics.

func (*MetricsRule) GetLabels

func (c *MetricsRule) GetLabels(dm *types.DnstapMessage) []string

func (*MetricsRule) Setup

func (c *MetricsRule) Setup() error

Jump to

Keyboard shortcuts

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