Skip to content

Commit

Permalink
fix: add guidance re usage query count (#6910)
Browse files Browse the repository at this point in the history
  • Loading branch information
wdoconnell authored Jul 22, 2024
1 parent 343d5c9 commit 0f38e66
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/cloud/usage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {Organization} from '../../../src/types'

const statHeaders = [
'Data In (MB)',
'Query Count',
'Query Count (Flux Only) ?',
'Storage (GB-hr)',
'Data Out (GB)',
]
Expand Down
29 changes: 25 additions & 4 deletions src/usage/UsageSingleStat.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
// Libraries
import React, {FC, useContext} from 'react'
import {Panel, ComponentSize, InfluxColors} from '@influxdata/clockface'
import {
Panel,
ComponentSize,
InfluxColors,
QuestionMarkTooltip,
} from '@influxdata/clockface'

// Components
import {View} from 'src/visualization'
import {UsageContext} from 'src/usage/context/usage'

// Constants
const QUERY_COUNT_VECTOR_NAME = 'Query Count'

// Types
import {
SingleStatViewProperties,
Expand Down Expand Up @@ -39,6 +47,10 @@ const UsageSingleStat: FC<Props> = ({
decimalPlaces: {isEnforced: false, digits: 0},
}

// Adjusts table properties to warn user that only flux queries are included in the Query Count.
const isQueryCount: Boolean = usageVector.name === QUERY_COUNT_VECTOR_NAME
const vectorName = isQueryCount ? 'Query Count (Flux Only)' : usageVector.name

const error = fromFluxResult?.table?.columns?.error?.data?.[0]

return (
Expand All @@ -51,9 +63,14 @@ const UsageSingleStat: FC<Props> = ({
size={ComponentSize.ExtraSmall}
testID="usage-single-stat--header"
>
<h5>{`${usageVector.name} ${
usageVector.unit !== '' ? `(${usageVector.unit})` : ''
}`}</h5>
<h5>
{`${vectorName} ${
usageVector.unit !== '' ? `(${usageVector.unit})` : ''
}`}
{isQueryCount && (
<QuestionMarkTooltip tooltipContents={queryCountWarning} />
)}
</h5>
</Panel.Header>
<Panel.Body className="panel-body--size" style={{height: 300 / length}}>
<View
Expand All @@ -68,4 +85,8 @@ const UsageSingleStat: FC<Props> = ({
)
}

const queryCountWarning = (
<p>SQL and InfluxQL query counts are not displayed.</p>
)

export default UsageSingleStat

0 comments on commit 0f38e66

Please sign in to comment.