diff --git a/monitoring-as-code/mixin-defs/testing-mixin.jsonnet b/monitoring-as-code/mixin-defs/testing-mixin.jsonnet index 621813ce..0bbc8a64 100644 --- a/monitoring-as-code/mixin-defs/testing-mixin.jsonnet +++ b/monitoring-as-code/mixin-defs/testing-mixin.jsonnet @@ -12,7 +12,7 @@ local config = { }; local sliSpecList = { - testing: { + journey1: { SLI01: { title: 'test', sliDescription: 'test', diff --git a/monitoring-as-code/src/mixin-builder.libsonnet b/monitoring-as-code/src/mixin-builder.libsonnet index 6af8e0c8..a640fb31 100644 --- a/monitoring-as-code/src/mixin-builder.libsonnet +++ b/monitoring-as-code/src/mixin-builder.libsonnet @@ -94,17 +94,20 @@ local updateSliSpec(sliType, sliSpec) = // @param journeyKey The key of the journey containing the SLI having rules generated // @returns The SLI with standard elements local createSli(sliType, config, passedSliSpec, sliKey, journeyKey) = - local sliSpec = updateSliSpec(sliType, passedSliSpec); - - if std.objectHas(macConfig.metricTypes, sliSpec.metricType) then - if std.objectHas(macConfig.metricTypes[sliSpec.metricType].sliTypesConfig, sliType) then - sliElementFunctions.createRecordingRules(sliSpec, config) + - sliElementFunctions.createSliStandardElements(sliKey, sliSpec) + - dashboardFunctions.createDashboardStandardElements(sliKey, journeyKey, sliSpec, config) + - alertFunctions.createBurnRateRules(sliSpec) + - alertFunctions.createBurnRateAlerts(config, sliSpec, sliKey, journeyKey) - else error 'Metric type %s does not have SLI type %s' % [sliSpec.metricType, sliType] - else error 'Undefined metric type %s' % sliSpec.metricType; + if journeyKey == config.product then + error 'Invalid Journey name [%s]. Journey name cannot match Product name [%s].' % [journeyKey, config.product] + else + local sliSpec = updateSliSpec(sliType, passedSliSpec); + + if std.objectHas(macConfig.metricTypes, sliSpec.metricType) then + if std.objectHas(macConfig.metricTypes[sliSpec.metricType].sliTypesConfig, sliType) then + sliElementFunctions.createRecordingRules(sliSpec, config) + + sliElementFunctions.createSliStandardElements(sliKey, sliSpec) + + dashboardFunctions.createDashboardStandardElements(sliKey, journeyKey, sliSpec, config) + + alertFunctions.createBurnRateRules(sliSpec) + + alertFunctions.createBurnRateAlerts(config, sliSpec, sliKey, journeyKey) + else error 'Metric type %s does not have SLI type %s' % [sliSpec.metricType, sliType] + else error 'Undefined metric type %s' % sliSpec.metricType; // Creates a list of all the SLIs in a service with their standard dashboard elements, unique // dashboard elements, recording rules, alerting rules and alerts