Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow non-integral values for kafka_span_sample_rate_percent #485

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
## Added
* Added a timeout for sink ingestion to all sinks, which prevents a single slow sink from blocking ingestion on other span sinks indefinitely. Thanks, [aditya](https://github.com/chimeracoder)!

## Changes
* `kafka_span_sample_rate_percent` now allows floating-point values. `kafka.NewKafkaSpanSink` now takes a floating point sample rate, accordingly. Thanks [chimeracoder](https://github.com/chimeracoder)!


## Bugfixes
* Added a timeout to the Kafka sink, which prevents the Kafka client from blocking other span sinks. Thanks, [aditya](https://github.com/chimeracoder)!

Expand Down
2 changes: 1 addition & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type Config struct {
KafkaSpanBufferFrequency string `yaml:"kafka_span_buffer_frequency"`
KafkaSpanBufferMesages int `yaml:"kafka_span_buffer_mesages"`
KafkaSpanRequireAcks string `yaml:"kafka_span_require_acks"`
KafkaSpanSampleRatePercent int `yaml:"kafka_span_sample_rate_percent"`
KafkaSpanSampleRatePercent float64 `yaml:"kafka_span_sample_rate_percent"`
KafkaSpanSampleTag string `yaml:"kafka_span_sample_tag"`
KafkaSpanSerializationFormat string `yaml:"kafka_span_serialization_format"`
KafkaSpanTopic string `yaml:"kafka_span_topic"`
Expand Down
6 changes: 2 additions & 4 deletions example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,8 @@ kafka_span_topic: "veneur_spans"
# of traceID
kafka_span_sample_tag: ""

# Sample rate in percent (as an integer)
# This should ideally be a floating point number, but at the time this was
# written, gojson interpreted whole-number floats in yaml as integers.
kafka_span_sample_rate_percent: 100
# Percentage of spans that will be sent to the Kafka sink
kafka_span_sample_rate_percent: 2.0

kafka_metric_buffer_bytes: 0

Expand Down
2 changes: 1 addition & 1 deletion sinks/kafka/kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ func (k *KafkaMetricSink) FlushOtherSamples(ctx context.Context, samples []ssf.S
}

// NewKafkaSpanSink creates a new Kafka Plugin.
func NewKafkaSpanSink(logger *logrus.Logger, cl *trace.Client, brokers string, topic string, partitioner string, ackRequirement string, retries int, bufferBytes int, bufferMessages int, bufferDuration string, serializationFormat string, sampleTag string, sampleRatePercentage int) (*KafkaSpanSink, error) {
func NewKafkaSpanSink(logger *logrus.Logger, cl *trace.Client, brokers string, topic string, partitioner string, ackRequirement string, retries int, bufferBytes int, bufferMessages int, bufferDuration string, serializationFormat string, sampleTag string, sampleRatePercentage float64) (*KafkaSpanSink, error) {
if logger == nil {
logger = &logrus.Logger{Out: ioutil.Discard}
}
Expand Down