Skip to content

External custom metrics

The LinearB External Custom Metrics API allows for the reporting of critical external metrics directly into the LinearB platform, enhancing the ability to customize and deepen analytics. Key examples of such metrics include:

  • Code Coverage: Enabling teams to measure the percentage of their codebase tested by automated tests, helping ensure quality and identify areas needing more thorough testing.

  • Security Vulnerabilities: Offering the ability to track the number and severity of security vulnerabilities, assisting teams in prioritizing security issues and maintaining robust code.

  • Build Stability: Allowing teams to monitor the success rates of their builds, which is vital for identifying patterns in build failures and improving CI/CD processes.

By leveraging this API, customers can significantly broaden the scope of their performance monitoring, enveloping specialized metrics that go beyond conventional development indicators, thus achieving a granular view of their software development lifecycle and overall system health, all within the familiar environment of the LinearB platform

Report metric

Report your custom metrics to LinearB

HTTP request

POST  https://public-api.linearb.io/api/v1/report/metric

Body parameters

Parameter name Value Description
metric_name
(required)
string
[ 1 .. 255 ] characters
The name of the metric
timestamp
(required)
string
(timestamp ISO 8601 format)
The metric recorded at this specific time
value Number
(lowercase only)
The value of the metric
source string The source of the metric
Example: The 3rd party tool that calculated the metric
entity object An entity this metrics relates to
Valid values are: "pr_url", "repo_url", "commit_sha", "contributor_email"
tags objects Any tags that can help identify the metric later on

Examples

Example with all values

{
  "source": "gitstream",
  "timestamp": "2022-03-13 08:07:12.613",
  "metric_name": "ran_cm",
  "value": "2.5",
  "entity": {
    "pr_url": "https://github.com/hello/world/pull/1731"
  },
  "tags": {
    "my_tag": "my_value"
  }
}

Example with commit SHA and PR url

{
  "timestamp": "2022-03-13 08:07:12.613",
  "metric_name": "ran_cm",
  "entity": {
    "pr_url": "https://github.com/testorg/testrepo/1234",
    "commit_sha": "my_commit_sha"
  }
}

Responses

200 - Successful Response

{
  "message": "string",
  "metric_uuid": "string"
}

400 - Bad Request

401 - Unauthorized

403 - Forbidden

405 - Method Not Allowed

422 - Validation Error

500 - Internal Server Error

504 - Gateway Timeout