Skip to content

Commit

Permalink
Tracegen supports generating firehose spans (#1798)
Browse files Browse the repository at this point in the history
- add 'firehose' flag for tracegen
- upgrade jaeger-client-go version to 2.18.0

Signed-off-by: jung <jung@uber.com>
  • Loading branch information
guo0693 authored and yurishkuro committed Sep 19, 2019
1 parent 37a2e71 commit 7d339ef
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ required = [

[[constraint]]
name = "github.com/uber/jaeger-client-go"
version = "^2.17.0"
version = "^2.18.0"

[[constraint]]
name = "github.com/uber/jaeger-lib"
Expand Down
3 changes: 3 additions & 0 deletions internal/tracegen/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type Config struct {
Traces int
Marshal bool
Debug bool
Firehose bool
Pause time.Duration
Duration time.Duration
}
Expand All @@ -40,6 +41,7 @@ func (c *Config) Flags(fs *flag.FlagSet) {
fs.IntVar(&c.Traces, "traces", 1, "Number of traces to generate in each worker (ignored if duration is provided")
fs.BoolVar(&c.Marshal, "marshal", false, "Whether to marshal trace context via HTTP headers")
fs.BoolVar(&c.Debug, "debug", false, "Whether to set DEBUG flag on the spans to force sampling")
fs.BoolVar(&c.Firehose, "firehose", false, "Whether to set FIREHOSE flag on the spans to skip indexing")
fs.DurationVar(&c.Pause, "pause", time.Microsecond, "How long to pause before finishing trace")
fs.DurationVar(&c.Duration, "duration", 0, "For how long to run the test")
}
Expand All @@ -61,6 +63,7 @@ func Run(c *Config, logger *zap.Logger) error {
traces: c.Traces,
marshal: c.Marshal,
debug: c.Debug,
firehose: c.Firehose,
pause: c.Pause,
duration: c.Duration,
running: &running,
Expand Down
6 changes: 6 additions & 0 deletions internal/tracegen/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (

"github.com/opentracing/opentracing-go"
"github.com/opentracing/opentracing-go/ext"
"github.com/uber/jaeger-client-go"
"go.uber.org/zap"
)

Expand All @@ -31,6 +32,7 @@ type worker struct {
traces int // how many traces the worker has to generate (only when duration==0)
marshal bool // whether the worker needs to marshal trace context via HTTP headers
debug bool // whether to set DEBUG flag on the spans
firehose bool // whether to set FIREHOSE flag on the spans
duration time.Duration // how long to run the test for (overrides `traces`)
pause time.Duration // how long to pause before finishing the trace
wg *sync.WaitGroup // notify when done
Expand All @@ -55,6 +57,10 @@ func (w worker) simulateTraces() {
ext.SamplingPriority.Set(sp, 100)
}

if w.firehose {
jaeger.EnableFirehose(sp.(*jaeger.Span))
}

childCtx := sp.Context()
if w.marshal {
m := make(map[string]string)
Expand Down

0 comments on commit 7d339ef

Please sign in to comment.