# @grafana/faro-instrumentation-fetch

> Faro fetch auto-instrumentation package

Latest version **1.19.0** (published 2025-07-09) · Apache-2.0 license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @grafana/faro-instrumentation-fetch
pnpm add @grafana/faro-instrumentation-fetch
yarn add @grafana/faro-instrumentation-fetch
bun add @grafana/faro-instrumentation-fetch
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.19.0 |
| Published | 2025-07-09 |
| First published | 2023-06-08 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 72.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1134 |
| Author | Grafana Labs |
| Maintainers | ivanahuckova, bmatei, domasx2, clord, iwysiu, leventebalogh, andresmgotor, torkelo, dprokop, peteholmberg, ryantxu, mckn, sunker, grafanabot, tolzhabayev, dsotirakis, scottleppgrafana, jwestbrook, academo_grafana, reemtariqq, yulia.shanyrova, teodosii, brojd-grafana |
| Keywords | observability, apm, rum, logs, traces, metrics, fetch |

## Links

- npm: https://www.npmjs.com/package/@grafana/faro-instrumentation-fetch
- Repository: https://github.com/grafana/faro-web-sdk
- Issues: https://github.com/grafana/faro-web-sdk/issues
- npm.io page: https://npm.io/package/@grafana/faro-instrumentation-fetch

## Dependencies (1)

- [@grafana/faro-core](https://npm.io/package/@grafana/faro-core.md) ^1.19.0

## Alternatives

- [gamedig](https://npm.io/package/gamedig.md) — 29.3K weekly downloads
- [join-monster](https://npm.io/package/join-monster.md) — 12.8K weekly downloads
- [masked](https://npm.io/package/masked.md) — 5.5K weekly downloads
- [@comunica/actor-query-process-explain-logical](https://npm.io/package/@comunica/actor-query-process-explain-logical.md) — 4.7K weekly downloads
- [@veracity/vui](https://npm.io/package/@veracity/vui.md) — 4.6K weekly downloads

## Recent versions

- 1.19.0 (latest) — 2025-07-09
- 1.18.2 — 2025-05-21
- 1.18.1 — 2025-05-07
- 1.18.0 — 2025-05-05
- 1.17.2 — 2025-04-24
- 1.17.1 — 2025-04-22
- 1.17.0 — 2025-04-16
- 1.16.0 — 2025-04-14
- 1.15.0 — 2025-04-08
- 1.14.3 — 2025-04-02
- 1.14.2 — 2025-04-02
- 1.14.1 — 2025-02-27
- 1.14.0 — 2025-02-24
- 1.13.3 — 2025-02-10
- 1.13.2 — 2025-02-10
- … 49 more at https://npm.io/package/@grafana/faro-instrumentation-fetch/versions

## README

# @grafana/instrumentation-fetch

Faro instrumentation of the JavaScript [Fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) API.

❗️*Warning*: this package is experimental and may be subject to frequent and breaking changes.
Use at your own risk.❗️

## Installation and Usage

❗️*Warning*: This package is not interoperable with `@opentelemetry/instrumentation-fetch`.
Use one or the other❗️

Add the instrumentation as outlined below.
The instrumentation send the following events alongside respective request/response data like HTTP
headers and other response properties like status codes the requests url and more.

Event names are:

- `faro.fetch.resolved` for resolved requests.
- `faro.fetch.rejected` for rejected requests.

```ts
// index.ts
import { FetchInstrumentation } from '@grafana/faro-instrumentation-fetch';
import { getWebInstrumentations, initializeFaro } from '@grafana/faro-react';

initializeFaro({
  // ...
  instrumentations: [
    // Load the default Web instrumentations
    ...getWebInstrumentations(),
    // Add fetch instrumentation
    new FetchInstrumentation(),
  ],
});


// myApi.ts
fetch(...) // Use fetch as normal - telemetry data is sent to your Faro endpoint
```

## Backend correlation

In order to prepare backend correlation, this instrumentation adds the following headers to each
request that server-side instrumentation can use as context:

- `x-faro-session` - the client-side session id

## Planned Development

- Additional functionality to correlate frontend requests with backend actions
- Event attributes with end-to-end timing details

---
_Source: https://npm.io/package/@grafana/faro-instrumentation-fetch · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
