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

Code-level metrics are span attributes that the .NET agent attaches to your application's spans, pinpointing the exact function and class responsible for a given span. This allows you to be more proactive about addressing performance issues as you review your code. You can view these attributes on individual spans in [distributed tracing](https://docs.newrelic.com/docs/distributed-tracing/ui-data/understand-use-distributed-tracing-data/), or query them directly with [NRQL](https://docs.newrelic.com/docs/nrql/get-started/introduction-nrql-new-relics-query-language/).

> #### ⚠️ IMPORTANT
>
> With the release of .NET agent version 10.2.0, code-level metrics enabled by default.
>
> Code-level metrics are available in [.NET agent version 9.9.0 and higher](https://docs.newrelic.com/docs/release-notes/agent-release-notes/net-release-notes) and are disabled by default. To change this configuration, check out our [documentation](https://docs.newrelic.com/docs/apm/agents/net-agent/configuration/net-agent-configuration#code_level_metrics).

## Agent attributes [#attributes]

The .NET agent reports and attaches the following attributes to spans produced by your application.

> #### ⚠️ IMPORTANT
>
> In some cases, the agent will directly wrap base framework code (data stores, external calls, etc.) that is invoked within your application, and these attributes won't be attached.

| Name             | Description                                                                      | Example                              |
| ---------------- | -------------------------------------------------------------------------------- | ------------------------------------ |
| `code.function`  | The name of the instrumented function.                                           | Index                                |
| `code.namespace` | The namespace (full name of the class type) in which `code.function` is defined. | MyService.Controllers.HomeController |
