-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Add datasource and taskId to metrics emitted by peons #1967
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,15 +28,21 @@ | |
| import com.google.inject.name.Names; | ||
| import com.metamx.common.logger.Logger; | ||
| import com.metamx.emitter.service.ServiceEmitter; | ||
| import com.metamx.metrics.JvmCpuMonitor; | ||
| import com.metamx.metrics.JvmMonitor; | ||
| import com.metamx.metrics.Monitor; | ||
| import com.metamx.metrics.MonitorScheduler; | ||
| import com.metamx.metrics.SysMonitor; | ||
| import io.druid.concurrent.Execs; | ||
| import io.druid.guice.DruidBinders; | ||
| import io.druid.guice.JsonConfigProvider; | ||
| import io.druid.guice.LazySingleton; | ||
| import io.druid.guice.ManageLifecycle; | ||
|
|
||
| import java.util.HashMap; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
| import java.util.Properties; | ||
| import java.util.Set; | ||
|
|
||
| /** | ||
|
|
@@ -95,4 +101,40 @@ public MonitorScheduler getMonitorScheduler( | |
| monitors | ||
| ); | ||
| } | ||
|
|
||
| @Provides | ||
| @ManageLifecycle | ||
| public JvmMonitor getJvmMonitor(Properties props) | ||
| { | ||
| return new JvmMonitor(getDimensions(props)); | ||
| } | ||
|
|
||
| @Provides | ||
| @ManageLifecycle | ||
| public JvmCpuMonitor getJvmCpuMonitor(Properties props) | ||
| { | ||
| return new JvmCpuMonitor(getDimensions(props)); | ||
| } | ||
|
|
||
| @Provides | ||
| @ManageLifecycle | ||
| public SysMonitor getSysMonitor(Properties props) | ||
| { | ||
| return new SysMonitor(getDimensions(props)); | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is dataSource and taskId relevant for SysMonitor? Wouldn't it report same thing independent of the jvm.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah, it reports the system level metrics and will be same for all the peons, I think it will still be useful to have a way to filter system level metrics for a given task in order to trace/debug issues better. e.g If one of the tasks is not able to ingest properly, it might be useful to filter the network metrics on that node by just selecting the taskID or dataSource.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
|
|
||
| private Map<String, String[]> getDimensions(Properties props) | ||
| { | ||
| Map<String, String[]> dimensions = new HashMap<>(); | ||
| for (String property : props.stringPropertyNames()) { | ||
| if (property.startsWith(MonitorsConfig.METRIC_DIMENSION_PREFIX)) { | ||
| dimensions.put( | ||
| property.substring(MonitorsConfig.METRIC_DIMENSION_PREFIX.length()), | ||
| new String[]{props.getProperty(property)} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have you tested this with the LoggingEmitter? and null property value?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I verified it with loggingEmitter,
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I might be missing it. Where guarantees that the property exists?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh nevermind |
||
| ); | ||
| } | ||
| } | ||
| return dimensions; | ||
| } | ||
|
|
||
| } | ||
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.
do we need to do any kind of escaping when interpolating the strings?
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 tested this with having blank spaces and quotes inside datasource name and its working fine.
don't think we need to do escaping there.