Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added sampling information in frontend config #291

Merged
merged 1 commit into from
Mar 1, 2023
Merged
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
1 change: 1 addition & 0 deletions config/sample-frontend-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ quickFilters:
dst_kind: 'Service'
alertNamespaces:
- netobserv
sampling: 50
1 change: 1 addition & 0 deletions pkg/handler/frontend-config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type frontendConfig struct {
} `yaml:"portNaming,omitempty" json:"portNaming"`
QuickFilters []QuickFilter `yaml:"quickFilters" json:"quickFilters"`
AlertNamespaces []string `yaml:"alertNamespaces" json:"alertNamespaces"`
Sampling int `yaml:"sampling" json:"sampling"`
}

func readConfigFile(filename string) (*frontendConfig, error) {
Expand Down
2 changes: 2 additions & 0 deletions web/locales/en/plugin__netobserv-plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,8 @@
"Filtered byte rate": "Filtered byte rate",
"Filtered sum of top-k packets / filtered total packets": "Filtered sum of top-k packets / filtered total packets",
"packets": "packets",
"Configuration": "Configuration",
"Sampling": "Sampling",
"Cardinality": "Cardinality",
"(top {{count}} metrics)": "(top {{count}} metrics)",
"(top {{count}} metrics)_plural": "(top {{count}} metrics)",
Expand Down
3 changes: 2 additions & 1 deletion web/src/api/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ export const getConfig = (): Promise<Config> => {
: defaultConfig.portNaming.portNames
},
quickFilters: r.data.quickFilters,
alertNamespaces: r.data.alertNamespaces
alertNamespaces: r.data.alertNamespaces,
sampling: r.data.sampling
};
});
};
Expand Down
7 changes: 6 additions & 1 deletion web/src/components/query-summary/summary-panel.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@
flex-direction: column !important;
}

.summary-config-item {
padding-left: 15px;
flex-direction: column !important;
}

#cardinality-accordion {
display: flex;
flex-direction: column;
gap: 0;
}
}
12 changes: 12 additions & 0 deletions web/src/components/query-summary/summary-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { Stats, TopologyMetrics } from '../../api/loki';
import './summary-panel.css';
import { MetricType } from '../../model/flow-query';
import { MetricsQuerySummaryContent } from './metrics-query-summary';
import { config } from '../../utils/config';

type TypeCardinality = {
type: string;
Expand Down Expand Up @@ -119,6 +120,15 @@ export const SummaryPanelContent: React.FC<{
);
};

const configContent = () => {
return (
<TextContent className="summary-text-container">
<Text component={TextVariants.h3}>{`${t('Configuration')}`}</Text>
<Text className="summary-config-item">{`${t('Sampling')}: ${config.sampling}`}</Text>
</TextContent>
);
};

const cardinalityContent = () => {
//regroup all k8s objects per type + namespace
const namespaces: string[] = [];
Expand Down Expand Up @@ -317,6 +327,8 @@ export const SummaryPanelContent: React.FC<{

{cardinalityContent()}
{/*TODO: NETOBSERV-225 for extra stats on query*/}

{configContent()}
</>
);
};
Expand Down
4 changes: 3 additions & 1 deletion web/src/model/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export type Config = {
};
quickFilters: RawQuickFilter[];
alertNamespaces: string[];
sampling: number;
};

export const defaultConfig: Config = {
Expand All @@ -15,5 +16,6 @@ export const defaultConfig: Config = {
portNames: new Map()
},
quickFilters: [],
alertNamespaces: ['netobserv']
alertNamespaces: ['netobserv'],
sampling: 50
};