package dnsconv

import "go.opentelemetry.io/otel/semconv/v1.32.0/dnsconv"

Package dnsconv provides types and functionality for OpenTelemetry semantic conventions in the "dns" namespace.

Index

Types

type ErrorTypeAttr

type ErrorTypeAttr string

ErrorTypeAttr is an attribute conforming to the error.type semantic conventions. It represents the describes the error the DNS lookup failed with.

var (
	// ErrorTypeOther is a fallback error value to be used when the instrumentation
	// doesn't define a custom value.
	ErrorTypeOther ErrorTypeAttr = "_OTHER"
)

type LookupDuration

type LookupDuration struct {
	metric.Float64Histogram
}

LookupDuration is an instrument used to record metric values conforming to the "dns.lookup.duration" semantic conventions. It represents the measures the time taken to perform a DNS lookup.

func NewLookupDuration

func NewLookupDuration(
	m metric.Meter,
	opt ...metric.Float64HistogramOption,
) (LookupDuration, error)

NewLookupDuration returns a new LookupDuration instrument.

func (LookupDuration) AttrErrorType

func (LookupDuration) AttrErrorType(val ErrorTypeAttr) attribute.KeyValue

AttrErrorType returns an optional attribute for the "error.type" semantic convention. It represents the describes the error the DNS lookup failed with.

func (LookupDuration) Description

func (LookupDuration) Description() string

Description returns the semantic convention description of the instrument

func (LookupDuration) Inst

Inst returns the underlying metric instrument.

func (LookupDuration) Name

func (LookupDuration) Name() string

Name returns the semantic convention name of the instrument.

func (LookupDuration) Record

func (m LookupDuration) Record(
	ctx context.Context,
	val float64,
	questionName string,
	attrs ...attribute.KeyValue,
)

Record records val to the current distribution.

The questionName is the the name being queried.

All additional attrs passed are included in the recorded value.

func (LookupDuration) Unit

func (LookupDuration) Unit() string

Unit returns the semantic convention unit of the instrument

Source Files

metric.go

Version
v1.41.0
Published
Mar 2, 2026
Platform
linux/amd64
Imports
5 packages
Last checked
1 hour ago

Tools for package owners.