Skip to content

Commit

Permalink
fix: when app count is zero because it just started (#3029)
Browse files Browse the repository at this point in the history
## About the changes
This fixes response time metrics with app names when the app just starts
and has zero which is falsy. We want to compare against undefined (which
means the snapshot is not yet ready)
  • Loading branch information
Gastón Fournier committed Feb 1, 2023
1 parent afe01b5 commit 896994d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Expand Up @@ -4,6 +4,8 @@ import { useInstanceMetrics } from 'hooks/api/getters/useInstanceMetrics/useInst
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
import { Alert, styled } from '@mui/material';
import { unknownify } from 'utils/unknownify';
import logoIcon from 'assets/icons/logoBg.svg';
import { formatAssetPath } from 'utils/formatPath';

const StyledMermaid = styled(Mermaid)(({ theme }) => ({
'#mermaid .node rect': {
Expand Down Expand Up @@ -61,7 +63,9 @@ export const NetworkOverview = () => {
graph TD
subgraph _[ ]
direction BT
Unleash(<img src='https://www.getunleash.io/logos/unleash_glyph_pos.svg' width='60' height='60' /><br/>Unleash)
Unleash(<img src='${formatAssetPath(
logoIcon
)}' width='60' height='60' /><br/>Unleash)
${apps
.map(
({ label, reqs, type }, i) =>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/middleware/response-time-metrics.ts
Expand Up @@ -21,7 +21,7 @@ export function responseTimeMetrics(
let appName;
if (
flagResolver.isEnabled('responseTimeWithAppName') &&
(instanceStatsService.getAppCountSnapshot('7d') ||
(instanceStatsService.getAppCountSnapshot('7d') ??
appNameReportingThreshold) < appNameReportingThreshold
) {
appName = req.headers['unleash-appname'] ?? req.query.appName;
Expand Down

0 comments on commit 896994d

Please sign in to comment.