Documentation ¶
Index ¶
- Constants
- Variables
- 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 StartTraceWithoutResourceAttributes(ctx context.Context, name string, opts []trace.SpanStartOption, ...) (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 LogSeverityAttribute = "log.severity"
const MetricEvent = "metric"
const MetricEventName = "metric.name"
const MetricEventValue = "metric.value"
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"
Variables ¶
var ( ContextKeys = struct { RequestID contextKey SessionSecureID contextKey }{ RequestID: RequestID, SessionSecureID: SessionSecureID, } )
Functions ¶
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 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
}