tracetagger

package module
v2.0.0-rc5 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2020 License: Apache-2.0 Imports: 16 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsSpanTagged

func IsSpanTagged(s *monkit.Span, tag *TagRef) bool

IsSpanTagged returns true if this specific Span got tagged.

func IsTraceTagged

func IsTraceTagged(t *monkit.Trace, tag *TagRef) bool

IsTraceTagged returns true if any span in the trace got tagged.

func JustTaggedSpans

func JustTaggedSpans(spans []*collect.FinishedSpan, tag *TagRef) (rv []*collect.FinishedSpan)

JustTaggedSpans filters a list of spans to just the ones that are explicitly tagged. It also keeps the first span either way, as that is probably the best name for the trace.

func SaveTrace

func SaveTrace(spans []*collect.FinishedSpan, capped bool, pathPrefix string) error

SaveTrace saves a trace to pathPrefix with ".json" or ".svg" added.

func SaveTracesWithTag

func SaveTracesWithTag(tag *TagRef, justTaggedSpans bool, traceMax int, path string) (cancel func())

SaveTracesWithTag saves all traces with the tag into the provided path as a folder

func Tag

func Tag(ctx context.Context, tag *TagRef) bool

Tag attempts to mark the current trace with the provided tag and if successful, returns true. It will not tag the current trace if the tag is not enabled. Tags are disabled by default.

func TagScope

func TagScope(tag *TagRef, s *monkit.Scope)

TagScope tags all functions that belong to the given scope

func TracePathPrefix

func TracePathPrefix(spans []*collect.FinishedSpan, capped bool) string

TracePathPrefix returns a relative path for the trace with everything but the extension

func TracesWithTag

func TracesWithTag(tag *TagRef, traceMax int, observe func(spans []*collect.FinishedSpan, capped bool)) (cancel func())

TracesWithTag calls the provided observe callback with all spans that belong to traces that are no longer running (no current spans with that trace exist), where at least one span was tagged with the provided tag. It returns a cancel method that will stop new trace collection as well as any currently collecting traces.

Types

type TagRef

type TagRef struct {
	// contains filtered or unexported fields
}

TagRef represents a distinct tag reference

func NewTagRef

func NewTagRef() *TagRef

NewTagRef is used for generating new tag references. Expected usage like:

package mypkg

import (...)

var DatabaseTag = tracetagger.NewTagRef()

func (*TagRef) Enable

func (t *TagRef) Enable() (disable func())

Enable enables the tag for tagging during the run of the function provided

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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