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

JIRA: SAMZA-1733 Specify MetricsSnapshotStream partitionKey in config #542

Closed

Conversation

rayman7718
Copy link
Contributor

  1. Adding config to specify MetricsSnapshotStream partitionKey, defaults to hostname (to maintain backword compat)

* @param systemStream The systemStream for the MetricsSnapshotStream
* @return the metric key name (if specified), else None
*/
def getMetricsReporterStreamPartitionKeyName(systemStream: SystemStream): Option[String] = getOption(MetricsConfig.METRICS_SNAPSHOT_REPORTER_PARTITION_KEY format(systemStream.getSystem, systemStream.getStream))
Copy link
Contributor

Choose a reason for hiding this comment

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

Should expose these configs independent of the systemStream. One alternative:

reporters.snapshot.key whose values can be in the set: {host, jobId, jobName}

Copy link
Contributor

@vjagadish1989 vjagadish1989 left a comment

Choose a reason for hiding this comment

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

another pass with suggestions for code organization. please let me know if something is unclear.

val METRICS_SNAPSHOT_REPORTER_INTERVAL = "metrics.reporter.%s.interval"
val METRICS_TIMER_ENABLED = "metrics.timer.enabled"
val METRICS_SNAPSHOT_REPORTER_PARTITION_KEY = "metrics.reporter.%s.partitionkey"
val METRICS_SNAPSHOT_REPORTER_PARTITION_KEY_JOBNAME = "jobname"
Copy link
Contributor

Choose a reason for hiding this comment

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

s/partition_key_jobname/partition_key_default

* @param jobName the current job name
* @param hostname the current host name
*/
def getMetricsReporterStreamPartitionKeyValue(keyName: Option[String], jobName: String, hostname: String) = keyName match {
Copy link
Contributor

Choose a reason for hiding this comment

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

prefer moving this method out of the MetricReporterConfig and instead adding it to SnapshotReporter instead.

…moving getPartitionValue method to MetricsSnapshotReporter
Copy link
Contributor

@nickpan47 nickpan47 left a comment

Choose a reason for hiding this comment

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

Mostly lgtm. Just some minor comments on coding style/pattern. Thanks!

val METRICS_TIMER_ENABLED= "metrics.timer.enabled"
val METRICS_SNAPSHOT_REPORTER_INTERVAL = "metrics.reporter.%s.interval"
val METRICS_TIMER_ENABLED = "metrics.timer.enabled"
val METRICS_SNAPSHOT_REPORTER_PARTITION_KEY = "metrics.reporter.%s.partitionkey"
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious, shouldn't we have a default value for this configuration variable?

import java.util.HashMap
import java.util.Map
import java.util.concurrent.Executors
import java.util.concurrent.TimeUnit

import scala.collection.JavaConverters._

object MetricsSnapshotReporter {
val METRICS_SNAPSHOT_REPORTER_PARTITION_KEY_DEFAULT = "jobname"
Copy link
Contributor

Choose a reason for hiding this comment

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

We use a pattern where the default value is set in config class's getXXXConfig() methods, instead of the static defaults in the implementation class.

@rayman7718 rayman7718 changed the title MetricsSnapshotReporter improvements JIRA: SAMZA-1733 Adding logic to specify MetricsSnapshotStream partitionKey in config. Aug 6, 2018
@rayman7718 rayman7718 changed the title JIRA: SAMZA-1733 Adding logic to specify MetricsSnapshotStream partitionKey in config. JIRA: SAMZA-1733 Specify MetricsSnapshotStream partitionKey in config Aug 6, 2018
def getMetricsReporterStreamPartitionKeyValue(keyName: String, jobName: String, hostname: String) = keyName match {
case "jobname" => jobName
case "hostname" => hostname
case _ => keyName
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this keyName or keyValue? The javadoc says "else returns the actual value specified", but the input argument only have key name. In addition, if "jobname" and "hostname" are special key names, I would prefer to define those as constant in MetricsConfig.

@rayman7718 rayman7718 closed this Apr 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants