---
title: Code-level metrics
source: https://docs.newrelic.com/docs/apm/agents/php-agent/features/php-code-level-metrics
---

Code-level metrics allow developers using the [New Relic CodeStream extension](https://docs.newrelic.com/docs/codestream/observability/code-level-metrics) to see APM data displayed contextually in their IDE, alongside individual methods in the code. This allows developers to be more proactive about addressing performance issues as they write and review code.

## Getting started

First, [install](https://docs.newrelic.com/docs/codestream/start-here/install-codestream) the New Relic CodeStream extension into your supported IDE of choice and log in.

> #### ⚠️ IMPORTANT
>
> Code-level metrics are available in the PHP agent version 10.4.0 or higher and disabled by default for all versions except for versions 10.6.0 - 11.10.0 where it is enabled by default. To change this configuration, check out our [documentation](https://docs.newrelic.com/docs/apm/agents/php-agent/configuration/php-agent-configuration/#inivar-code-level-metrics).

## Agent attributes

The PHP agent reports and attaches the following attributes to spans produced by your application:

| **Name**         | **Description**                                                               | **Example**                                               |
| ---------------- | ----------------------------------------------------------------------------- | --------------------------------------------------------- |
| `code.function`  | The name of the instrumented function                                         | createProduct                                             |
| `code.filepath`  | The absolute path to the source code file in which `code.function` is defined | /symfony/symfony_app/src/Controller/ProductController.php |
| `code.lineno`    | The line number where `code.function` is defined in code.filepath             | 16                                                        |
| `code.namespace` | The namespace (class/ module name) in which `code.function` is defined        | App\\Controller\\ProductController                        |

> #### ⚠️ IMPORTANT
>
> Code-level metrics are only supported for PHP version 7.0 or higher.
