Skip to content
This repository has been archived by the owner on Nov 24, 2021. It is now read-only.

Commit

Permalink
WIP - Release/2.0.0 (#47)
Browse files Browse the repository at this point in the history
* Build release/2.0.0

* Removed unused env var.

* New log-appender threading model.

Instead of using a scheduled thread, we use Object#wait() and
Object#notify() to trigger sending of LogEvents.

* Working threaded HTTP appender.

Resolves the issue with too many sockets opened.

* Verification changes.

Manually ran a test to ensure all 1,000,000 log statements are sent to Solr.

* Revert port changes on test loggers.

* Clean up code comments to more concise.

Also removed the 'RC' suffix from the CSD and parcel versions.
  • Loading branch information
bpmcd committed Aug 22, 2018
1 parent 6d438f4 commit f233c41
Show file tree
Hide file tree
Showing 16 changed files with 258 additions and 219 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class AlertEngineCliParser(args: Seq[String]) extends ScallopConf(args) {
lazy val smtpUser = opt[String]("smtp-user",
required = false,
descr = "SMTP username (from address), like 'user@company.com'")
lazy val smtpPassword : Option[String]= sys.env.get("SMTP_PASSWORD")
lazy val smtpPassword: Option[String] = sys.env.get("SMTP_PASSWORD")
lazy val smtpPort =
opt[Long]("smtp-port", required = false, descr = "SMTP server port. Defaults to 25")
lazy val smtp_tls = opt[Boolean]("smtp-tls",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,29 @@ import org.scalatest.FunSuite
class AlertEngineCliParserTest extends FunSuite {

/*
*function to set environmental variables for testing
*function to set environmental variables for testing
*/
def setEnv(key: String, value: String) = {
val field = System.getenv().getClass.getDeclaredField("m")
field.setAccessible(true)
val map = field.get(System.getenv()).asInstanceOf[java.util.Map[java.lang.String, java.lang.String]]
val map =
field.get(System.getenv()).asInstanceOf[java.util.Map[java.lang.String, java.lang.String]]
map.put(key, value)
}

test("Test Env variable setup") {
setEnv("SMTP_PASSWORD", "pa$$word")
setEnv("SMTP_USER", "testing@company.com")

val user : Option[String] = sys.env.get("SMTP_USER")
val password : Option[String] = sys.env.get("SMTP_PASSWORD")
val noneExistingEnvVariable : Option[String] = sys.env.get("xxx_xx_xxx_non_evn_variable")
val user: Option[String] = sys.env.get("SMTP_USER")
val password: Option[String] = sys.env.get("SMTP_PASSWORD")
val noneExistingEnvVariable: Option[String] = sys.env.get("xxx_xx_xxx_non_evn_variable")

assertResult(Some("testing@company.com"))(user)
assertResult(Some("pa$$word"))(password)
assertResult(None)(noneExistingEnvVariable)
}


test("Test AlertEngineCliParse") {
val args = Array(
"--conf",
Expand Down
2 changes: 1 addition & 1 deletion appenders/bash/example-logger.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ i=0
while [ $i -lt $numEvents ]
do
logger --category=category --level=INFO --message=Info --threadName=1 --application=pulse-test-default
if (( $numEvents % 300 == 0 ))
if (( $i % 300 == 0 ))
then
logger --category=category --level=ERROR --message=Error --threadName=1 --application=pulse-test-default
fi
Expand Down
4 changes: 2 additions & 2 deletions cloudera-integration/csd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ validate: descriptor/service.sdl

place:
echo placing jar in /opt/cloudera/csd
cp target/$(packageName).jar /opt/cloudera/csd
scp target/$(packageName).jar manager.valhalla.phdata.io:/opt/cloudera/csd
echo setting permissions
chown cloudera-scm: /opt/cloudera/csd/$(packageName).jar
ssh manager.valhalla.phdata.io chown cloudera-scm: /opt/cloudera/csd/$(packageName).jar

clean:
rm -rf target
2 changes: 1 addition & 1 deletion cloudera-integration/csd/csdVersion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
echo 1.0.2-cdh5
echo 2.0.0-cdh5
2 changes: 1 addition & 1 deletion cloudera-integration/csd/scripts/control.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
set -x

# fail if variables unset, on failure, or after pipe
set -euo pipefail
set -eo pipefail

CMD=$1

Expand Down
2 changes: 1 addition & 1 deletion cloudera-integration/parcel/parcelVersion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
echo 1.0.4-cdh5
echo 2.0.0-cdh5
Original file line number Diff line number Diff line change
Expand Up @@ -187,26 +187,28 @@ class CollectionRoller(solrService: SolrService, val now: ZonedDateTime)
val collections = solrService
.getAlias(alias)

collections.map { collectionSet =>
collectionSet.exists { coll =>
val collSeconds = CollectionNameParser.parseTimestamp(coll)
val instant = Instant.ofEpochSecond(collSeconds)
val latestDate = ZonedDateTime.ofInstant(instant, ZoneOffset.UTC)
val daysSinceLastRoll = ChronoUnit.DAYS.between(latestDate, now)

val result = daysSinceLastRoll >= application.rollPeriod.getOrElse(DEFAULT_ROLLPERIOD)

if (result){
logger.info(s"Rolling collection, last rolled on $latestDate")
collections
.map { collectionSet =>
collectionSet.exists { coll =>
val collSeconds = CollectionNameParser.parseTimestamp(coll)
val instant = Instant.ofEpochSecond(collSeconds)
val latestDate = ZonedDateTime.ofInstant(instant, ZoneOffset.UTC)
val daysSinceLastRoll = ChronoUnit.DAYS.between(latestDate, now)

val result = daysSinceLastRoll >= application.rollPeriod.getOrElse(DEFAULT_ROLLPERIOD)

if (result) {
logger.info(s"Rolling collection, last rolled on $latestDate")
} else {
val daysUntilNextRoll = application.rollPeriod.getOrElse(DEFAULT_ROLLPERIOD) - daysSinceLastRoll
logger.info(
s"No actions needed on collection, last rolled on $latestDate, will roll in $daysUntilNextRoll days")
}

result
}
else{
val daysUntilNextRoll = application.rollPeriod.getOrElse(DEFAULT_ROLLPERIOD) - daysSinceLastRoll
logger.info(s"No actions needed on collection, last rolled on $latestDate, will roll in $daysUntilNextRoll days")
}

result
}
}.getOrElse(false)
.getOrElse(false)

}

Expand Down
Loading

0 comments on commit f233c41

Please sign in to comment.