Pings service

The Pings service is the service that collects ping requests from all Sourcegraph instances, and is available at pings.sourcegraph.com.

  • As of 5.2.0, ping requests are sent to https://pings.sourcegraph.com/updates directly.
  • For Sourcegraph instances that prior to 5.2.0, all ping requests sent to https://sourcegraph.com/.api/updates are being transparently forwarded to https://pings.sourcegraph.com/updates.

Service images

Source code for Pings service is in sourcegraph/sourcegraph/cmd/pings. The image gets built the same way as any other Sourcegraph service, i.e. with insiders, the standard main-branch and main-dry-run tags.

All images tags are available in the Docker Hub.

Local development

For local development, please refer to its README.

Operations

Here is a list of useful quick links:

Infrastructure access

The following Entitle requests are needed to get access to Pings service infrastructure:

Deployment

The Pings service infrastructure is defined in sourcegraph/managed-services/services/pings utilizing Managed Services Platform.

Modify deployment manifest

To modify the deployment manifest:

  1. Update service.yaml file
  2. In the repository root, run sg msp generate services/pings/service.yaml prod
  3. Stage changes and make a pull request
  4. The Terraform Cloud rolls out changes

Use a different image tag

To specify a Docker image tag other than the default, update the service.yaml:

 - id: prod
   ...
   deploy:
     type: manual
+    manual:
+      tag: 218287_2023-05-10_5.0-5bd03cd18e71

Re-deploy the same manifest

Go to the “Deploy revision” page of the Cloud Run service and click DEPLOY (bottom of the page) without changing any configuration. This will also happen whenever a Terraform change happens to the “cloudrun” stack.

Update the service resource allocations

The following section in the service.yaml defines the resource allocation for the Cloud Run service instances:

environments:
  - id: prod
    instances:
      resources:
        cpu: 1 # Per-instance CPU
        memory: 1Gi # Per-insatnce memory
      scaling:
        maxCount: 3 # Maximum count of instances
        minCount: 1 # Minimum count of instances, setting to 1 can avoid cold start

Once updated, follow the Modify deployment manifest to apply the changes.

Observability

Alerting

All alerts from all environments currently go to #alerts-pings-sourcegraph-com.

Metrics

The deployment’s Cloud Run metrics overview page provides basic observability into the service provided out-of-the-box by Cloud Run, such as instance count and resource utilization.

Pings service also pushes GCP Custom Metrics via OpenTelemetry metrics.