|
1 | 1 | import { FIXED_TIME_BUCKET_EXPR_ALIAS } from '@hyperdx/common-utils/dist/core/renderChartConfig'; |
2 | | -import { getSourceImplicitColumnExpression } from '@hyperdx/common-utils/dist/core/searchChartConfig'; |
| 2 | +import { |
| 3 | + getSourceImplicitColumnExpression, |
| 4 | + netflowProtocolNameExpression, |
| 5 | +} from '@hyperdx/common-utils/dist/core/searchChartConfig'; |
3 | 6 | import { |
4 | 7 | convertDateRangeToGranularityString, |
5 | 8 | convertGranularityToSeconds, |
@@ -31,14 +34,6 @@ export const NETFLOW_ALIASES = { |
31 | 34 | bytes: netflowColumnAlias('bytes'), |
32 | 35 | value: netflowColumnAlias('value'), |
33 | 36 | }; |
34 | | -const PROTOCOL_NAMES = { |
35 | | - 1: 'ICMP', |
36 | | - 6: 'TCP', |
37 | | - 17: 'UDP', |
38 | | - 47: 'GRE', |
39 | | - 50: 'ESP', |
40 | | - 58: 'ICMPv6', |
41 | | -}; |
42 | 37 | export const NETFLOW_SUMMARY_TILES = [ |
43 | 38 | { |
44 | 39 | title: 'Average bit rate', |
@@ -83,13 +78,7 @@ export function getNetflowDimensions(source: TNetflowSource) { |
83 | 78 | return { |
84 | 79 | srcAddr: address(source.srcAddrExpression), |
85 | 80 | dstAddr: address(source.dstAddrExpression), |
86 | | - protocol: `transform(toString(${source.protocolExpression}), [${Object.keys( |
87 | | - PROTOCOL_NAMES, |
88 | | - ) |
89 | | - .map(value => `'${value}'`) |
90 | | - .join(', ')}], [${Object.values(PROTOCOL_NAMES) |
91 | | - .map(value => `'${value}'`) |
92 | | - .join(', ')}], toString(${source.protocolExpression}))`, |
| 81 | + protocol: netflowProtocolNameExpression(source.protocolExpression), |
93 | 82 | exporter: source.exporterExpression?.trim(), |
94 | 83 | inputInterface: source.inIfExpression?.trim(), |
95 | 84 | outputInterface: source.outIfExpression?.trim(), |
|
0 commit comments