fbpx
1-888-310-4540 (main) / 1-888-707-6150 (support) info@spkaa.com
Select Page

Extending CloudBees SDA Analytics

windchill features best plm software
Written by Joshua Kling
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.

SDA-ElasticSearch-1

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

The Hybrid-Remote Playbook

The Hybrid-Remote Playbook

Post-pandemic, many companies have shifted to a hybrid or fully remote work environment. Despite many companies having fully remote workers, many still rely on synchronous communication. Loom offers a way for employees to work on their own time, without as many...

Related Resources

Measuring the Impact of AI on Product and Development Teams

Measuring the Impact of AI on Product and Development Teams

Generative AI is transforming the software development industry, enabling teams to develop, secure, and operate software more efficiently. GitLab is no exception. Its AI-powered suite, GitLab Duo, aims to optimize workflows across the entire software delivery...

Streamlining Issue Creation and Transitions in Jira with STM

Streamlining Issue Creation and Transitions in Jira with STM

Jira’s flexibility and ease-of-use make it a go-to platform for project and issue management.  However, repetitive tasks like creating and transitioning issues can become time-consuming for its users.  Fortunately, Redmoon Software has created an ​​Atlassian...

Maximizing Efficiency with a RACI Matrix

Maximizing Efficiency with a RACI Matrix

For years, I’ve enjoyed working with clients on difficult projects. In my early career, I did a lot of work for a cloud and infrastructure company where I mainly worked with internal teams.  However, when I did get the chance to work with external clients, I found...