spk-logo-white-text-short2
0%
1-888-310-4540 (main) / 1-888-707-6150 (support) info@spkaa.com
Select Page

Extending CloudBees SDA Analytics

Written by Chris McHale
Published on January 18, 2022

CloudBees SDA Analytics has more power than you think

One of the main features of CloudBees SDA is CloudBees Analytics, powered by ElasticSearch. It’s a powerful tool for displaying continuous integration data and there are loads of useful metrics available from extensive dashboards right out of the box.

Why should I bother extending to CloudBees Analytics?

The CloudBees analytics platform is powerful and useful right away, but depending on your local system you may want to pull data from more sources than just the ones in SDA. The CloudBees analytics system only has access to data within SDA itself. If it makes sense to get data from a 3rd party tool, it needs to be set up before that data can be displayed.

For example, a client I worked with wanted to display lead time on the CloudBees analytics dashboard. While SDA does have a built-in dashboard for lead time, this differed from how the client wanted to define it. Not a problem, we had the tools to make that happen. The first step was pulling in data into the pipeline they were running. In this case, we needed the creation date for Jira tickets. Once we had the data in our local system, we could use it in reports.

Two ways to get custom data into dashboards

There are two main ways to get custom data into reports: output parameters, and extending the Elasticsearch database. Of the two, output parameters are easier to work with but they are limited to only passing strings. This means that once you get data to the report end, it needs to be cast to whatever data type the dashboard requires.

Extending the Elasticsearch database is more challenging.  But, if you know you’ll be passing the same types of data over and over again, it may make sense to permanently update the data types available in your reports. This feature allows you to add custom fields of any data type and fully control how they’re implemented. It’s more complex, but more extensible for those brave enough to dig in.

Output parameters

Setting up an output parameter is a simple matter in the SDA UI. From any pipeline, select the menu in the upper right and go to “Parameters”. Once in the selection UI, click on “Output Parameters” in the upper right and you can add as many as you like. Output parameters will not have any data by default and are limited to only strings. Keep in mind that they will only show up in reports once you run a pipeline that passes some data into the parameter.

output parameters screenshot

Once any data has been run in a pipeline with an output parameter, it will show up in the reports. Create a new report and select the “Pipeline Run Report” type. From there, the quickest way to ensure the parameter exists and is being displayed correctly is to enter a new search criterion for “Output Parameter: <my parameter>”. As with other data, once you have the system set up, you can save the report and check the tabular preview” to view your data.

Adding more attributes to the database

This method is more complex but offers full control of how data is stored and used for analytics. Setting this up is a two-step process:

  1. Create the new database entries.
  2. Send in data to match the new configuration.

For the first step, navigate to “<SDA install location>/bin” and run this command:

~ ectool createReportObjectAttribute <report object type> <attribute name>

You’ll need to replace “report object type” with the type of report you want to associate with (for example, “pipelines” or “quality”) and the attribute name with the attribute you want to add. You can optionally add a required data type at the end with the flag –type <data type>, such as –type number. By default, this is set to string.

After that is set, you can send data to this report attribute at any time using this command:

ectool sendReportingData <report object type> '{"<attribute 1>": <data>, "<attribute 2>": <data>}'

Attributes are comma-separated, and you can put in as many as you’d like. My recommendation for pipeline report type data is to send in the pipeline runtime name, ID, and project to keep things consistent and be able to call back if necessary.

Here is an example of a command sending in reporting data to custom fields that have already been set up:

./ectool sendReportingData pipeline '{"successfulTests": $[/success], "failedTests": $[failed], "totalTests": $[total], "flowRuntimeName": $[/myPipelineRuntime/flowRuntimeName], "flowRuntimeId": $[/myPipelineRuntime/flowRuntimeId], "projectName": $[/myPipeline/projectName]}'

Bringing it all together

From there, this data is available immediately in the ES analytics database. Data entries that have been manually set up using the attributes method will be available with whatever name you used.  And, output parameters will be prepended with “Output Parameter” to identify them. From there, all of this data can be sent into dashboards and built out normally.

If you’re interested in learning more about CloudBees, check out some of our other CI/CD blogs and case studies on our Resources page.  Or, contact me if you have questions!

 

Latest White Papers

10 AI Use Cases: Accelerating Automotive Embedded Development

10 AI Use Cases: Accelerating Automotive Embedded Development

Software-defined and electric vehicles are only increasing as automotive technology advances. As these features grow, automakers must adapt. Manufacturing a car is not the same as it was years ago. This eBook explores how AI can be used in the automotive development...

Related Resources

Connecting Slack and JSM for Better and Faster IT Support

Connecting Slack and JSM for Better and Faster IT Support

Atlassian JSM and Slack Integration Hi, this is Carlos Almeida from SPK and Associates. Today I'll be giving you a short demo on the Atlassian JSM to Slack integration. We want an employee to be able to ask a question inside Slack. If there is an existing knowledge...

Why AI Agents Need Governance Before They Need Scale

Why AI Agents Need Governance Before They Need Scale

Key Takeaways Governance must come before scale: AI agents can access data and take actions, meaning clear rules around what they can see and do must be established before widespread deployment. Follow the principle of least privilege: Agents should only receive the...

Why Aerospace Programs Miss Deadlines Part 2

Why Aerospace Programs Miss Deadlines Part 2

Key Takeaways A connected digital thread helps prevent schedule delays: Linking CAD, simulation, PLM, ALM, and DevOps gives aerospace teams better visibility into dependencies, changes, and risks across the lifecycle. Earlier validation reduces costly rework: Creo and...