---
title: Improve your code base
source: https://docs.newrelic.com/docs/tutorial-innovation-and-growth/development-quality-mgmt
---

Overall, a business's digital operations are only as stable as its code. Without a stable code base, engineering will never have time to meet even basic demand for new features, let alone move at the pace required to innovate new and exciting features for their customers. Engineers will spend their time troubleshooting and fixing poor quality code to prevent negative customer experience. Implementing high quality code is key to an organization's ability to innovate and grow.

This guide identifies specific key performance indicators and processes that help improve code quality. It's followed by the [Release quality guide](https://docs.newrelic.com/docs/new-relic-solutions/observability-maturity/innovation-growth/release-quality-implementation-guide), which can only be done after completing the steps lined out in this one.

You're a good candidate for using this guide if:

-   You're not currently measuring code quality.
-   Your code quality is perceived as poor.
-   You don't know where your developers are spending their time.
-   Your organization suffers from too many outages due to application defects.

## Key performance indicators [#key-perf-indicators]

These KPIs help you identify the sources of code defects and the areas that require the most developer effort so that your devs can use their time more efficiently. The KPIs also help you understand if development velocity has any impact on code quality.

### Stability [#kpi-stability]

**Build success KPI**

Build success measures the number of times new code is successfully compiled or integrated into the overall application.

**Goal:** Increase the build success rate to nearly 100%

**Best practices:** Code build events should include the following attributes:

-   Build ID
-   Build name
-   Build result (success/failure)
-   Build duration

**Unit test success KPI**

Unit test success measures the percentage of unit tests new code passes.

**Goal:** Increase the test success rate.

**Best practices:**

Unit tests should:

-   Test one use case.

-   Complete quickly.

-   Be reliable.

-   Have no inter- or external- dependencies.

-   Have simple and easy to maintain code.

    Unit test events should include the following attributes:

-   Test name

-   Commit being tested

-   Test duration

-   Test result (success/failure)

**Code coverage KPI**

Code coverage measures the amount of an application's code base that's subject to at least one unit test.

**Goal:** Increase code coverage to 100%.

**Best practices:** Follow the [unit test](#kpi-unit-test-success) best practices to ensure that code test coverage reaches the 100% goal.

**Defect volume KPI**

Defect volume measures the number of defects introduced into an application by a specific module of code.

**Goal:** Reduce the number of new defects.
**Best practices:** Identify the sources of new defects by relating them to specific services and code modules.

Code defect events should include the following attributes:

-   Timestamp
-   Application
-   Code module
-   Reference to defect

### Velocity [#kpi-velocity]

**Code commit volume KPI**

Code commit rate measures the number of new code commits over time.

**Goal:** Code commit rate should be correlated against defect volume to identify the optimal balance between velocity and stability.

**Best practices:** Code commit events should include the following attributes:

-   Timestamp
-   User
-   Project
-   Repository
-   Branch
-   Commit ID or hash

### Gather the required KPIs [#gather-kpis]

The best place to start is by gathering your key performance indicators. To do this, you need to know the specific technology platforms that support your development processes, such as source code repositories and build/test automation platforms. Then, you'll need to identify methods for extracting each KPI's attributes and importing them into New Relic.

You can find the KPIs and minimum-required attributes needed for this use case in the [key performance indicators](#key-perf-indicators) section above. Typically, you'll use your development toolchain's APIs to extract the KPIs and their attributes, then submit them to New Relic using the [custom events API](https://docs.newrelic.com/docs/data-apis/ingest-apis/introduction-event-api/).

Before starting any custom integration work, you should find if any applicable out-of-box integrations exist.

### Implement dashboards [#implement-dashboards]

Our dashboards are the primary method this improvement process uses. They show your current KPIs and help you to identify the areas that require improvement. You can find sample dashboards [in the New Relic OMA resource center on GitHub](https://github.com/newrelic/oma-resource-center).

The information displayed in the dashboards depends on your development toolchain, so you'll need to [customize your dashboard](https://developer.newrelic.com/collect-data/monitor-your-application/query-custom-data/) to your exact specifications.

### Establish a development baseline [#establish-baseline]

Because you need enough data to form a baseline before you can [perform the initial enablement](#perform-enablement-one), you must establish your baselines that consist of a sample of development activity. Normally, this will be a minimum of two weeks, but it can be up to six weeks depending on your current development pace. One easy way to do this is to align your baseline collection and evaluation cycle with your Agile sprints, if applicable.

You should periodically ensure that event data is accumulating as expected in New Relic while you establish your baselines.

### Meet with your team [#meet-with-team]

After establishing your baselines, you'll introduce development teams and other stakeholders to the collected data and the ongoing continuous improvement process you'll be following.

The process consists of three activities:

1.  **Review the KPIs and trends**: You and the stakeholders will look at the KPIs and identify trends.
2.  **Identfy achievements, challenges, and opportunities**: In this phase, you'll identify areas where KPIs are improving (achievements) and areas where they're not improving (challenges). You'll then identify strategies and tactics for improving KPIs (opportunities) and how best to implement them.
3.  **Make technical recommendations**: Here, you and the relevant stakeholders will identify and review technical recommendations, such as making changes to your development toolchain or observability strategies.

### Begin the improvement process [#improvement-process]

This final step is a continuous improvement process. During this phase, you'll [meet with your team](#meet-with-team) to review your progress against your baseline and adjust your strategies so you deliver the desired improvements. Each cycle of the improvment process should occur after several iterations of your development process. Typically, these occur at the mid-point and end of every Agile sprint.

During this phase you should:

-   Report your KPIs each week to stakeholders to ensure that teams are appropriately prioritizing the work and show the progress made towards the promised business outcomes.
-   Record and retain your weekly KPIs over time to establish new baselines and show the rate of improvement.

Once you've completed the process above, you can move on to using New Relic to improve your release quality.
