Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
class CircuitBreakerTab implements MonitorTab {

private static final String[] SORT_COLUMNS = { "route", "id", "component", "state" };
private static final int MAX_CHART_POINTS = 60;
private static final int MAX_CHART_POINTS = 300;

private final MonitorContext ctx;
private final TableState tableState = new TableState();
Expand Down Expand Up @@ -352,7 +352,7 @@ private void renderChart(Frame frame, Rect area, CircuitBreakerInfo cb, String p

LinkedList<Long> successHist = cbSuccessHistory.get(key);
LinkedList<Long> failHist = cbFailHistory.get(key);
int renderPoints = MAX_CHART_POINTS;
int renderPoints = Math.min(MAX_CHART_POINTS, Math.max(2, vSplit.get(1).width() - 6));
long[] successArr = new long[renderPoints];
long[] failArr = new long[renderPoints];
if (successHist != null) {
Expand Down Expand Up @@ -384,7 +384,8 @@ private void renderChart(Frame frame, Rect area, CircuitBreakerInfo cb, String p
.topStyle(Style.EMPTY.fg(Color.GREEN))
.bottomStyle(Style.EMPTY.fg(Color.LIGHT_RED))
.showYAxis(true)
.xLabels("-60s", "-45s", "-30s", "-15s", "now")
.xLabels("-" + renderPoints + "s", "-" + (renderPoints * 3 / 4) + "s",
"-" + (renderPoints / 2) + "s", "-" + (renderPoints / 4) + "s", "now")
.block(Block.builder().borderType(BorderType.ROUNDED).borders(Borders.ALL)
.title(Title.from(chartTitle)).build())
.build(), vSplit.get(1));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
class EndpointsTab implements MonitorTab {

private static final String[] SORT_COLUMNS = { "component", "route", "dir", "total", "body", "hdr", "uri" };
private static final int MAX_CHART_POINTS = 60;
private static final int MAX_CHART_POINTS = 300;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

CircuitBreakerTab also has MAX_CHART_POINTS = 60 and a hardcoded renderPoints = MAX_CHART_POINTS (line 355) — same pattern this PR fixes here. The MetricsCollector buffer is already bumped (CB history uses MAX_ENDPOINT_CHART_POINTS via recordEndpointSample), so only the render side needs the same Math.min(MAX, Math.max(2, width - 6)) treatment. Could be a follow-up.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Claude Code on behalf of Guillaume Nodet

Good catch! Applied the same treatment to CircuitBreakerTab: bumped MAX_CHART_POINTS to 300, computed renderPoints dynamically from vSplit.get(1).width() - 6, and made the x-axis labels dynamic too. See 398034a.

private static final int CHART_ALL = 0;
private static final int CHART_SINGLE = 1;
private static final int CHART_OFF = 2;
Expand Down Expand Up @@ -426,7 +426,7 @@ private void renderEndpointFlow(
LinkedList<Long> inHist = inHistMap.getOrDefault(pid, new LinkedList<>());
LinkedList<Long> outHist = outHistMap.getOrDefault(pid, new LinkedList<>());

int renderPoints = MAX_CHART_POINTS;
int renderPoints = Math.min(MAX_CHART_POINTS, Math.max(2, hSplit.get(1).width() - 6));
long[] inArr = new long[renderPoints];
long[] outArr = new long[renderPoints];
for (int i = 0; i < renderPoints; i++) {
Expand Down Expand Up @@ -529,7 +529,7 @@ private void renderSingleEndpointChart(Frame frame, Rect area, String selectedUr
LinkedList<Long> inHist = perEndpointInHistory.getOrDefault(key, new LinkedList<>());
LinkedList<Long> outHist = perEndpointOutHistory.getOrDefault(key, new LinkedList<>());

int renderPoints = MAX_CHART_POINTS;
int renderPoints = Math.min(MAX_CHART_POINTS, Math.max(2, hSplit.get(1).width() - 6));
long[] inArr = new long[renderPoints];
long[] outArr = new long[renderPoints];
for (int i = 0; i < renderPoints; i++) {
Expand Down Expand Up @@ -576,7 +576,7 @@ private void renderPayloadSizeChart(Frame frame, Rect area, String pid) {
LinkedList<Long> inHist = endpointInSizeHistory.getOrDefault(pid, new LinkedList<>());
LinkedList<Long> outHist = endpointOutSizeHistory.getOrDefault(pid, new LinkedList<>());

int renderPoints = MAX_CHART_POINTS;
int renderPoints = Math.min(MAX_CHART_POINTS, Math.max(2, area.width() - 6));
long[] inArr = new long[renderPoints];
long[] outArr = new long[renderPoints];
for (int i = 0; i < renderPoints; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
*/
class MetricsCollector {

static final int MAX_SPARKLINE_POINTS = 60;
static final int MAX_ENDPOINT_CHART_POINTS = 60;
static final int MAX_SPARKLINE_POINTS = 300;
static final int MAX_ENDPOINT_CHART_POINTS = 300;
static final int MAX_HEAP_HISTORY_POINTS = 120;
static final long HEAP_SAMPLE_INTERVAL_MS = 5000;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ interface OverviewActions {
}

private static final long VANISH_DURATION_MS = 6000;
private static final int MAX_SPARKLINE_POINTS = 60;
private static final int MAX_SPARKLINE_POINTS = 300;
private static final String[] SORT_COLUMNS = { "pid", "name", "version", "status", "total", "fail" };

static final int CHART_ALL = 0;
Expand Down