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

Append the Storm component's task ID to the metric name, too #1

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

dschiavu
Copy link

@dschiavu dschiavu commented Feb 7, 2014

Hi,

This pull request appends the Storm component's task ID to the name of the metric sent to Statsd.

This is needed in cases of Storm component paralellism, because if a Storm component has multiple instances (tasks) running, each task records it own, separate metric, but the current implementation doesn't differentiate the separate tasks metrics, so the metrics get sent to Statsd under the same name, and then are furtherly aggregated by Statsd into a single metric. I think we need to differentiate the different task's metrics, so I've added the task ID to the metric name that gets sent to Statsd.

See Storm's default LoggingMetricsConsumer, which correctly records separate per-task metrics into the log file.

Danijel Schiavuzzi added 2 commits February 7, 2014 17:31
This is a workaround on Storm's imprecise metric emit interval, which
oscillates wildly around the user-defined metric emit interval value.

As Storm could (and does) emit multiple metrics in a single defined time
window, Statsd counts would be aggregated by Statsd (and of course,
duplicated), but gauges don't aggregate, so they're a safe alternative.

It would be best to make the Statsd metric type emitted
user-configurable.
@@ -139,7 +139,8 @@ public String toString() {
StringBuilder sb = new StringBuilder()
.append(clean(taskInfo.srcWorkerHost)).append(".")
.append(taskInfo.srcWorkerPort).append(".")
.append(clean(taskInfo.srcComponentId)).append(".");
.append(clean(taskInfo.srcComponentId)).append(".")
.append(taskInfo.srcTaskId).append(".");
Copy link
Contributor

Choose a reason for hiding this comment

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

I originally did not include the taskID on purpose. It is because the task ID assignment seems arbitrary (i.e. the same taskID is not assigned to the same worker/port) across topology restarts. So, to view this data in any sensible view in graphite, you would have to use sumSeries() and a wildcard on the taskID. To simplify things I just didn't include it.

I would probably be more open to making this a configurable option (e.g. metrics.statsd.includeTaskID) so it can be turned on/off, with the default being off.

Copy link
Author

Choose a reason for hiding this comment

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

+1 It would be great to make the task ID configurable! Especially since appending the task ID is what the the default LoggingMetricsConsumer does, so you can emit per-task metrics. In my use case, using statsd counters and aggregating metrics component-wide is not an option really, because I want to know per-component instance (i.e. task) metrics of my KafkaTridentSpout (it works by having a separate instance of this spout assigned to a separate Kafka partition), so the metrics aren't summable across tasks.

Danijel Schiavuzzi and others added 4 commits February 12, 2014 16:12
"metrics.statsd.metric_type" property. Allowable values: "counter"
(default) or "gauge".
"metrics.statsd.include_task_id" property. If set to true (default is
false), the Statsd metric name will include the Storm Task ID.
Add a new section "Statsd Metric Name" with info on the new configuration property "metrics.statsd.include_task_id".
@dschiavu
Copy link
Author

Hi Jason,

I've added more changes to the pull request, specifically:

  • I've made the Storm Task ID portion of the Statsd metric name configurable
  • I've made the Statsd metric type configurable

Please review the changes. It would be great if you could merge this into your master branch.

Regards,

Danijel

@dschiavu dschiavu closed this Feb 12, 2014
@dschiavu dschiavu reopened this Feb 12, 2014
@dschiavu
Copy link
Author

I've also modified the cleanup() method to remove the ":" (colon) character from the metric name, which is present in Trident topologies component names and must not be sent to Statsd (as per the Statsd protocol spec).

@dschiavu
Copy link
Author

Hi,

Any chance getting these changes into your branch?

Thanks,
Danijel

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

Successfully merging this pull request may close these issues.

2 participants