internaltelemetry

package
v0.0.0-...-45b38f9 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

README

  • The internaltelemetry package

This package is a temporary location for the implementation of being able to log internal telemetry to the DataDog back end for internal consumption. The long-term mechanisms for this are currently being worked out. In the short term, this is a temporary package for a limited number of consumers who need to be able to log internal data.

Documentation

Overview

Package internaltelemetry full description in README.md

Package internaltelemetry full description in README.md

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

type Application struct {
	ServiceName     string `json:"service_name"`
	ServiceVersion  string `json:"service_version"`
	LanguageName    string `json:"language_name"`
	LanguageVersion string `json:"language_version"`
	TracerVersion   string `json:"tracer_version"`
}

Application defines the application object

type Client

type Client interface {
	SendLog(level string, message string)
	SendTraces(traces Traces)
}

Client defines the interface for a telemetry client

func NewClient

func NewClient(httpClient httpClient, endpoints []*Endpoint, service string, debug bool) Client

NewClient creates a new telemetry client

type Endpoint

type Endpoint struct {
	APIKey string `json:"-"`
	Host   string
}

Endpoint defines the endpoint object

type Event

type Event struct {
	APIVersion  string      `json:"api_version"`
	RequestType RequestType `json:"request_type"`
	TracerTime  int64       `json:"tracer_time"` // unix timestamp (in seconds)
	RuntimeID   string      `json:"runtime_id"`
	SequenceID  uint64      `json:"seq_id"`
	DebugFlag   bool        `json:"debug"`
	Origin      string      `json:"origin"`
	Host        Host        `json:"host"`
	Application Application `json:"application"`
	Payload     interface{} `json:"payload"`
}

Event defines the event object

type Host

type Host struct {
	Hostname      string `json:"hostname"`
	OS            string `json:"os"`
	Arch          string `json:"architecture"`
	KernelName    string `json:"kernel_name"`
	KernelRelease string `json:"kernel_release"`
	KernelVersion string `json:"kernel_version"`
}

Host defines the host object

type LogMessage

type LogMessage struct {
	Message string `json:"message"`
	Level   string `json:"level"`
}

LogMessage defines the log message object

type LogPayload

type LogPayload struct {
	Logs []LogMessage `json:"logs"`
}

LogPayload defines the log payload object

type RequestType

type RequestType string

RequestType defines the request type

const (
	// RequestTypeLogs defines the logs request type
	RequestTypeLogs RequestType = "logs"
	// RequestTypeTraces defines the traces request type
	RequestTypeTraces RequestType = "traces"
)

type Span

type Span struct {
	// Service is the name of the service that handled this span.
	Service string `json:"service"`
	// Name is the name of the operation this span represents.
	Name string `json:"name"`
	// Resource is the name of the resource this span represents.
	Resource string `json:"resource"`
	// TraceID is the ID of the trace to which this span belongs.
	TraceID uint64 `json:"trace_id"`
	// SpanID is the ID of this span.
	SpanID uint64 `json:"span_id"`
	// ParentID is the ID of the parent span.
	ParentID uint64 `json:"parent_id"`
	// Start is the start time of this span in nanoseconds since the Unix epoch.
	Start int64 `json:"start"`
	// Duration is the duration of this span in nanoseconds.
	Duration int64 `json:"duration"`
	// Error is the error status of this span.
	Error int32 `json:"error"`
	// Meta is a mapping from tag name to tag value for string-valued tags.
	Meta map[string]string `json:"meta,omitempty"`
	// Metrics is a mapping from metric name to metric value for numeric metrics.
	Metrics map[string]float64 `json:"metrics,omitempty"`
	// Type is the type of the span.
	Type string `json:"type"`
}

Span used for installation telemetry

type Trace

type Trace []*Span

Trace is a collection of spans with the same trace ID

type TracePayload

type TracePayload struct {
	Traces []Trace `json:"traces"`
}

TracePayload defines the trace payload object

type Traces

type Traces []Trace

Traces is a collection of traces

Jump to

Keyboard shortcuts

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