Skip to content

Commit

Permalink
add dashboard for azure front door (#1375)
Browse files Browse the repository at this point in the history
* add dashboard for azure front door

* fix threhold for percentage

* fix lint
  • Loading branch information
yduartep authored Dec 17, 2024
1 parent c77ee91 commit 4447657
Show file tree
Hide file tree
Showing 9 changed files with 713 additions and 4 deletions.
3 changes: 3 additions & 0 deletions csp-mixin/.lint
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ exclusions:
- dashboard: "GCP Compute Engine"
reason: "Using instance_name as instance label"
- dashboard: "Azure Virtual Machines"
- dashboard: "Azure Front Door"
reason: "Aggregation is at the group level, and resourceName is used for instance label"
target-job-rule:
reason: "Using filtering selector with job"
Expand All @@ -47,6 +48,7 @@ exclusions:
- dashboard: "GCP Compute Engine"
reason: "Using instance_name as instance label"
- dashboard: "Azure Virtual Machines"
- dashboard: "Azure Front Door"
reason: "Aggregation is at the group level, and resourceName is used for instance label"
panel-datasource-rule:
reason: "Many panels use --Mixed-- DS"
Expand All @@ -73,6 +75,7 @@ exclusions:
- dashboard: Azure Service Bus
- dashboard: GCP Compute Engine
- dashboard: Azure Virtual Machines
- dashboard: Azure Front Door
target-rate-interval-rule:
entries:
- dashboard: GCP Compute Engine
Expand Down
3 changes: 2 additions & 1 deletion csp-mixin/azureconfig.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
enableAvailability: true,
bucketLabel: 'resourceName',
},
azurevm+: {
commomVars+: {
groupLabel: 'resourceGroup',
subscriptionLabel: 'subscriptionName',
instanceLabel: 'resourceName',
dimensionEndpoint: 'dimensionEndpoint',
},
// UID Prefix for each dashboard
uid: 'azure',
Expand Down
2 changes: 2 additions & 0 deletions csp-mixin/config.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
gcpce: (import './signals/gcpce.libsonnet')(this),
gcpceOverview: (import './signals/gcpceOverview.libsonnet')(this),
gcpvpc: (import './signals/gcpvpc.libsonnet')(this),
azurefrontdoorOverview: (import './signals/azurefrontdoorOverview.libsonnet')(this),
azurefrontdoor: (import './signals/azurefrontdoor.libsonnet')(this),
},
blobStorage: {
enableAvailability: false,
Expand Down
31 changes: 28 additions & 3 deletions csp-mixin/dashboards.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,11 @@ local commonlib = import 'common-lib/common/main.libsonnet';
+ g.dashboard.withRefresh(csplib.config.dashboardRefresh)
+ g.dashboard.timepicker.withTimeOptions(csplib.config.dashboardPeriod)
+ g.dashboard.withVariables([
if std.asciiLower(v.label) == std.asciiLower(csplib.config.azurevm.groupLabel)
if std.asciiLower(v.label) == std.asciiLower(csplib.config.commomVars.groupLabel)
then v { label: 'Group' }
else if std.asciiLower(v.label) == std.asciiLower(csplib.config.azurevm.subscriptionLabel)
else if std.asciiLower(v.label) == std.asciiLower(csplib.config.commomVars.subscriptionLabel)
then v { label: 'Subscription' }
else if std.asciiLower(v.label) == std.asciiLower(csplib.config.azurevm.instanceLabel)
else if std.asciiLower(v.label) == std.asciiLower(csplib.config.commomVars.instanceLabel)
then v { label: 'Instance' }
else v
for v in variables
Expand All @@ -184,6 +184,31 @@ local commonlib = import 'common-lib/common/main.libsonnet';
)
),

[csplib.config.uid + '-frontdoor.json']:
local variables = csplib.signals.azurefrontdoor.getVariablesMultiChoice();
g.dashboard.new(csplib.config.dashboardNamePrefix + 'Front Door')
+ g.dashboard.withUid(csplib.config.uid + '-frontdoor')
+ 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([
if std.asciiLower(v.label) == std.asciiLower(csplib.config.commomVars.groupLabel)
then v { label: 'Group' }
else if std.asciiLower(v.label) == std.asciiLower(csplib.config.commomVars.subscriptionLabel)
then v { label: 'Subscription' }
else if std.asciiLower(v.label) == std.asciiLower(csplib.config.commomVars.dimensionEndpoint)
then v { label: 'Endpoint' }
else v
for v in variables
])
+ g.dashboard.withPanels(
g.util.grid.wrapPanels(
csplib.grafana.rows.afd_overview
+ csplib.grafana.rows.afd_endpoints,
)
),

[csplib.config.uid + '-queuestorage.json']:
local variables = csplib.signals.azurequeuestore.getVariablesMultiChoice();
g.dashboard.new(csplib.config.dashboardNamePrefix + 'Queue storage')
Expand Down
300 changes: 300 additions & 0 deletions csp-mixin/panels/azurefrontdoor.libsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,300 @@
local g = import '../g.libsonnet';
local commonlib = import 'common-lib/common/main.libsonnet';
{
new(this): {
// Azure Front Door

afd_endpoint_count:
this.signals.azurefrontdoorOverview.endpointCount.asStat()
+ commonlib.panels.generic.stat.base.stylize(),

afd_top5_errors:
this.signals.azurefrontdoorOverview.top5Errors.asTable(format='table')
+ commonlib.panels.generic.table.base.stylize()
+ g.panel.table.standardOptions.withOverrides(
[
{
matcher: {
id: 'byName',
options: 'Value',
},
properties: [
{
id: 'custom.width',
value: 80,
},
{
id: 'color',
},
{
id: 'custom.cellOptions',
value: {
type: 'gauge',
valueDisplayMode: 'color',
},
},
{
id: 'unit',
value: 'percent',
},
{
id: 'thresholds',
value: {
mode: 'percentage',
steps: [
{
color: 'text',
value: 0,
},
{
color: 'red',
value: 1,
},
],
},
},
{
id: 'min',
value: 0,
},
{
id: 'max',
value: 100,
},
],
},
]
)
+ g.panel.table.queryOptions.withTransformations([
{
id: 'organize',
options: {
excludeByName: {
Time: true,
subscriptionName: true,
},
includeByName: {},
indexByName: {
Time: 0,
Value: 7,
dimensionClientCountry: 6,
dimensionClientRegion: 5,
job: 1,
resourceGroup: 2,
resourceName: 3,
subscriptionName: 4,
},
renameByName: {
dimensionClientCountry: 'Country',
dimensionClientRegion: 'Region',
job: 'Job',
resourceGroup: 'Group',
resourceName: 'Resource',
},
},
},
]),

afd_total_requests:
this.signals.azurefrontdoorOverview.totalRequests.asTimeSeries()
+ commonlib.panels.generic.timeSeries.base.stylize()
+ g.panel.timeSeries.options.legend.withShowLegend(false),

afd_requests_by_country:
this.signals.azurefrontdoorOverview.requestsByCountry.asTimeSeries()
+ commonlib.panels.generic.timeSeries.base.stylize(),

afd_requests_by_status:
this.signals.azurefrontdoorOverview.requestsByStatus.asTimeSeries()
+ commonlib.panels.generic.timeSeries.base.stylize(),

afd_requests_by_errors:
commonlib.panels.generic.timeSeries.base.new('Request by Errors percentage', targets=[])
+ this.signals.azurefrontdoorOverview.error4xx.asPanelMixin()
+ this.signals.azurefrontdoorOverview.error5xx.asPanelMixin()
+ commonlib.panels.generic.timeSeries.base.stylize()
+ g.panel.table.standardOptions.withOverrides(
[
{
matcher: {
id: 'byName',
options: '4xx',
},
properties: [
{
id: 'color',
value: {
fixedColor: 'orange',
mode: 'fixed',
},
},
{
id: 'unit',
value: 'percent',
},
],
},
{
matcher: {
id: 'byName',
options: '5xx',
},
properties: [
{
id: 'color',
value: {
fixedColor: 'red',
mode: 'fixed',
},
},
{
id: 'unit',
value: 'percent',
},
],
},
]
),

afd_requests_responses_size:
commonlib.panels.generic.timeSeries.base.new('Request/Responses size', targets=[])
+ commonlib.panels.generic.timeSeries.base.stylize()
+ g.panel.timeSeries.panelOptions.withDescription('The number of bytes sent as requests/responses from clients to AFDX and from HTTP/S proxy to clients.')
+ this.signals.azurefrontdoorOverview.requestsSize.asPanelMixin()
+ this.signals.azurefrontdoorOverview.responsesSize.asPanelMixin()
+ g.panel.timeSeries.standardOptions.withUnit('decbytes')
+ g.panel.timeSeries.fieldConfig.defaults.custom.withAxisLabel('requests(-) | responses(+)')
+ g.panel.table.standardOptions.withOverrides(
[
{
matcher: {
id: 'byName',
options: 'Requests',
},
properties: [
{
id: 'custom.transform',
value: 'negative-Y',
},
{
id: 'unit',
value: 'decbytes',
},
],
},
]
),

afd_total_latency:
this.signals.azurefrontdoorOverview.totalLatency.asTimeSeries()
+ commonlib.panels.generic.timeSeries.base.stylize()
+ g.panel.timeSeries.options.legend.withShowLegend(false),

afd_origin_health:
this.signals.azurefrontdoorOverview.originHealthPercentage.asTimeSeries()
+ commonlib.panels.generic.timeSeries.base.stylize()
+ g.panel.timeSeries.options.legend.withShowLegend(false)
+ g.panel.table.standardOptions.withOverrides(
[
{
matcher: {
id: 'byName',
options: 'Value',
},
properties: [
{
id: 'unit',
value: 'percent',
},
{
id: 'thresholds',
value: {
mode: 'percentage',
steps: [
{
color: 'text',
value: 0,
},
{
value: 1,
color: 'red',
},
{
value: 85,
color: 'yellow',
},
{
color: 'green',
value: 90,
},
],
},
},
{
id: 'color',
value: {
mode: 'thresholds',
},
},
],
},
]
),

afd_origin_latency:
this.signals.azurefrontdoorOverview.originLatency.asTimeSeries()
+ commonlib.panels.generic.timeSeries.base.stylize()
+ g.panel.timeSeries.options.legend.withShowLegend(false),

afd_requests_by_endpoint:
this.signals.azurefrontdoor.requestsByEndpoint.asTimeSeries()
+ commonlib.panels.generic.timeSeries.base.stylize(),

afd_requests_size_by_endpoint:
this.signals.azurefrontdoor.requestsSizeByEndpoints.asTimeSeries()
+ commonlib.panels.generic.timeSeries.base.stylize(),

afd_responses_size_by_endpoint:
this.signals.azurefrontdoor.responsesSizeByEndpoints.asTimeSeries()
+ commonlib.panels.generic.timeSeries.base.stylize(),

afd_total_latency_by_endpoint:
this.signals.azurefrontdoor.totalLatencyByEndpoints.asTimeSeries()
+ commonlib.panels.generic.timeSeries.base.stylize(),

afd_errors_by_endpoint:
this.signals.azurefrontdoor.errorsByEndpoints.asTimeSeries()
+ commonlib.panels.generic.timeSeries.base.stylize()
+ g.panel.table.standardOptions.withOverrides(
[
{
matcher: {
id: 'byName',
options: 'Value',
},
properties: [
{
id: 'color',
value: {
mode: 'fixed',
fixedColor: 'red',
},
},
{
id: 'unit',
value: 'percent',
},
],
},
]
),

afd_origin_requests_by_endpoint:
this.signals.azurefrontdoor.originRequestsByEndpoints.asTimeSeries()
+ commonlib.panels.generic.timeSeries.base.stylize(),

afd_origin_latency_by_endpoint:
this.signals.azurefrontdoor.originLatencyByEndpoints.asTimeSeries()
+ commonlib.panels.generic.timeSeries.base.stylize(),
},
}
Loading

0 comments on commit 4447657

Please sign in to comment.