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

define new gcp and azure load balancer dashboard in csp-mixin #1322

Merged
merged 17 commits into from
Sep 10, 2024
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
2 changes: 1 addition & 1 deletion csp-mixin/azureconfig.libsonnet
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
_config+:: {
local this = self,
dashboardTags: ['azure'],
dashboardTags: ['azure-cloud-provider'],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will change the tags used by the other azure dashboards that are generated by this lib as well. We'll probably want/need to increment versions appropriately when we integrate it downstream.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, As you can see on next images, GCP and Azure use the same tag name.

Screenshot 2024-09-10 at 09 22 55 Screenshot 2024-09-10 at 09 22 48

dashboardNamePrefix: 'Azure ',
blobStorage+: {
enableAvailability: true,
Expand Down
3 changes: 3 additions & 0 deletions csp-mixin/config.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
blobstore: (import './signals/blobstore.libsonnet')(this),
azureelasticpool: (import './signals/azureelasticpool.libsonnet')(this),
azuresqldb: (import './signals/azuresqldb.libsonnet')(this),
gcploadbalancer: (import './signals/gcploadbalancer.libsonnet')(this),
gcpoadbalancerBackend: (import './signals/gcpoadbalancerBackend.libsonnet')(this),
azureloadbalancer: (import './signals/azureloadbalancer.libsonnet')(this),
},
blobStorage: {
enableAvailability: false,
Expand Down
92 changes: 68 additions & 24 deletions csp-mixin/dashboards.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -27,38 +27,82 @@ local commonlib = import 'common-lib/common/main.libsonnet';
),
}
+
if csplib.config.uid == 'azure' then
if csplib.config.uid == 'gcp' then
{
[csplib.config.uid + '-elasticpool.json']:
local variables = csplib.signals.azureelasticpool.getVariablesMultiChoice();
g.dashboard.new(csplib.config.dashboardNamePrefix + 'Elastic pool')
+ g.dashboard.withUid(csplib.config.uid + '-elasticpool')
[csplib.config.uid + '-loadbalancer.json']:
local variables = csplib.signals.gcploadbalancer.getVariablesMultiChoice();
g.dashboard.new(csplib.config.dashboardNamePrefix + 'Load Balancing')
+ g.dashboard.withUid(csplib.config.uid + '-loadbalancer')
+ g.dashboard.withTags(csplib.config.dashboardTags)
+ g.dashboard.withTimezone(csplib.config.dashboardTimezone)
+ g.dashboard.withRefresh(csplib.config.dashboardRefresh)
+ g.dashboard.timepicker.withTimeOptions(csplib.config.dashboardPeriod)
+ g.dashboard.withVariables(variables)
+ g.dashboard.withVariables([
if std.asciiLower(v.label) == std.asciiLower(csplib.config.gcploadBalancer.backendLabel)
then v { label: 'Backend Target' }
else if std.asciiLower(v.label) == std.asciiLower(csplib.config.gcploadBalancer.countryLabel)
then v { label: 'Country' }
else v
for v in variables
])
+ g.dashboard.withPanels(
g.util.grid.wrapPanels(
csplib.grafana.rows.aep_storage +
csplib.grafana.rows.aep_resources
csplib.grafana.rows.glb_requests
+ csplib.grafana.rows.glb_latency
+ csplib.grafana.rows.glb_traffic_metrics
)
),
} else {}
+
if csplib.config.uid == 'azure' then
{
[csplib.config.uid + '-elasticpool.json']:
local variables = csplib.signals.azureelasticpool.getVariablesMultiChoice();
g.dashboard.new(csplib.config.dashboardNamePrefix + 'Elastic pool')
+ g.dashboard.withUid(csplib.config.uid + '-elasticpool')
+ g.dashboard.withTags(csplib.config.dashboardTags)
+ g.dashboard.withTimezone(csplib.config.dashboardTimezone)
+ g.dashboard.withRefresh(csplib.config.dashboardRefresh)
+ g.dashboard.timepicker.withTimeOptions(csplib.config.dashboardPeriod)
+ g.dashboard.withVariables(variables)
+ g.dashboard.withPanels(
g.util.grid.wrapPanels(
csplib.grafana.rows.aep_storage +
csplib.grafana.rows.aep_resources
)
),

[csplib.config.uid + '-sqldb.json']:
local variables = csplib.signals.azuresqldb.getVariablesMultiChoice();
g.dashboard.new(csplib.config.dashboardNamePrefix + 'SQL database')
+ g.dashboard.withUid(csplib.config.uid + '-sqldb')
+ g.dashboard.withTags(csplib.config.dashboardTags)
+ g.dashboard.withTimezone(csplib.config.dashboardTimezone)
+ g.dashboard.withRefresh(csplib.config.dashboardRefresh)
+ g.dashboard.timepicker.withTimeOptions(csplib.config.dashboardPeriod)
+ g.dashboard.withVariables(variables)
+ g.dashboard.withPanels(
g.util.grid.wrapPanels(
csplib.grafana.rows.asql_connections +
csplib.grafana.rows.asql_resources
)
),
} else {},
[csplib.config.uid + '-sqldb.json']:
local variables = csplib.signals.azuresqldb.getVariablesMultiChoice();
g.dashboard.new(csplib.config.dashboardNamePrefix + 'SQL database')
+ g.dashboard.withUid(csplib.config.uid + '-sqldb')
+ g.dashboard.withTags(csplib.config.dashboardTags)
+ g.dashboard.withTimezone(csplib.config.dashboardTimezone)
+ g.dashboard.withRefresh(csplib.config.dashboardRefresh)
+ g.dashboard.timepicker.withTimeOptions(csplib.config.dashboardPeriod)
+ g.dashboard.withVariables(variables)
+ g.dashboard.withPanels(
g.util.grid.wrapPanels(
csplib.grafana.rows.asql_connections +
csplib.grafana.rows.asql_resources
)
),

[csplib.config.uid + '-loadbalancer.json']:
local variables = csplib.signals.azureloadbalancer.getVariablesMultiChoice();
g.dashboard.new(csplib.config.dashboardNamePrefix + 'Load Balancing')
+ g.dashboard.withUid(csplib.config.uid + '-loadbalancer')
+ g.dashboard.withTags(csplib.config.dashboardTags)
+ g.dashboard.withTimezone(csplib.config.dashboardTimezone)
+ g.dashboard.withRefresh(csplib.config.dashboardRefresh)
+ g.dashboard.timepicker.withTimeOptions(csplib.config.dashboardPeriod)
+ g.dashboard.withVariables(variables)
+ g.dashboard.withPanels(
g.util.grid.wrapPanels(
csplib.grafana.rows.alb_summary +
csplib.grafana.rows.alb_details +
csplib.grafana.rows.alb_loadbalancers
)
),
} else {},
}
7 changes: 6 additions & 1 deletion csp-mixin/gcpconfig.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@
_config+:: {
local this = self,
dashboardPeriod: 'now-1h',
dashboardTags: ['gcp'],
dashboardTags: ['gcp-cloud-provider'],
dashboardNamePrefix: 'GCP ',
blobStorage+: {
bucketLabel: 'bucket_name',
},
gcploadBalancer+: {
backendLabel: 'backend_target_name',
countryLabel: 'client_country',
},

// UID Prefix for each dashboard
uid: 'gcp',
filteringSelector: 'job="integrations/gcp"',
Expand Down
5 changes: 2 additions & 3 deletions csp-mixin/main.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ local commonlib = import 'common-lib/common/main.libsonnet';
config: config,
signals:
{
blobstore: commonlib.signals.unmarshallJsonMulti(this.config.signals.blobstore, type=this.config.metricsSource),
azureelasticpool: commonlib.signals.unmarshallJsonMulti(this.config.signals.azureelasticpool, type=this.config.metricsSource),
azuresqldb: commonlib.signals.unmarshallJsonMulti(this.config.signals.azuresqldb, type=this.config.metricsSource),
[sig]: commonlib.signals.unmarshallJsonMulti(this.config.signals[sig], type=this.config.metricsSource)
for sig in std.objectFields(this.config.signals)
Comment on lines +9 to +10
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice optimization!

},
grafana: {
panels: (import './panels.libsonnet').new(this),
Expand Down
Loading
Loading