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

Add common tags for stats backends that support it #7651

Merged
merged 7 commits into from
Apr 13, 2021

Conversation

5antelope
Copy link
Member

Description

Opentsdb and statsd both support common tags that can be attached to all the metrics we emitted. They are useful to identify the latency at keyspace or shard level. However there is no easy way to integrate with that.

This PR does 2 things:

  1. passes the common tags from a comma-separated string and we can tag the stats client directly
  2. minor change on opentsdb and statsd init process by adding InitWithoutServenv so that we can init them without servenv. This can be useful to reuse the stats backend on other binaries that does not use servenv (e.g., vtorc, vtbench)

Related Issue(s)

Checklist

  • Should this PR be backported?
  • Tests were added or are not required
  • Documentation was added or is not required

Deployment Notes

Impacted Areas in Vitess

Components that this PR will affect:

  • Query Serving
  • VReplication
  • Cluster Management
  • Build/CI
  • VTAdmin

Signed-off-by: crowu <y.wu4515@gmail.com>
Signed-off-by: crowu <y.wu4515@gmail.com>
Signed-off-by: crowu <y.wu4515@gmail.com>
Signed-off-by: crowu <y.wu4515@gmail.com>
@5antelope
Copy link
Member Author

@deepthi sorry for the ping - would you mind taking a look when you get a chance? Thanks! :-)

Signed-off-by: crowu <y.wu4515@gmail.com>
Signed-off-by: crowu <y.wu4515@gmail.com>
Signed-off-by: crowu <y.wu4515@gmail.com>
@5antelope
Copy link
Member Author

Gentle reminder :-)

Copy link
Member

@deepthi deepthi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine to me.
One question: why did you decide to extract out InitWithoutServenv? I don't see it being called outside servenv.OnRun.

@5antelope
Copy link
Member Author

Looks fine to me.
One question: why did you decide to extract out InitWithoutServenv? I don't see it being called outside servenv.OnRun.

I extract it out so that it is possible to reuse stats in other Vitess components that does not set up servenv (e.g., vtorc, vtbench, etc.). For example, in the plugin we can have statsd.InitWithoutServenv("vtbench") to support statsd in vtbench

@deepthi deepthi merged commit b999be8 into vitessio:master Apr 13, 2021
@@ -46,6 +46,9 @@ var statsBackend = flag.String("stats_backend", "", "The name of the registered
var combineDimensions = flag.String("stats_combine_dimensions", "", `List of dimensions to be combined into a single "all" value in exported stats vars`)
var dropVariables = flag.String("stats_drop_variables", "", `Variables to be dropped from the list of exported variables.`)

// CommonTags is a comma-separated list of common tags for stats backends
var CommonTags = flag.String("stats_common_tags", "", `Comma-separated list of common tags for the stats backend. It provides both label and values. Example: label1:value1,label2:value2`)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this should use flagutil.StringMapValue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants