Skip to content

Commit

Permalink
Merge pull request pinterest#340 from tygrash/master
Browse files Browse the repository at this point in the history
Exiting with intelligent message when metric collector class config is missing
  • Loading branch information
HenryCaiHaiying authored May 19, 2017
2 parents 9cf87fc + f1913cc commit 63fcad5
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/pinterest/secor/common/SecorConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ public String getThriftProtocolClass() {
}

public String getMetricsCollectorClass() {
return mProperties.getString("secor.monitoring.metrics.collector.class");
return getString("secor.monitoring.metrics.collector.class");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,11 @@
*/
package com.pinterest.secor.parser;

import org.apache.commons.lang.StringUtils;

import java.util.Date;

import com.pinterest.secor.common.SecorConfig;
import com.pinterest.secor.message.Message;
import org.apache.commons.lang.StringUtils;


import java.util.Date;

/**
* Offset message parser groups messages based on the offset ranges.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,16 @@
*/
package com.pinterest.secor.parser;

import java.text.SimpleDateFormat;
import java.util.Date;

import com.pinterest.secor.common.SecorConfig;
import com.pinterest.secor.message.Message;
import net.minidev.json.JSONObject;
import net.minidev.json.JSONValue;
import javax.xml.bind.DatatypeConverter;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.pinterest.secor.common.SecorConfig;
import com.pinterest.secor.message.Message;
import javax.xml.bind.DatatypeConverter;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
* Iso8601MessageParser extracts timestamp field (specified by 'message.timestamp.name')
Expand Down Expand Up @@ -68,5 +66,4 @@ public String[] extractPartitions(Message message) throws Exception {

return result;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,4 @@ public long extractTimestampMillis(final Message message) {
}
return 0;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ private void finalizePartitionsUpTo(String topic, String[] uptoPartitions) throw
LOG.info("touching file {}", successFilePath);
FileUtil.touch(successFilePath);
}

}

public void finalizePartitions() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,11 @@
*/
package com.pinterest.secor.parser;

import org.apache.commons.lang.StringUtils;

import java.util.Date;

import com.pinterest.secor.common.SecorConfig;
import com.pinterest.secor.message.Message;
import org.apache.commons.lang.StringUtils;


import java.util.Date;

/**
* Offset message parser groups messages based on the offset ranges.
Expand All @@ -48,5 +45,4 @@ public String[] extractPartitions(Message message) throws Exception {
public long extractTimestampMillis(final Message message) {
return new Date().getTime(); //Daily Timestamp generation
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@

import com.pinterest.secor.common.SecorConfig;
import com.pinterest.secor.message.Message;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* RegexMessageParser extracts timestamp field (specified by 'message.timestamp.input.pattern')
Expand Down Expand Up @@ -54,5 +54,4 @@ public long extractTimestampMillis(final Message message) {
}
throw new NumberFormatException("Cannot find timestamp field in: " + line);
}

}

0 comments on commit 63fcad5

Please sign in to comment.