Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

getting the metricSourceId using componentId

Sridhar Ravula
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 18, 2025

Hi All,

 

trying to generate the Change failure rate in compass for the specific component using GitHub Actions cicd, i was able to find the componentID using graphql api but to generate CFR i need to pass the metricSourceID. getting the metricSourceID using graphql api getting below error . 

Error parsing metric source response: 'data'
22{
23 "errors": [
24 {
25 "message": "Validation error (FieldUndefined@[compass/component/metricSources]) : Field 'metricSources' in type 'CompassComponentResult' is undefined",
26 "locations": [
27 {
28 "column": 7,
29 "line": 5
30 }
31 ],
32 "extensions": {
33 "classification": "ValidationError",
34 "errorSource": "GRAPHQL_GATEWAY",
35 "statusCode": 400
36 }
below is the graphql query i used -
query_metric_sources = """
query getMetricSources($componentId: ID!) {
compass {
component(id: $componentId) {
metricSources {
nodes {
id
metricDefinition {
id
name
}
}
}
}
}
}
"""

1 answer

0 votes
Enrique Serrano Valle
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 21, 2025

Hi, @Sridhar Ravula !

You can find the built-in metric definition identifiers available in the documentation: https://developer.atlassian.com/cloud/compass/forge-graphql-toolkit/Enumerations/BuiltinMetricDefinitions/

This may be the one that you were looking for:

ari:cloud:compass::metric-definition/builtin/change-failure-rate-28d

Alternatively, a query such as the following should work for you, if the given component already has that metric added to it:

query GetMetricDefinitionId {
compass {
component(
id: "ari:cloud:compass:...:component/.../..."
) {
... on CompassComponent {
id
name
metricSources {
... on CompassComponentMetricSourcesConnection {
edges {
node {
metricDefinition {
id
}
}
}
}
}
}
}
}
}

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events