-
Notifications
You must be signed in to change notification settings - Fork 1
Lily #27
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
base: main
Are you sure you want to change the base?
Lily #27
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| import { | ||
| EmbeddedScene, | ||
| SceneFlexLayout, | ||
| SceneFlexItem, | ||
| SceneVariableSet, | ||
| } from '@grafana/scenes'; | ||
| import { PanelBuilders } from '@grafana/scenes'; | ||
| import { ShowfastQueryBuilder, createShowfastQueries } from '../../../utils/utils.showfast'; | ||
|
|
||
| /** | ||
| * Creates a dynamic KV throughput dashboard using the ShowfastQueryBuilder | ||
| * This dashboard shows performance metrics from external APIs via Showfast | ||
| */ | ||
| export function kvThroughputDashboard(): EmbeddedScene { | ||
| // Create template variables for dynamic metric selection | ||
| const variables = ShowfastQueryBuilder.buildVariableSet(['kv']); | ||
|
|
||
| return new EmbeddedScene({ | ||
| $variables: variables, | ||
| body: new SceneFlexLayout({ | ||
| minHeight: 50, | ||
| direction: 'row', | ||
| wrap: 'wrap', | ||
| children: [ | ||
| // KV Max Ops Performance Panel | ||
| new SceneFlexItem({ | ||
| height: 400, | ||
| width: '50%', | ||
| minWidth: '45%', | ||
| body: PanelBuilders.barchart() | ||
| .setTitle('KV Max Ops Performance') | ||
| .build(), | ||
| $data: new ShowfastQueryBuilder('kv', 'max_ops') | ||
| .setVisualizationType('barchart') | ||
| .useTimelineData(true) | ||
| .buildQueryRunner() | ||
| }), | ||
|
|
||
| // KV Max Ops SSL Performance Panel | ||
| new SceneFlexItem({ | ||
| height: 400, | ||
| width: '50%', | ||
| minWidth: '45%', | ||
| body: PanelBuilders.timeseries() | ||
| .setTitle('KV Max Ops SSL') | ||
| .setUnit('ops') | ||
| .build(), | ||
| $data: new ShowfastQueryBuilder('kv', 'max_ops_ssl') | ||
| .setVisualizationType('timeseries') | ||
| .useTimelineData(true) | ||
| .buildQueryRunner() | ||
| }), | ||
|
|
||
| // KV 95th Percentile Latency Panel | ||
| new SceneFlexItem({ | ||
| height: 400, | ||
| width: '50%', | ||
| minWidth: '45%', | ||
| body: PanelBuilders.timeseries() | ||
| .setTitle('KV 95th Percentile Latency') | ||
| .setUnit('ms') | ||
| .build(), | ||
| $data: new ShowfastQueryBuilder('kv', 'latency_95th') | ||
| .setVisualizationType('timeseries') | ||
| .useTimelineData(true) | ||
| .buildQueryRunner() | ||
| }), | ||
|
|
||
| // KV Metrics Table Panel | ||
| new SceneFlexItem({ | ||
| height: 400, | ||
| width: '50%', | ||
| minWidth: '45%', | ||
| body: PanelBuilders.table() | ||
| .setTitle('Available KV Metrics') | ||
| .build(), | ||
| $data: new ShowfastQueryBuilder('kv', 'max_ops') | ||
| .setVisualizationType('table') | ||
| .useTimelineData(false) // Use metrics endpoint for table | ||
| .buildQueryRunner() | ||
| }) | ||
| ] | ||
| }) | ||
| }); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,8 +11,12 @@ class MetricsService { | |
| try { | ||
| // Build query parameters | ||
| const params = new URLSearchParams(); | ||
| if (category) params.append('category', category); | ||
| if (subCategory) params.append('subCategory', subCategory); | ||
| if (category) { | ||
| params.append('category', category); | ||
| } | ||
| if (subCategory) { | ||
| params.append('subCategory', subCategory); | ||
| } | ||
|
|
||
| const queryString = params.toString(); | ||
| const url = `${API_BASE_URL}/metrics/${componentId}${queryString ? `?${queryString}` : ''}`; | ||
|
|
@@ -63,7 +67,7 @@ class MetricsService { | |
| /** | ||
| * Fetch specific metric with historical data | ||
| */ | ||
| async getMetricHistory(componentId: string, metricId: string, limit: number = 50): Promise<Metric> { | ||
| async getMetricHistory(componentId: string, metricId: string, limit = 50): Promise<Metric> { | ||
| try { | ||
| console.log(`Fetching metric history for ${componentId}/${metricId}`); | ||
|
|
||
|
|
@@ -113,10 +117,14 @@ class MetricsService { | |
| buildNumber: `${version}-${Math.floor(Math.random() * 9999)}` | ||
| })); | ||
|
|
||
| // const description = metricName === 'draft-1' | ||
| // ? 'Key-Value throughput performance metric showing operations per second across versions' | ||
| // : `${this.formatMetricName(metricName)} performance metric`; | ||
|
|
||
| return { | ||
| id: metricName, | ||
| name: this.formatMetricName(metricName), | ||
| description: `${this.formatMetricName(metricName)} performance metric`, | ||
| description: '', | ||
|
||
| unit: this.getMetricUnit(metricName), | ||
| category: this.getMetricCategory(metricName), | ||
| values: values.sort((a, b) => a.version.localeCompare(b.version)) | ||
|
|
@@ -159,7 +167,7 @@ class MetricsService { | |
| return nameMap[componentId] || componentId; | ||
| } | ||
|
|
||
| private getMetricUnit(metricId: string): string { | ||
| private getMetricUnit(metricId: string): string { | ||
| if (metricId.includes('latency') || metricId.includes('time') || metricId.includes('duration')) { | ||
| return 'ms'; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -23,7 +23,6 @@ export function getNewTimeSeriesDataTransformer(queryRunner: SceneQueryRunner) { | |||||
| /** | ||||||
| * Create a new metric panel using the CBQueryBuilder and TimeSeriesDataTransformer | ||||||
| */ | ||||||
| // TO DO: add a way to assign a unit to each panel | ||||||
| export function createMetricPanel( | ||||||
| snapshotId: string, | ||||||
| metricName: string, | ||||||
|
|
@@ -70,3 +69,7 @@ export function createMetricPanel( | |||||
| $data: getNewTimeSeriesDataTransformer(builder.buildQueryRunner()), | ||||||
| }); | ||||||
| } | ||||||
|
|
||||||
| export function createShowfastTab(){ | ||||||
|
|
||||||
|
||||||
| // TODO: Implement the Showfast tab creation logic. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CSS class 'sceneContainer' is defined but not used anywhere in the component. Remove this unused style definition or apply it to the appropriate element.