In order to track deployments, you need to create an instrumentation attribute that Lightstep can use to understand when versions of your service changes. Any time the value of that attribute changes, Lightstep adds a deployment marker to the charts on the deployment page. Here’s an example showing a deployment marker.

If you don’t already have one, you need to add an attribute to your instrumentation to hold the version value.

Add a Version Attribute

In the instrumentation for your service, add a attribute named service.version. This will be used to collect version information for the service. Adding attributes to instrumentation is language-specific, so check out the Quick Start topics for how to do that in your service’s language.

Using GitLab or GitHub?

If you’re using GitLab or GitHub for your project, you can use a Git SHA provided by the CI system as the service.version attribute so you can easily connect your traces with specific commits of code. Here’s an example from a Skaffold configuration file used to build services for a Docker container:

1
2
3
4
5
- image: productcatalogservice
  context: src/productcatalogservice
  docker:
    buildArgs:
      SERVICE_VERSION:  "{{.CI_COMMIT_SHORT_SHA}}"

For GitHub, here’s a similar Skaffold configuration file that builds a Docker container using the GITHUB_SHA environment variable:

1
2
3
4
5
- image: productcatalogservice
  context: src/productcatalogservice
  docker:
    buildArgs:
      SERVICE_VERSION: "{{.GITHUB_SHA}}"

Expandable end

Register the Version Attribute

You register your version attribute from the Project Settings page (these markers are project-specific).

Deployment markers are project-specific. You need to register the version attributes with all projects that should use them.

  1. Click Settings to open your project’s settings page.
  2. On the Project Settings page, scroll down to Deployment version settings.
  3. Click into the field and start typing the attribute name. Select the version attribute from the list.

The attribute now displays as the Version Attribute.

You can use multiple attributes to collect deployment information. As long as they are all registered, Lightstep creates markers when a change in value is detected.


What Did We Learn?

  • You can create a attribute to hold the value of a service’s version.
  • When the attribute’s value changes, Lightstep creates a deployment marker on the charts in the Service Health view.