-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Add Redis Sentinel Input Plugin #5978
Conversation
If you'd like me to add more tests for the other measurements I can do that, wanted to get an initial review before I spent more time on it. |
@danielnelson Any update? We'd like to start pulling my PR changes into mainline |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
@glinton will address tomorrow, thanks for the review! |
Any update on merge? Excited to see this work. |
Soon. Personal and work life have taken a priority to this. |
Address code review comments
Still trying to figure out why this the tests are failing, the output isn't terribly useful.
|
I recommend using Here is an example of use, you can ignore the metric time using the https://github.com/influxdata/telegraf/blob/master/plugins/processors/pivot/pivot_test.go |
Use `uptime_ns` per upstream request and get tests passing
Record all errors with accumulator AddError()
- Add tests against `sentinel {masters,sentinels,replicas}` - Convert `info all` test to use testutil.RequireMetricsEqual - Change has-quorum to int (from bool)
Everything (code, tests, documentation) should be in now, please re-review. I'd love to get this in for 1.13 time |
|
||
- fields: | ||
- config-epoch (int) | ||
- down-after-milliseconds (int) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would down_after_ns
be feasable (convert ms to ns as well)?
|
||
- fields: | ||
- config-epoch (int) | ||
- down-after-milliseconds (int) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would down_after_ns
be feasable (convert ms to ns as well)?
Correct README uptime -> uptime_ns
Address a PR suggestion
Per project standards change all metric names to snake case
Ensure compatibility with Go < 1.12
Any updates? |
The keys coming out did not have their dashes properly replaced with underscores
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delays in re-reviewing the requested changes. It looks like you've addressed them all. Thanks.
Can I assume this plugin will not be a part of 1.13? |
Yes, sorry. Let's put it down for 1.14 though for sure. |
@danielnelson ready to merge? Don't wanna miss 1.14 :) |
The Influxdata team is team building out in Phoenix this week, but I'll try to review on Friday once I'm back home. |
|
||
const measurementMasters = "redis_sentinel_masters" | ||
const measurementSentinel = "redis_sentinel" | ||
const measurementSentinels = "redis_sentinels" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redis_sentinel_sentinels
const measurementMasters = "redis_sentinel_masters" | ||
const measurementSentinel = "redis_sentinel" | ||
const measurementSentinels = "redis_sentinels" | ||
const measurementReplicas = "redis_replicas" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redis_sentinel_replicas
func (r *RedisSentinel) init(acc telegraf.Accumulator) error { | ||
if r.initialized { | ||
return nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename this function func (r *RedisSentinel) Init() error {
, you can remove the initialized boolean.
|
||
for i, serv := range r.Servers { | ||
if !strings.HasPrefix(serv, "tcp://") && !strings.HasPrefix(serv, "unix://") { | ||
log.Printf("W! [inputs.redis_sentinel]: server URL found without scheme; please update your configuration file") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't add in this support for addresses with a scheme, this is in the normal redis plugin only for backwards compatibility. If the address doesn't begin with tcp or unix return an error instead.
|
||
u, err := url.Parse(serv) | ||
if err != nil { | ||
acc.AddError(fmt.Errorf("Unable to parse to address %q: %v", serv, err)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Return an error here, which will cause the failure to be fatal. Since we are removing the warning on line 106, do this first and it will ease checking the scheme.
- fields: | ||
- down_after_milliseconds (int) | ||
- flags (string) | ||
- ip (string) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does ip
differ from sentinel_ip
? I think we should skip it as a field.
- link_pending_commands (int) | ||
- link_refcount (int) | ||
- name (string) | ||
- port (int) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is port
the same as sentinel_port
? If so let's skip this as well.
- total_connections_received (int) | ||
- total_net_input_bytes (int) | ||
- total_net_output_bytes (int) | ||
- uptime_ns (int, seconds) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
List units as nanoseconds.
- replica_port | ||
- source | ||
|
||
- fields: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like with the sentinels, I think we should remove the port, ip, and runid fields.
// ------------------------------------------------------------ | ||
|
||
// Check other Replicas | ||
replicasCmd := redis.NewSliceCmd("sentinel", "replicas", m["name"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found that in versions of Redis < 5, this command is called sentinel slaves <master-group-name>
. If we make this call with the older name, the plugin will work with at least back to Redis 3.0, and it continues to work current version.
Hi @adamflott, if you have a chance to take a look at @danielnelson's comments we are seeing if we can get this in to 1.14. Thanks! |
Hey @adamflott! Just a heads up we're a week out from finalizing our 1.14 release candidate if you have time to finish this plugin. We can help wrap things up as well if we have time. Just let us know, thanks! |
any progress? |
There's a last few fixes for this plugin @adamflott. If you'd like anyone to take this over just let us know. This plugin can also be used faster as an external plugin that can be used with |
@sjwang90 I have dropped the ball on this, but would like to finish it out since my project that uses this will finally be going live. Give me a few weeks to get the code changes in. |
Hey @adamflott any news on this? |
Due to my $work no longer taking interest in Redis, I too have lost interest. |
Thanks for letting us know @adamflott. We'll see if anyone else in the community is willing to take over your PR |
Continues in #10042 |
Thanks @spideyfusion! Going to close this PR. |
Fixed PR #5487
Required for all PRs: