Documentation ¶
Index ¶
- Constants
- Variables
- func CreateTracerProvider(endpoint string) (*sdktrace.TracerProvider, error)
- func EndTrace(span trace.Span)
- func GetMetricSamplingRate() float64
- func GetProjectID() string
- func InterceptRequest(r *http.Request) context.Context
- func InterceptRequestWithContext(ctx context.Context, r *http.Request) context.Context
- func IsRunning() bool
- func RecordError(ctx context.Context, err error, tags ...attribute.KeyValue) context.Context
- func RecordMetric(ctx context.Context, name string, value float64, tags ...attribute.KeyValue)
- func RecordSpanError(span trace.Span, err error, tags ...attribute.KeyValue)
- func RecordSpanErrorWithStack(span trace.Span, err ErrorWithStack)
- func SetDebugMode(l Logger)
- func SetFlushInterval(_ time.Duration)
- func SetOTLPEndpoint(newOtlpEndpoint string)
- func SetProjectID(id string)
- func Start(opts ...Option)
- func StartTrace(ctx context.Context, name string, tags ...attribute.KeyValue) (trace.Span, context.Context)
- func StartTraceWithTimestamp(ctx context.Context, name string, t time.Time, opts []trace.SpanStartOption, ...) (trace.Span, context.Context)
- func StartTraceWithTracer(ctx context.Context, tracer trace.Tracer, name string, t time.Time, ...) (trace.Span, context.Context)
- func StartTraceWithoutResourceAttributes(ctx context.Context, tracer trace.Tracer, name string, ...) (trace.Span, context.Context)
- func StartWithContext(ctx context.Context, opts ...Option)
- func Stop()
- type ErrorWithStack
- type Logger
- type OTLP
- type Option
- func WithEnvironment(environment string) Option
- func WithMetricSamplingRate(samplingRate float64) Option
- func WithProjectID(projectID string) Option
- func WithSamplingRate(samplingRate float64) Option
- func WithSamplingRateMap(rates map[trace.SpanKind]float64) Option
- func WithServiceName(serviceName string) Option
- func WithServiceVersion(serviceVersion string) Option
- type TraceType
Constants ¶
const ( Highlight contextKey = "highlight" RequestID = Highlight + "RequestID" SessionSecureID = Highlight + "SessionSecureID" )
const DeprecatedProjectIDAttribute = "highlight_project_id"
const DeprecatedRequestIDAttribute = "highlight_trace_id"
const DeprecatedSessionIDAttribute = "highlight_session_id"
const DeprecatedSourceAttribute = "Source"
const ErrorURLAttribute = "URL"
const LogEvent = "log"
const LogMessageAttribute = "log.message"
const LogMessageLegacyAttribute = "message"
const LogSeverityAttribute = "log.severity"
const LogSeverityDefaultAttribute = "level"
const LogSeverityLegacyAttribute = "severity"
const MetricEvent = "metric"
const MetricEventName = "metric.name"
const MetricEventValue = "metric.value"
const MetricSpanName = "highlight-metric"
const OTLPDefaultEndpoint = "https://otel.highlight.io:4318"
const ProjectIDAttribute = "highlight.project_id"
const RequestIDAttribute = "highlight.trace_id"
const SessionIDAttribute = "highlight.session_id"
const SourceAttribute = "highlight.source"
const TraceKeyAttribute = "highlight.key"
const TraceTypeAttribute = "highlight.type"
const UtilitySpanName = "highlight-ctx"
Variables ¶
var ( ContextKeys = struct { RequestID contextKey SessionSecureID contextKey }{ RequestID: RequestID, SessionSecureID: SessionSecureID, } )
var EmptyResourceAttributes = []attribute.KeyValue{ semconv.ServiceNameKey.String(""), semconv.ServiceVersionKey.String(""), semconv.ContainerIDKey.String(""), semconv.HostNameKey.String(""), semconv.OSDescriptionKey.String(""), semconv.OSTypeKey.String(""), semconv.ProcessExecutableNameKey.String(""), semconv.ProcessExecutablePathKey.String(""), semconv.ProcessOwnerKey.String(""), semconv.ProcessPIDKey.String(""), semconv.ProcessRuntimeDescriptionKey.String(""), semconv.ProcessRuntimeNameKey.String(""), semconv.ProcessRuntimeVersionKey.String(""), }
Functions ¶
func CreateTracerProvider ¶ added in v0.11.0
func CreateTracerProvider(endpoint string) (*sdktrace.TracerProvider, error)
func GetMetricSamplingRate ¶ added in v0.10.1
func GetMetricSamplingRate() float64
func GetProjectID ¶ added in v0.9.3
func GetProjectID() string
func InterceptRequest ¶
InterceptRequest calls InterceptRequestWithContext using the request object's context
func InterceptRequestWithContext ¶
InterceptRequestWithContext captures the highlight session and request ID for a particular request from the request headers, adding the values to the provided context.
func RecordError ¶
RecordError processes `err` to be recorded as a part of the session or network request. Highlight session and trace are inferred from the context. If no sessionID is set, then the error is associated with the project without a session context.
func RecordMetric ¶
RecordMetric is used to record arbitrary metrics in your golang backend. Highlight will process these metrics in the context of your session and expose them through dashboards. For example, you may want to record the latency of a DB query as a metric that you would like to graph and monitor. You'll be able to view the metric in the context of the session and network request and recorded it.
func RecordSpanError ¶ added in v0.8.7
func RecordSpanErrorWithStack ¶ added in v0.8.9
func RecordSpanErrorWithStack(span trace.Span, err ErrorWithStack)
func SetDebugMode ¶
func SetDebugMode(l Logger)
func SetFlushInterval ¶
SetFlushInterval allows you to override the amount of time in which the Highlight client will collect errors before sending them to our backend. - newFlushInterval is an integer representing seconds Deprecated - this is managed by the opentelemetry SDK.
func SetOTLPEndpoint ¶
func SetOTLPEndpoint(newOtlpEndpoint string)
SetOTLPEndpoint allows you to override the otlp address used for sending errors and traces. Use the root http url. Eg: https://otel.highlight.io:4318
func SetProjectID ¶
func SetProjectID(id string)
func Start ¶
func Start(opts ...Option)
Start is used to start the Highlight client's collection service.
func StartTrace ¶
func StartTraceWithTimestamp ¶ added in v0.9.13
func StartTraceWithTracer ¶ added in v0.11.0
func StartTraceWithoutResourceAttributes ¶ added in v0.9.12
func StartWithContext ¶
StartWithContext is used to start the Highlight client's collection service, but allows the user to pass in their own context.Context. This allows the user kill the highlight worker by canceling their context.CancelFunc.
Types ¶
type ErrorWithStack ¶ added in v0.8.9
type ErrorWithStack interface { Error() string StackTrace() errors.StackTrace }
type Logger ¶
type Logger interface { Error(v ...interface{}) Errorf(format string, v ...interface{}) }
Logger is an interface that implements Log and Logf
type Option ¶ added in v0.9.10
type Option interface {
// contains filtered or unexported methods
}
func WithEnvironment ¶ added in v0.9.14
func WithMetricSamplingRate ¶ added in v0.10.1
func WithProjectID ¶ added in v0.10.1
func WithSamplingRate ¶ added in v0.10.1
func WithSamplingRateMap ¶ added in v0.10.2
func WithServiceName ¶ added in v0.9.10
func WithServiceVersion ¶ added in v0.9.10
type TraceType ¶ added in v0.9.13
type TraceType string
const TraceTypeFrontendConsole TraceType = "frontend.console"
const TraceTypeHighlightInternal TraceType = "highlight.internal"
const TraceTypeNetworkRequest TraceType = "http.request"
const TraceTypePhoneHome TraceType = "highlight.phonehome"
const TraceTypeWebSocketRequest TraceType = "http.request.ws"