Skip to content

Commit

Permalink
twitter-server: Move ClientProfile to its Own File
Browse files Browse the repository at this point in the history
Problem / Solution

The `ClientRegistryHandler` provides multiple views
into how downstream clients are performing, yet very
little of the logic is reusable. Let's break off the
`ClientProfile` and treat it as an actual model of the
data.

JIRA Issues: CSL-9011

Differential Revision: https://phabricator.twitter.biz/D391923
  • Loading branch information
ryanoneill authored and jenkins committed Oct 30, 2019
1 parent 77aa702 commit 344a5ab
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import com.twitter.finagle.client.{ClientRegistry, EndpointRegistry}
import com.twitter.finagle.http.{Request, Response}
import com.twitter.finagle.util.StackRegistry
import com.twitter.io.Buf
import com.twitter.server.model.ClientProfile
import com.twitter.server.util.HtmlUtils.escapeHtml
import com.twitter.server.util.HttpUtils.{parse, new404, newResponse}
import com.twitter.server.util.MetricSource
Expand All @@ -15,13 +16,6 @@ private object ClientRegistryHandler {

private lazy val emptyEntry = Some(MetricSource.Entry("", 0.0, 0.0))

case class ClientProfile(
name: String,
addr: String,
scope: String,
successRate: Double,
unavailable: Int)

val profileOrdering: Ordering[ClientProfile] = Ordering.by(_.successRate)

def prettyRate(sr: Double): String =
Expand Down
14 changes: 14 additions & 0 deletions server/src/main/scala/com/twitter/server/model/ClientProfile.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.twitter.server.model

/**
* ClientProfile is used to represent data
* displayed in the "Least Performant
* Downstream Clients" section of the Twitter
* Server Admin Interface.
*/
private[server] case class ClientProfile(
name: String,
addr: String,
scope: String,
successRate: Double,
unavailable: Int)

0 comments on commit 344a5ab

Please sign in to comment.