Skip to content

Commit 634a779

Browse files
author
Eugene Cheung
authored
chore(docs): document how to override segment widgets [skip ci] (#455)
Realized this was never explicitly explained in the public docs. --- _By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license_
1 parent 6339176 commit 634a779

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,31 @@ This is a general procedure on how to do it:
318318

319319
Both of these monitoring base classes are dashboard segments, so you can add them to your monitoring by calling `.addSegment()` on the `MonitoringFacade`.
320320

321+
### Modifying or omitting widgets from default dashboard segments
322+
323+
While the dashboard widgets defined in the library are meant to cover most use cases, they might not be what you're looking for.
324+
325+
To modify the widgets:
326+
327+
1. Extend the appropriate `Monitoring` class (e.g., `LambdaFunctionMonitoring` for `monitorLambdaFunction`) and override the relevant methods (e.g., `widgets`):
328+
```ts
329+
export class MyCustomizedLambdaFunctionMonitoring extends LambdaFunctionMonitoring {
330+
widgets(): IWidget[] {
331+
return [
332+
// Whatever widgets you want instead of what LambdaFunctionMonitoring has
333+
];
334+
}
335+
}
336+
```
337+
1. Use the facade's `addSegment` method with your custom class:
338+
```ts
339+
declare const facade: MonitoringFacade;
340+
341+
facade.addSegment(new MyCustomizedLambdaFunctionMonitoring(facade, {
342+
// Props for LambdaFunctionMonitoring
343+
}));
344+
```
345+
321346
### Custom dashboards
322347

323348
If you want *even* more flexibility, you can take complete control over dashboard generation by leveraging dynamic dashboarding features. This allows you to create an arbitrary number of dashboards while configuring each of them separately. You can do this in three simple steps:

0 commit comments

Comments
 (0)