Documentation
¶
Index ¶
- Constants
- Variables
- func EndTrace(span trace.Span)
- func GetProjectID() string
- func GraphQLErrorPresenter(service string) func(ctx context.Context, e error) *gqlerror.Error
- func GraphQLRecoverFunc() graphql.RecoverFunc
- 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, tags ...attribute.KeyValue) (trace.Span, context.Context)
- func StartTraceWithoutResourceAttributes(ctx context.Context, name string, tags ...attribute.KeyValue) (trace.Span, context.Context)
- func StartWithContext(ctx context.Context, opts ...Option)
- func Stop()
- type ErrorWithStack
- type GraphqlTracer
- type Logger
- type OTLP
- type Option
- type TraceType
- type Tracer
- func (t Tracer) ExtensionName() string
- func (t Tracer) InterceptField(ctx context.Context, next graphql.Resolver) (interface{}, error)
- func (t Tracer) InterceptResponse(ctx context.Context, next graphql.ResponseHandler) *graphql.Response
- func (t Tracer) Validate(graphql.ExecutableSchema) error
- func (t Tracer) WithRequestFieldLogging() GraphqlTracer
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 TraceTypeAttribute = "highlight.type"
Variables ¶
var ( ContextKeys = struct { RequestID contextKey SessionSecureID contextKey }{ RequestID: RequestID, SessionSecureID: SessionSecureID, } )
Functions ¶
func GetProjectID ¶ added in v0.9.3
func GetProjectID() string
func GraphQLErrorPresenter ¶ added in v0.9.8
func GraphQLRecoverFunc ¶ added in v0.9.7
func GraphQLRecoverFunc() graphql.RecoverFunc
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 GraphqlTracer ¶
type GraphqlTracer interface {
graphql.HandlerExtension
graphql.ResponseInterceptor
graphql.FieldInterceptor
WithRequestFieldLogging() GraphqlTracer
}
func NewGraphqlTracer ¶
func NewGraphqlTracer(graphName string) GraphqlTracer
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 WithServiceName ¶ added in v0.9.10
func WithServiceVersion ¶ added in v0.9.10
type TraceType ¶ added in v0.9.13
type TraceType string
const TraceTypeHighlightInternal TraceType = "highlight.internal"
const TraceTypeNetworkRequest TraceType = "http.request"
type Tracer ¶
type Tracer struct {
// contains filtered or unexported fields
}
func (Tracer) ExtensionName ¶
func (Tracer) InterceptField ¶
InterceptField instruments timing of individual fields resolved.
func (Tracer) InterceptResponse ¶
func (t Tracer) InterceptResponse(ctx context.Context, next graphql.ResponseHandler) *graphql.Response
InterceptResponse instruments timing, payload size, and error information of the response handler. The metric is grouped by the corresponding operation name.
func (Tracer) WithRequestFieldLogging ¶ added in v0.9.6
func (t Tracer) WithRequestFieldLogging() GraphqlTracer
WithRequestFieldLogging configures the tracer to log each graphql operation.