Skip to content
This repository was archived by the owner on Oct 25, 2023. It is now read-only.

Add support for external API Gateway in the dashboards #215 #216

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
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
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,14 @@ dashboards:
- default
```

Using external API Gateway:
```yaml
alarms:
dashboards: true
dashboardConfig:
apiName: 'my-api-name-here'
```

## License

MIT © [A Cloud Guru](https://acloud.guru/)
Expand Down
10 changes: 9 additions & 1 deletion src/dashboards/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@ const dashboards = {
vertical: require('./configs/vertical.json'),
};

const createDashboard = (service, stage, region, functions, name) => {
const createDashboard = (
service,
stage,
region,
functions,
name,
dashboardConfig
) => {
const dashboard = dashboards[name];

if (!dashboard) {
Expand All @@ -21,6 +28,7 @@ const createDashboard = (service, stage, region, functions, name) => {
coordinates: w.coordinates,
title: w.title,
functions,
dashboardConfig,
};

return widget.createWidget(config);
Expand Down
4 changes: 3 additions & 1 deletion src/dashboards/widgets/api-gw/latency/numbers.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const createWidget = (config) => {
const apiName = `${config.stage}-${config.service}`;
const apiName = config.dashboardConfig.apiName
? config.dashboardConfig.apiName
: `${config.stage}-${config.service}`;

const widget = {
type: 'metric',
Expand Down
4 changes: 3 additions & 1 deletion src/dashboards/widgets/api-gw/latency/time-series.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const createWidget = (config) => {
const apiName = `${config.stage}-${config.service}`;
const apiName = config.dashboardConfig.apiName
? config.dashboardConfig.apiName
: `${config.stage}-${config.service}`;

const widget = {
type: 'metric',
Expand Down
4 changes: 3 additions & 1 deletion src/dashboards/widgets/api-gw/requests/numbers.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const createWidget = (config) => {
const apiName = `${config.stage}-${config.service}`;
const apiName = config.dashboardConfig.apiName
? config.dashboardConfig.apiName
: `${config.stage}-${config.service}`;

const widget = {
type: 'metric',
Expand Down
4 changes: 3 additions & 1 deletion src/dashboards/widgets/api-gw/requests/time-series.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const createWidget = (config) => {
const apiName = `${config.stage}-${config.service}`;
const apiName = config.dashboardConfig.apiName
? config.dashboardConfig.apiName
: `${config.stage}-${config.service}`;

const widget = {
type: 'metric',
Expand Down
4 changes: 3 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,7 @@ class AlertsPlugin {
const provider = service.provider;
const stage = this.options.stage;
const region = this.options.region || provider.region;
const config = this.getConfig();
const dashboardTemplates = this.getDashboardTemplates(
configDashboards,
stage
Expand All @@ -497,7 +498,8 @@ class AlertsPlugin {
stage,
region,
functions,
d
d,
config.dashboardConfig ? config.dashboardConfig : {}
);

const cfResource =
Expand Down