Skip to content

Commit

Permalink
chart: more heatmap graph examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
manolama committed Apr 28, 2023
1 parent cdb2a93 commit 7d4f98b
Show file tree
Hide file tree
Showing 14 changed files with 40 additions and 4 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import java.time.ZoneId
import java.time.ZoneOffset
import java.time.ZonedDateTime
import java.time.temporal.ChronoUnit

import com.netflix.atlas.chart.model.PlotBound.AutoData
import com.netflix.atlas.chart.model.PlotBound.Explicit
import com.netflix.atlas.chart.model._
Expand Down Expand Up @@ -151,8 +150,14 @@ abstract class PngGraphEngineSuite extends FunSuite {
}

def loadV2(resource: String): GraphDef = {
Using.resource(Streams.gzip(Streams.resource(resource))) { in =>
JsonCodec.decode(in)
if (resource.endsWith(".gz")) {
Using.resource(Streams.gzip(Streams.resource(resource))) { in =>
JsonCodec.decode(in)
}
} else {
Using.resource(Streams.resource(resource)) { in =>
JsonCodec.decode(in)
}
}
}

Expand Down Expand Up @@ -804,6 +809,27 @@ abstract class PngGraphEngineSuite extends FunSuite {
check("heatmap_timer.png", graphDef)
}

test("heatmap_timer_log") {
val graphDef = loadV2(s"$dataDir/heatmap_timer.json.gz").adjustPlots(
_.copy(scale = Scale.LOGARITHMIC)
)
check("heatmap_timer_log.png", graphDef)
}

test("heatmap_timer_power2") {
val graphDef = loadV2(s"$dataDir/heatmap_timer.json.gz").adjustPlots(
_.copy(scale = Scale.POWER_2)
)
check("heatmap_timer_power2.png", graphDef)
}

test("heatmap_timer_sqrt") {
val graphDef = loadV2(s"$dataDir/heatmap_timer.json.gz").adjustPlots(
_.copy(scale = Scale.SQRT)
)
check("heatmap_timer_sqrt.png", graphDef)
}

test("heatmap_timer2") {
val graphDef = loadV2(s"$dataDir/heatmap_timer2.json.gz")
check("heatmap_timer2.png", graphDef)
Expand Down Expand Up @@ -880,10 +906,20 @@ abstract class PngGraphEngineSuite extends FunSuite {
check("heatmap_timer_small.png", graphDef)
}

test("heatmap_single_ptile") {
val graphDef = loadV2(s"$dataDir/heatmap_single_ptile.json.gz")
check("heatmap_single_ptile.png", graphDef)
}

test("heatmap_dist") {
val graphDef = loadV2(s"$dataDir/heatmap_dist.json.gz")
check("heatmap_dist.png", graphDef)
}

test("heatmap_empty") {
val graphDef = loadV2(s"$dataDir/heatmap_empty.json.gz")
check("heatmap_empty.png", graphDef)
}
}

case class GraphData(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ class GrapherSuite extends FunSuite {
imageTest("heatmap params") {
"/api/v1/graph?e=2012-01-01&q=name,sps,:eq,:sum,(,nf.cluster,),:by,:heatmap&heatmap_palette=greens&heatmap_scale=sqrt&heatmap_u=5&heatmap_label=foo"
}

imageTest("named colors: blue with light theme") {
"/api/v1/graph?e=2012-01-01&q=1,blue1,:color,1,blue2,:color,1,blue3,:color&stack=1&theme=light"
}
Expand Down

0 comments on commit 7d4f98b

Please sign in to comment.