Snapshots are not only useful for comparisons of performance over time. You can use them anytime you want to analyze span data in your CI/CD flow. In this step, you’ll use it to find violations of best practices in committed code.
To do this, you create an entry in the lightstep.yml
configuration file to name and describe the violations you want to catch. If the action finds any violations, they are reported, they appear in the summary for the service.
Each violation configuration includes the following:
services
: The name of the service to checkviolations
: A description of the violation to check forname
: A human-readable name for the violationtype
: Can be either:span.attributes
: Looks for an existing attribute on a spanconnection
: Looks for downstream dependencies between services
- (optional)
op
: If needed, an operand used to evaluate the type’s value value
: The value for the type
Here’s a configured lightstep.yml
file set to see if code in a commit:
- Makes un-allowed requests to downstream services
- Results in
500
error codes - Uses an un-allowed AWS region
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
organization: LightStep
project: demo
services:
web:
violations:
- name: No requests to currency service
type: connection
value: krackend-api-gateway
- name: No 500s Allowed
type: span.attributes
key: http.status_code
op: equals
value: 500
- name: No us-east-2
type: span.attributes
key: cloud.region
op: equals
value: us-east-2
In the next step, you’ll learn how to integrate Rollbar to report on error status and PagerDuty to provide on-call details.
What did we learn?
- You can use the Services Change Report in any part of your CI/CD workflow where you need to analyze span data.
- You can use the
lightstep.yml
file to configure violations of best practices, and if any are found they are added to the Services Change Report.