Improve app performance with golden signals in your IDE

Introducing code-level metrics in New Relic CodeStream

Published 6 min read

Last year our team released the IDE extension New Relic CodeStream, which allows you to enhance your IDE by providing real-time code reviews, feedback, comments, and instrumentation directly in your IDE. New Relic CodeStream is currently available for Visual Studio, Visual Studio Code, and JetBrains.

CodeStream also has an integration with New Relic that enables you to automatically filter your telemetry data in the context of your code. With this integration, you can see error data alongside the code open in your IDE, making it easier to monitor your code’s performance and resolve errors based on real-time data. 

Today, we are announcing that the CodeStream integration with New Relic now includes code-level metrics, a new feature that provides rich data on the golden signals alongside your code.

Screenshot of two screens, one New Relic dashboards, one of code in an IDE

Accessing code-level metrics in your IDE

Now you can dive deeper into the functions of your code by combining the powers of dashboard monitoring in New Relic and CodeStream IDE extensions. You get instant observability of your functions with code-level metrics.

With distributed tracing enabled, a few attributes attach automatically to your span data so your IDE can seamlessly present information on Google’s golden signals. For instrumented functions in your repository, you get this information directly in your IDE. This example shows response time, throughput, and error rate displayed as text, right above the function in the IDE:

This example shows the panel in your IDE where you can select the function and view details on response time, throughput, and error rate:

With these golden signals, you can identify opportunities in your code to improve your error rate, latency, traffic, and saturation. All of this comes with the added benefit of viewing this directly in your IDE, and you can add more important context about these signals in your codebase when communicating through CodeStream

You don’t need to apply any special filters or parse through endless streams of data to uncover which bits of information are most relevant to the functions you are looking at. The CodeStream integration automatically filters your telemetry data, providing a window pane of insights in your IDE matching the functional code most recently selected. 

Code-level metrics is just the start of our journey towards a seamless observability ecosystem that brings the power of New Relic directly to where you are coding.

Get started today with code-level metrics

To get started with code-level metrics with CodeStream, you’ll need to update or install the Python agent and ensure your IDE supports and uses the latest CodeStream extension.

1. Update your Python agent

To install or update the agent run the following command in your environment: 

  • To update your agent, run the command: pip install --upgrade newrelic
  • To install the agent, run the command: pip install newrelic
  • If you are running into issues building wheels during installation; use the flag --no-use-pep517

To validate that you have the correct Python Agent installed use these steps:

  • In New Relic One, navigate to the Environment tab (under Settings in the left menu bar) for your APM service.
  • Verify that the Agent Version is listed as 7.10.0.175 (or the latest version).

2. Install the CodeStream extension

You can install the CodeStream extension as you would any other extension for VS Code or a JetBrains IDE by going to the marketplace in your IDE. Make sure you’re running the latest version (v12.12 or later).

3. Sign up for CodeStream

If you aren’t already on CodeStream, you’ll need to sign up and create an account

CodeStream offers a number of signup options, but we suggest that you select Sign up with New Relic. In one step, you’ll be signed up for CodeStream and connected to your New Relic One account.

If there are people from your company that are already on CodeStream, you should have someone invite you to the CodeStream organization they’ve already created rather than creating a new one. 

It’s also possible that your company’s CodeStream admin allows anyone signing up with a work email address to join the existing organization without needing to be invited. In this case, you’ll see that organization listed for you to join after you sign up.

Screenshot of Create a CodeStream account window

After selecting Sign up with New Relic, you are prompted to enter your user API key from New Relic. Click here to create a user API key.

Screenshot of Enter your New Relic user API key when signing up for CodeStream

4. Connect to New Relic

If you selected a signup option other than New Relic, you need to connect to New Relic after  you complete the signup. Just look for the Connect to New Relic One button in the Observability section of the CodeStream pane.

Screenshot of CodeStream setup Connect to New Relic button

5. Associate a repository with your Python service

The Observability section of the CodeStream pane should now list all of the repositories you have open in your IDE. Make sure that the repository you want to integrate is open. Assuming it’s in the list, you’ll be able to select the corresponding APM service from your New Relic One account. See the hello-ny example in this screenshot:

Screenshot of an example of associating a repository with your Python service in New Relic Codestream

If you have multiple services that correspond to this repo (such as different services for different environments), you can make additional repo<>service associations by going to the Service Summary page in New Relic and looking for the Repositories section at the bottom right.

Note that after you make the repo<>service association, you might start to see recent errors for that service appearing here in the Observability section.

6. Open a Python project

Next, open a Python project in your IDE that corresponds to an instrumented service in New Relic. Soon, you should see golden signals appear as a codelens above the instrumented methods (if you are using Visual Studio).

Screenshot of golden signals directly in an IDE

Select the golden signals to see more detail.

If the repository that's currently open in your IDE isn't associated with a service in New Relic One, you are prompted to connect your repository to New Relic One.