Skip to content

Commit 7d339ef

Browse files
guo0693yurishkuro
authored andcommitted
Tracegen supports generating firehose spans (#1798)
- add 'firehose' flag for tracegen - upgrade jaeger-client-go version to 2.18.0 Signed-off-by: jung <jung@uber.com>
1 parent 37a2e71 commit 7d339ef

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

Gopkg.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ required = [
9797

9898
[[constraint]]
9999
name = "github.com/uber/jaeger-client-go"
100-
version = "^2.17.0"
100+
version = "^2.18.0"
101101

102102
[[constraint]]
103103
name = "github.com/uber/jaeger-lib"

internal/tracegen/config.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ type Config struct {
3030
Traces int
3131
Marshal bool
3232
Debug bool
33+
Firehose bool
3334
Pause time.Duration
3435
Duration time.Duration
3536
}
@@ -40,6 +41,7 @@ func (c *Config) Flags(fs *flag.FlagSet) {
4041
fs.IntVar(&c.Traces, "traces", 1, "Number of traces to generate in each worker (ignored if duration is provided")
4142
fs.BoolVar(&c.Marshal, "marshal", false, "Whether to marshal trace context via HTTP headers")
4243
fs.BoolVar(&c.Debug, "debug", false, "Whether to set DEBUG flag on the spans to force sampling")
44+
fs.BoolVar(&c.Firehose, "firehose", false, "Whether to set FIREHOSE flag on the spans to skip indexing")
4345
fs.DurationVar(&c.Pause, "pause", time.Microsecond, "How long to pause before finishing trace")
4446
fs.DurationVar(&c.Duration, "duration", 0, "For how long to run the test")
4547
}
@@ -61,6 +63,7 @@ func Run(c *Config, logger *zap.Logger) error {
6163
traces: c.Traces,
6264
marshal: c.Marshal,
6365
debug: c.Debug,
66+
firehose: c.Firehose,
6467
pause: c.Pause,
6568
duration: c.Duration,
6669
running: &running,

internal/tracegen/worker.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222

2323
"github.com/opentracing/opentracing-go"
2424
"github.com/opentracing/opentracing-go/ext"
25+
"github.com/uber/jaeger-client-go"
2526
"go.uber.org/zap"
2627
)
2728

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

60+
if w.firehose {
61+
jaeger.EnableFirehose(sp.(*jaeger.Span))
62+
}
63+
5864
childCtx := sp.Context()
5965
if w.marshal {
6066
m := make(map[string]string)

0 commit comments

Comments
 (0)