Documentation
¶
Overview ¶
Package telemetry holds what herald's spans and metrics share: the tracer, the attribute keys, the error classes and a small label vector over a go-utils metrics sink.
Nothing here ever reads an error's message. A driver error can quote up to 1KB of the vendor's response, and an SMTP error can name the recipient, so a failed span carries a class and the error's Go type, never its text.
Index ¶
- Constants
- func CallClass(ctx context.Context, err error) string
- func Fail(span trace.Span, class, errType string)
- func FailErr(span trace.Span, class string, err error)
- func NetClass(err error) string
- func SMTPClass(ctx context.Context, err error) string
- func Tracer() trace.Tracer
- func TypeOf(err error) string
Constants ¶
const ( KeyChannel = attribute.Key("herald.channel") KeyTemplate = attribute.Key("herald.template") KeyDriver = attribute.Key("herald.driver") KeyProviderID = attribute.Key("herald.provider.id") KeyResolveVia = attribute.Key("herald.resolve.via") KeyRecipientCount = attribute.Key("herald.recipient.count") KeySent = attribute.Key("herald.delivery.sent") KeyFailed = attribute.Key("herald.delivery.failed") KeySuppressed = attribute.Key("herald.suppressed") KeyChannelCount = attribute.Key("herald.channel.count") KeyChannelsFailed = attribute.Key("herald.channel.failed") KeyLocale = attribute.Key("herald.template.locale") KeyLocaleMatch = attribute.Key("herald.template.locale_match") KeyServerAddress = attribute.Key("server.address") KeyServerPort = attribute.Key("server.port") KeyHTTPMethod = attribute.Key("http.request.method") KeyHTTPStatusCode = attribute.Key("http.response.status_code") KeyURLTemplate = attribute.Key("url.template") KeyErrorType = attribute.Key("error.type") KeyExceptionType = attribute.Key("exception.type") )
Attribute keys herald sets. The semconv ones use the OpenTelemetry names.
const ( ClassTimeout = "timeout" ClassCanceled = "canceled" ClassDNS = "dns" ClassTLS = "tls" ClassConnection = "connection" ClassOther = "other" )
Network failure classes. These are the only values NetClass returns.
const ScopeName = "github.com/xraph/herald"
ScopeName is the instrumentation scope every herald span carries.
Variables ¶
This section is empty.
Functions ¶
func CallClass ¶
CallClass is NetClass for a call made under ctx. A deadline that has passed or a canceled ctx decides the class whatever err says, since http.Client's own timeout can surface as an unexported "request canceled" error that is neither a context error nor a net.Error.
func Fail ¶
Fail marks span as failed with class as the status description, and adds an exception event carrying only errType as exception.type. Both must be a class or a type name from a fixed set, never an error's message.
func FailErr ¶
FailErr is Fail with the Go type of err's innermost error. err's message is never read.
func NetClass ¶
NetClass sorts a transport failure into timeout, canceled, dns, tls, connection or other.
func SMTPClass ¶
SMTPClass is the class of a failed SMTP conversation under ctx: the server's reply code ("535", "550") when it answered with an error, otherwise CallClass.
Types ¶
This section is empty.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package metricsvec declares herald's labelled counters and histograms over a go-utils metrics sink.
|
Package metricsvec declares herald's labelled counters and histograms over a go-utils metrics sink. |
|
Package telemetrytest records what herald's telemetry emits, for tests: a span recorder installed as the global tracer provider, and a go-utils metrics sink that remembers every series registered on it.
|
Package telemetrytest records what herald's telemetry emits, for tests: a span recorder installed as the global tracer provider, and a go-utils metrics sink that remembers every series registered on it. |