Service-level objective examples

  • Latest Dynatrace
  • Reference
  • 5-min read

SLOs Service-Level Objectives offers a set of service-level objectives (SLO) examples that you can use to create your service-level objectives using DQL. We also offer a set of pre-configured SLO templates. For more information, see Service-level objective templates.

Service availability for critical services (tagged Gold)

This SLI measures the proportion of successful service requests over time, considering only gold-tier tagged services.

This example demonstrates the Split by services dimension and its criticality. While the service dimension is auto-enriched on this metric. You need to enrich the criticality manually.

Details of the example

  • Data source: metrics (timeseries), tag

  • Entity scope: services

  • SLI DQL query:

    timeseries {
    total = sum(dt.service.request.count),
    failures = sum(dt.service.request.failure_count)
    },
    by: { dt.smartscape.service, criticality }
    | filter criticality == "Gold"
    | fieldsAdd entityName = getNodeName(dt.smartscape.service)
    | fieldsAdd sli = (((total[] - failures[]) / total[]) * 100)
    | fieldsRemove total, failures

Service performance for services with tags

This SLI measures, over time, the proportion of successful service requests for services with a particular tag. This example demonstrates the Split by services dimension and a product identifier. While the service dimension is auto-enriched for this metric, you need to enrich the product identifier manually.

Details of the example

  • Data source: metrics (timeseries)

  • Entity scope: services

  • SLI DQL query:

    timeseries total = avg(dt.service.request.response_time),
    default: 0,
    by: { dt.smartscape.service, deployment.release_product }
    | filter deployment.release_product == "easytravel"
    | fieldsAdd high = iCollectArray(if(total[] > (1000 * 500), total[]))
    | fieldsAdd low = iCollectArray(if(total[] <= (1000 * 500), total[]))
    | fieldsAdd highRespTimes = iCollectArray(if(isNull(high[]), 0, else: 1))
    | fieldsAdd lowRespTimes = iCollectArray(if(isNull(low[]), 0, else: 1))
    | fieldsAdd entityName = getNodeName(dt.smartscape.service)
    | fieldsAdd sli = 100 * (lowRespTimes[] / (lowRespTimes[] + highRespTimes[]))
    | fieldsRemove total, high, low, highRespTimes, lowRespTimes

Service error rate by Kubernetes cluster

This SLI measures the error rate of services running in a specific Kubernetes cluster, providing insight into service reliability per cluster.

This example demonstrates cluster-based filtering using the k8s.cluster.name Primary Grail field. By using the k8s.cluster.name field, you can efficiently monitor multiple clusters and align with cloud native observability best practices.

Details of the example

  • Data source: metrics (timeseries)

  • Entity scope: services, Kubernetes cluster

  • SLI DQL query:

    timeseries {
    total = sum(dt.service.request.count),
    errors = sum(dt.service.request.failure_count)
    },
    by: { dt.smartscape.service, k8s.cluster.name }
    | filter k8s.cluster.name == "production-cluster"
    | fieldsAdd errorRate = (errors[] / total[]) * 100
    | fieldsAdd sli = 100 - errorRate[]
    | fieldsAdd serviceName = getNodeName(dt.smartscape.service)
    | fieldsRemove total, errors, errorRate

SLO for synthetic browser availability considering business hours

This SLI measures the proportion of successful browser monitor tests over time, excluding non-business hours (Monday–Friday, 9 AM–5 PM UTC+2).

Dynatrace Classic entity references

This example currently uses Dynatrace Classic entity references. The migration to Smartscape 2.0 (Latest Dynatrace) is pending the availability of the underlying time series data.

Details of the example

  • Data source: metrics (timeseries)

  • Entity scope: Synthetic browser test, Synthetic location

  • SLI DQL query:

    timeseries {
    sli = avg(dt.synthetic.browser.availability),
    timestamp = start()
    },
    by: { dt.entity.synthetic_test, dt.entity.synthetic_location },
    interval: 1min
    | fieldsAdd entityName = entityName(dt.entity.synthetic_test)
    | fieldsAdd locationName = entityName(dt.entity.synthetic_location)
    | filter in(entityName, "Dynatrace website")
    | fieldsAdd sli = if(getDayOfWeek(timestamp[]) < 6, sli[])
    | fieldsAdd sli = if(getHour(timestamp[], timezone: "Europe/Bucharest") >= 9, sli[])
    | fieldsAdd sli = if(getHour(timestamp[], timezone: "Europe/Bucharest") <= 17, sli[])

Log-pattern based SLO

This SLI measures the proportion of log lines with loglevel INFO and WARNING relative to all log lines.

Details of the example

  • Data source: logs

  • Entity scope: app ID

  • SLI DQL query:

    fetch logs, scanLimitGBytes: -1
    | fieldsAdd failed = coalesce(if(loglevel == "INFO" OR loglevel =="WARNING", 1), 0)
    | makeTimeseries {failed = avg(failed), total = count()}, by: {dt.app.id}
    | fieldsAdd sli = 100 - ((toDouble(failed[]) / toDouble(total[])) * 100)

Performance by service

This SLI measures the duration of service requests based on spans.

Details of the example

  • Data source: spans/traces

  • Entity scope: services

  • SLI DQL query:

    fetch spans
    | filter dt.smartscape.service == "SERVICE-53B3E0D705DB0194"
    | makeTimeseries {
    total = count(),
    good = countIf(duration <= 150ms)
    },
    by: { name = getNodeName(dt.smartscape.service) }
    | fieldsAdd sli = 100 * (good[] / total[])
    | fieldsRemove total, good

Performance by service endpoint

This SLI measures the selected endpoint's latency (performance) as the proportion of service requests that are served within a defined response time in milliseconds, based on spans.

Details of the example

  • Data source: spans/traces

  • Entity scope: services, endpoint

  • SLI DQL query:

    fetch spans
    | filter endpoint.name == "/Booking"
    | makeTimeseries {total = count(), good = countIf(duration < 150ms)}, by:{endpoint.name}
    | fieldsAdd sli = 100 * (good[]/total[])
    | fieldsRemove total, good
Related tags
Application ObservabilityService-Level ObjectivesService-Level Objectives