Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,466,290
Community Members
 
Community Events
176
Community Groups

Metrics Calculations in Compass

Hi there, 

I'm wondering whether you've considered having support for metrics calculation in Compass? By this I mean the ability for Compass to receive single values via API that are stored and then calculated within Compass. For example - deployment frequency that is calculated from receiving single updates via API for each deploy for that application. 

Having the ability to do this would remove the need for users of Compass needing a service that manages this as well. 

Cheers, 

Pete

1 comment

Henry Olson Atlassian Team Aug 23, 2022

Hi @Pete Capra ! Thanks for reaching out. As it happens, we are actually in the process of implementing and releasing a feature that I think will meet your needs. We're calling it "Derived Metrics", and the concept is that you only need to send Compass Events (like Deployments or Builds), and Compass will be able to calculate certain metrics automatically for you.

Deployment Frequency and Build Success Rate are two metrics that are actually able to be created as "derived" today. When you create these metric sources from the component UI, they'll be auto-calculated based on the events present on that component. When creating metric sources via the API, you can supply `derived: true` as part of the input to set it to auto-calculate based on component events.

Look forward to a blog post in the coming weeks that will explain all the details of how to use this feature and which metrics are supported. And of course, let us know if you have suggestions on how the feature can be improved.

Best,
Henry

Like # people like this

Oh, that's awesome! Thanks @Henry Olson 

Hi @Henry Olson ,

 

Do you have an example of the cURL request that would make a metric derived? I've tried with Deployment Frequency, but it always ends up using the value I supply. If I remove the "value" input then it removes any data.

Henry Olson Atlassian Team Aug 29, 2022

Hi @Ben Wozniak , you decide a Metric Source is derived (or not) at creation time, it can't be changed later. When creating a new Deployment Frequency Metric Source on a component, you'll want to supply `derived: true` to the input to set it to be derived, and then the values will only be calculated based on that component's deployment events. It's worth noting that creating a deployment frequency metric through the UI will always create a derived metric.

Here's an example of the GraphQL query and input needed to create a derived metric source:

mutation createMetricSource($input: CompassCreateMetricSourceInput!) {
compass {
createMetricSource(input: $input) {
success
}
}
}
{
"input": {
"componentId": <your component ID goes here>,
"metricDefinitionId": "ari:cloud:compass::metric-definition/builtin/weekly-deployment-frequency-28d",
"externalMetricSourceId": "test123",
"url": "https://google.com",
"derived": true
}
}

Once you have a derived metric source, you won't add metric values manually, they will be auto-calculated by Compass for you. 

Like Ben Wozniak likes this

Thanks, Henry. I'm guessing this was a new addition since the Alpha release, I just needed to delete my old Deployment Frequency metric and add another one back. Now it seems to be derived.

Like Henry Olson likes this
Henry Olson Atlassian Team Aug 30, 2022

Yeah, it was a recent change (we still haven't done an official announcement post with dev documentation). But if you have any feedback on our implementation we'd love to hear it!

When I try to post to my new event, I get this error message:

`We could not create the event because the event source is not found. Please check that the external event source ID and the type of event being submitted match the event source.If a Forge App ID was used during event source creation, please also check you are using the same Forge App ID when accessing the event source.`

I've confirmed that my external ID matches the one in the created event source. I've also supplied the event source ID in the "customEventProperties", although the documentation does not specify that being necessary. I can't seem to figure out what field I have incorrect that Compass cannot find the event source.

Henry Olson Atlassian Team Aug 30, 2022

@Ben Wozniak did you create the event source manually or was it created by a Forge app (i.e. Bitbucket)? It might help if you could share:

1. The details of that event source when you query it

2. The input you're providing to the createEvent mutation

 

Typically, I've seen this error when the wrong type of event is being pushed to the event source (like a Deployment event for an Incident event source) or if the event source was created by a Forge app and I was trying to add events to it manually.

I think my first issue was that I was using the cURL command for a custom event, it looks like there are different payloads for things like a Deployment event. So I modified my cURL command to match the Deployment event in the documentation.

 

Now I am running the command and getting a format error for my build pipeline URL: "The value for the url field is invalid. Follow these validation rules: URL is invalid"

My URL is https://dev.azure.com/<ORG>/<PROJECT>/_git/<REPO>

Here is an example of the whole cURL now, with some secret info taken out:

curl \
--request POST \
--url https://example.atlassian.net/gateway/api/compass/v1/events \
--user "EMAIL:PAT" \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--data "{
\"cloudId\": \"ID\",
\"event\": {
\"deployment\": {
\"updateSequenceNumber\": \"1\",
\"displayName\": \"name\",
\"description\": \"description\",
\"url\": \"www.exampleUrl.com\",
\"lastUpdated\": \"$(date -u +'%Y-%m-%dT%H:%M:%SZ')\",
\"externalEventSourceId\": \"ID\",
\"deploymentProperties\": {
\"sequenceNumber\": \"1\",
\"state\": \"SUCCESSFUL\",
\"pipeline\": {
\"pipelineId\": \"ID\",
\"url\": \"https://dev.azure.com/<ORG>/<PROJECT>/_git/<REPO>\",
\"displayName\": \"Display\"
},
\"environment\": {
\"category\": \"DEVELOPMENT\",
\"displayName\": \"Auth Dev\",
\"environmentId\": \"Auth.Dev\"
}
}
}
}
}"

Okay it appears that my build pipeline URL is fine, it was actually the "exampleUrl.com" that was causing issues. It appears the API is expecting the URLs to be prepended with "https://". I think this would be a valuable add to the documentation as well as the error that is returned from the attempted API call.

If this is in fact the case, it looks like the cURL command is working now. It was a little painful to work through but got it working :) 

Like # people like this
Henry Olson Atlassian Team Aug 30, 2022

Glad you  figured it out @Ben Wozniak ! I agree, that's not clear and I'll add a ticket for us to improve the documentation and validation rules for that field.

Comment

Log in or Sign up to comment
TAGS

Atlassian Community Events