Service Profiles

Service profiles provide Linkerd additional information about a service. This is a reference for everything that can be done with service profiles.

Spec

A service profile spec must contain the following top level fields:

fieldvalue
routesa list of route objects
retryBudgeta retry budget object that defines the maximum retry rate to this service

Route

A route object must contain the following fields:

fieldvalue
namethe name of this route as it will appear in the route label
conditiona request match object that defines if a request matches this route
responseClasses(optional) a list of response class objects
isRetryableindicates that requests to this route are always safe to retry and will cause the proxy to retry failed requests on this route whenever possible
timeoutthe maximum amount of time to wait for a response (including retries) to complete after the request is sent

Request Match

A request match object must contain exactly one of the following fields:

fieldvalue
pathRegexa regular expression to match the request path against
methodone of GET, POST, PUT, DELETE, OPTION, HEAD, TRACE
alla list of request match objects which must all match
anya list of request match objects, at least one of which must match
nota request match object which must not match

Request Match Usage Examples

The simplest condition is a path regular expression:

  1. pathRegex: '/authors/\d+'

This is a condition that checks the request method:

  1. method: POST

If more than one condition field is set, all of them must be satisfied. This is equivalent to using the ‘all’ condition:

  1. all:
  2. - pathRegex: '/authors/\d+'
  3. - method: POST

Conditions can be combined using ‘all’, ‘any’, and ‘not’:

  1. any:
  2. - all:
  3. - method: POST
  4. - pathRegex: '/authors/\d+'
  5. - all:
  6. - not:
  7. method: DELETE
  8. - pathRegex: /info.txt

Response Class

A response class object must contain the following fields:

fieldvalue
conditiona response match object that defines if a response matches this response class
isFailurea boolean that defines if these responses should be classified as failed

Response Match

A response match object must contain exactly one of the following fields:

fieldvalue
statusa status range object to match the response status code against
alla list of response match objects which must all match
anya list of response match objects, at least one of which must match
nota response match object which must not match

Response Match conditions can be combined in a similar way as shown above for Request Match Usage Examples

Status Range

A status range object must contain at least one of the following fields. Specifying only one of min or max matches just that one status code.

fieldvalue
minthe status code must be greater than or equal to this value
maxthe status code must be less than or equal to this value

Retry Budget

A retry budget specifies the maximum total number of retries that should be sent to this service as a ratio of the original request volume.

fieldvalue
retryRatiothe maximum ratio of retries requests to original requests
minRetriesPerSecondallowance of retries per second in addition to those allowed by the retryRatio
ttlindicates for how long requests should be considered for the purposes of calculating the retryRatio