Skip to content

Commit f3a1898

Browse files
committed
add DNS name
1 parent b208728 commit f3a1898

File tree

13 files changed

+86
-8
lines changed

13 files changed

+86
-8
lines changed

config/sample-config.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,15 @@ frontend:
709709
default: false
710710
width: 5
711711
feature: dnsTracking
712+
- id: DNSName
713+
group: DNS
714+
name: DNS Name
715+
tooltip: DNS name.
716+
field: DnsName
717+
filter: dns_name
718+
default: false
719+
width: 15
720+
feature: dnsTracking
712721
- id: DNSLatency
713722
group: DNS
714723
name: DNS Latency
@@ -1168,6 +1177,10 @@ frontend:
11681177
name: DNS Id
11691178
component: number
11701179
hint: Specify a single DNS Id.
1180+
- id: dns_name
1181+
name: DNS Name
1182+
component: text
1183+
hint: Specify a single DNS name.
11711184
- id: dns_latency
11721185
name: DNS Latency
11731186
component: number
@@ -1522,6 +1535,10 @@ frontend:
15221535
- name: DnsId
15231536
type: number
15241537
description: DNS record id
1538+
- id: dns_name
1539+
name: DNS Name
1540+
component: text
1541+
hint: Specify a single DNS name.
15251542
- name: DnsLatencyMs
15261543
type: number
15271544
description: Time between a DNS request and response, in milliseconds

pkg/loki/flow_query.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,14 @@ func (q *FlowQueryBuilder) appendFilter(sb *strings.Builder, field string) {
207207

208208
func (q *FlowQueryBuilder) appendDNSFilter(sb *strings.Builder) {
209209
// ensure at least one Dns field is specified except DnsErrno
210-
// |~`"DnsId`|~`"DnsLatencyMs`|~`"DnsFlagsResponseCode"`
210+
// |~`"DnsId`|~`"DnsName`|~`"DnsLatencyMs`|~`"DnsFlagsResponseCode"`
211211
sb.WriteString("|~`")
212212
sb.WriteString(`"DnsId`)
213213
sb.WriteString("`")
214214
sb.WriteString("|~`")
215+
sb.WriteString(`"DnsName`)
216+
sb.WriteString("`")
217+
sb.WriteString("|~`")
215218
sb.WriteString(`"DnsLatencyMs`)
216219
sb.WriteString("`")
217220
sb.WriteString("|~`")

pkg/model/fields/fields.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ const (
5050
IfDirections = "IfDirections"
5151
NetworkEvents = "NetworkEvents"
5252
DNSID = "DnsId"
53+
DNSName = "DnsName"
5354
DNSLatency = "DnsLatencyMs"
5455
DNSErrNo = "DnsErrno"
5556
DNSCode = "DnsFlagsResponseCode"

web/locales/en/plugin__netobserv-plugin.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,10 +572,14 @@
572572
"Overall": "Overall",
573573
"donut or lines": "donut or lines",
574574
"The {{function}} {{metric}} with overall over the selected interval": "The {{function}} {{metric}} with overall over the selected interval",
575+
"Top {{limit}} DNS name with total": "Top {{limit}} DNS name with total",
576+
"Top {{limit}} DNS name": "Top {{limit}} DNS name",
577+
"Total DNS name": "Total DNS name",
578+
"Total DNS flow count": "Total DNS flow count",
579+
"The top DNS name extracted from DNS headers compared to total over the selected interval": "The top DNS name extracted from DNS headers compared to total over the selected interval",
575580
"Top {{limit}} DNS response code with total": "Top {{limit}} DNS response code with total",
576581
"Top {{limit}} DNS response code": "Top {{limit}} DNS response code",
577582
"Total DNS response code": "Total DNS response code",
578-
"Total DNS flow count": "Total DNS flow count",
579583
"The top DNS response code extracted from DNS response headers compared to total over the selected interval": "The top DNS response code extracted from DNS response headers compared to total over the selected interval",
580584
"rates": "rates",
581585
"with total": "with total",

web/src/api/ipfix.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ export interface Flow {
8181
PktDropBytes_AB?: number;
8282
PktDropBytes_BA?: number;
8383
DnsId?: number;
84+
DnsName?: string;
8485
DnsFlags?: number;
8586
DnsFlagsResponseCode?: string;
8687
DnsLatencyMs?: number;

web/src/api/loki.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ export type NetflowMetrics = {
137137
totalDroppedRateMetric?: TotalRateMetrics;
138138
droppedStateMetrics?: GenericMetric[];
139139
droppedCauseMetrics?: GenericMetric[];
140+
dnsNameMetrics?: GenericMetric[];
140141
dnsRCodeMetrics?: GenericMetric[];
141142
dnsLatencyMetrics?: FunctionMetrics;
142143
rttMetrics?: FunctionMetrics;

web/src/components/__tests-data__/columns.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,17 @@ export const ColumnConfigSampleDefs = [
500500
default: false,
501501
width: 5
502502
},
503+
{
504+
id: 'DNSName',
505+
group: 'DNS',
506+
name: 'DNS Name',
507+
tooltip: 'DNS name.',
508+
field: 'DnsName',
509+
filter: 'dns_name',
510+
feature: 'dnsTracking',
511+
default: false,
512+
width: 15
513+
},
503514
{
504515
id: 'DNSLatency',
505516
group: 'DNS',
@@ -769,6 +780,11 @@ export const FieldConfigSample = [
769780
type: 'number',
770781
description: 'DNS record id'
771782
},
783+
{
784+
name: 'DnsName',
785+
type: 'text',
786+
description: 'DNS name'
787+
},
772788
{
773789
name: 'DnsLatencyMs',
774790
type: 'number',

web/src/components/__tests-data__/filters.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,12 @@ export const FilterConfigSampleDefs = [
251251
component: 'number',
252252
hint: 'Specify a single DNS Id.'
253253
},
254+
{
255+
id: 'dns_name',
256+
name: 'DNS Name',
257+
component: 'text',
258+
hint: 'Specify a single DNS Name.'
259+
},
254260
{
255261
id: 'dns_latency',
256262
name: 'DNS Latency',

web/src/components/__tests__/netflow-traffic.spec.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ describe('<NetflowTraffic />', () => {
108108
// 2 queries for packet dropped states & causes
109109
{ ...defaultQuery, function: 'rate', type: 'PktDropPackets', aggregateBy: 'PktDropLatestState' },
110110
{ ...defaultQuery, function: 'rate', type: 'PktDropPackets', aggregateBy: 'PktDropLatestDropCause' },
111-
// 2 queries for dns response codes count
111+
// 3 queries for dns names, response codes and total
112+
{ ...defaultQuery, function: 'count', type: 'DnsFlows', aggregateBy: 'DnsName' },
112113
{ ...defaultQuery, function: 'count', type: 'DnsFlows', aggregateBy: 'DnsFlagsResponseCode' },
113114
{ ...defaultQuery, function: 'count', type: 'DnsFlows', aggregateBy: 'app' }
114115
];

web/src/components/tabs/netflow-overview/__tests__/netflow-overview.spec.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ describe('<NetflowOverview />', () => {
4141
await waitForRender(wrapper);
4242

4343
const containerDiv = wrapper.find(EmptyState);
44-
// 12 panels are expected here according to getDefaultOverviewPanels isSelected items
45-
expect(containerDiv.length).toEqual(12);
44+
// 13 panels are expected here according to getDefaultOverviewPanels isSelected items
45+
expect(containerDiv.length).toEqual(13);
4646
});
4747

4848
it('should render panels', async () => {

0 commit comments

Comments
 (0)