Skip to content

Commit

Permalink
feat: update docs
Browse files Browse the repository at this point in the history
Signed-off-by: Ilya Amelevich <ilya.amelevich@gmail.com>
  • Loading branch information
iamelevich authored and SkeLLLa committed Mar 14, 2023
1 parent 01134f9 commit 6ccaade
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
21 changes: 21 additions & 0 deletions docs/fastify-metrics.iroutelabelsoverrides.getroutelabel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [fastify-metrics](./fastify-metrics.md) &gt; [IRouteLabelsOverrides](./fastify-metrics.iroutelabelsoverrides.md) &gt; [getRouteLabel](./fastify-metrics.iroutelabelsoverrides.getroutelabel.md)

## IRouteLabelsOverrides.getRouteLabel property

Function that will return route value for metrics label. By default will use: `request.routeConfig.statsId ?? request.routerPath`

<b>Signature:</b>

```typescript
getRouteLabel?: (request: FastifyRequest) => string;
```

## Example

To use route full url as label:

```ts
getRouteLabel: (request) => request.raw.url;
```
11 changes: 6 additions & 5 deletions docs/fastify-metrics.iroutelabelsoverrides.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ export interface IRouteLabelsOverrides

## Properties

| Property | Modifiers | Type | Description |
| ------------------------------------------------------------ | --------- | ------ | ----------------------------- |
| [method?](./fastify-metrics.iroutelabelsoverrides.method.md) | | string | <i>(Optional)</i> Method name |
| [route?](./fastify-metrics.iroutelabelsoverrides.route.md) | | string | <i>(Optional)</i> Route name |
| [status?](./fastify-metrics.iroutelabelsoverrides.status.md) | | string | <i>(Optional)</i> Status code |
| Property | Modifiers | Type | Description |
| -------------------------------------------------------------------------- | --------- | -------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [getRouteLabel?](./fastify-metrics.iroutelabelsoverrides.getroutelabel.md) | | (request: FastifyRequest) =&gt; string | <i>(Optional)</i> Function that will return route value for metrics label. By default will use: <code>request.routeConfig.statsId ?? request.routerPath</code> |
| [method?](./fastify-metrics.iroutelabelsoverrides.method.md) | | string | <i>(Optional)</i> Method name |
| [route?](./fastify-metrics.iroutelabelsoverrides.route.md) | | string | <i>(Optional)</i> Route name |
| [status?](./fastify-metrics.iroutelabelsoverrides.status.md) | | string | <i>(Optional)</i> Status code |
2 changes: 2 additions & 0 deletions etc/fastify-metrics.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import client from 'prom-client';
import { DefaultMetricsCollectorConfiguration } from 'prom-client';
import { FastifyPluginAsync } from 'fastify';
import { FastifyRequest } from 'fastify';
import { FastifyTypeProviderDefault } from 'fastify';
import { HistogramConfiguration } from 'prom-client';
import { HTTPMethods } from 'fastify';
Expand Down Expand Up @@ -58,6 +59,7 @@ export interface IMetricsRouteContextConfig {

// @public
export interface IRouteLabelsOverrides {
getRouteLabel?: (request: FastifyRequest) => string;
method?: string;
route?: string;
status?: string;
Expand Down

0 comments on commit 6ccaade

Please sign in to comment.