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

Lwcapi merge #459

Merged
merged 178 commits into from Dec 2, 2016
Merged

Lwcapi merge #459

merged 178 commits into from Dec 2, 2016

Conversation

skandragon
Copy link
Contributor

Merge in lwcapi. This adds the requirement for travis to run a redid-server, although that is intended to go away in the future.

@brharrington brharrington added this to the 1.6.0 milestone Nov 22, 2016
atlas {
lwcapi {
register = {
default-frequency = 60000
Copy link
Contributor

Choose a reason for hiding this comment

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

Use duration format so it is easier to read and the unit is explicit.

redis = {
host = "localhost"
port = 6379
ttl = 300000 // in milliseconds, default 5 minutes
Copy link
Contributor

Choose a reason for hiding this comment

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

See above comment on duration format.


def redisHost: String = config.getString("redis.host")
def redisPort: Int = config.getInt("redis.port")
def redisTTL: Int = config.getInt("redis.ttl")
Copy link
Contributor

Choose a reason for hiding this comment

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

override def isHealthy: Boolean = state == State.RUNNING && started

override def startImpl(): Unit = {
logger.info("Starting Database service monitor")
Copy link
Contributor

Choose a reason for hiding this comment

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

The lifecycle manager will already have logs for calling the start/stop, e.g.:

https://github.com/Netflix/iep/blob/master/iep-guice/src/main/java/com/netflix/iep/guice/AnnotationUtils.java#L55

class DatabaseService extends AbstractService with StrictLogging {
@volatile private var started = false

def setState(value: Boolean): Unit = started = value
Copy link
Contributor

Choose a reason for hiding this comment

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

Locally to this class, it seems odd to have setState modify the started variable when there is another state variable in scope.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought "state" was the state of the registration, while "started" really means "initial transfer from other instances via redis is complete"

I can rename things to to make it clearer, and add commends, unless I really can / should touch "state" here.

registry.counter(messagesId.withTag("action", msg.getWhat).withTag("streamId", sseId)).increment()
} else {
droppedCount += 1
registry.counter(droppedId.withTag("action", msg.getWhat).withTag("streamId", sseId)).increment()
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be a little more efficient to do: withTags("action", msg.getWhat, "streamId", sseId).

}
}

private def handleReq(ctx: RequestContext, streamId: String, name: Option[String], expr: Option[String], freqString: Option[String]): Unit = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Try to wrap at 100 chars.

path("lwc" / "api" / "v1" / "stream" / Segment) { (streamId) =>
parameters('name.?, 'expression.?, 'frequency.?) { (name, expr, frequency) =>
get { (ctx) => handleReq(ctx, streamId, name, expr, frequency) } ~
post { (ctx) => handleReq(ctx, streamId, name, expr, frequency) }
Copy link
Contributor

Choose a reason for hiding this comment

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

A post that takes query params on the URL seems a bit odd.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I could make it so that the post will not accept params, but the get will, now that the post body is used. This was originally just to make get and post be the same, since apparently some firewalls have issues with SSE over get requests, but not posts.

} else if (-item != next.get._1) {
// requeue with the latest timestamp
prio.dequeue
prio += ((-item, key))
Copy link
Contributor

Choose a reason for hiding this comment

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

(-item -> key)

def touch(key: K, now: Long): Unit = {
val old = touched.put(key, now)
if (old.isEmpty)
prio += ((-now, key))
Copy link
Contributor

Choose a reason for hiding this comment

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

Add comment about why this is negated.

@brharrington brharrington merged commit d9b0739 into Netflix:master Dec 2, 2016
brharrington added a commit to brharrington/spectator that referenced this pull request Dec 15, 2016
Still needs a lot of work, but is a minimal base version
that will send data at the same frequency as publishing
to Atlas.

For more details on the server side see:
Netflix/atlas#459.

Future iteration needed for refactoring to honor frequency
in the subscription, performance tuning, etc.
brharrington added a commit to brharrington/spectator that referenced this pull request Dec 15, 2016
Still needs a lot of work, but is a minimal base version
that will send data at the same frequency as publishing
to Atlas.

For more details on the server side see:
Netflix/atlas#459.

Future iteration needed for refactoring to honor frequency
in the subscription, performance tuning, etc.
brharrington added a commit to Netflix/spectator that referenced this pull request Dec 15, 2016
Still needs a lot of work, but is a minimal base version
that will send data at the same frequency as publishing
to Atlas.

For more details on the server side see:
Netflix/atlas#459.

Future iteration needed for refactoring to honor frequency
in the subscription, performance tuning, etc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants