> For the complete documentation index, see [llms.txt](https://ffdesenvolvedores.gitbook.io/ff-desenvolvedores/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ffdesenvolvedores.gitbook.io/ff-desenvolvedores/metricas.md).

# Métricas

Neste endpoint temos um endpoint onde conseguimos identificar quantas chamadas você realizou, quantas deram erros, quais deram sucesso, etc.

## Consulta Métricas de Requisições

<mark style="color:blue;">`GET`</mark> `{{url_ambiente}}/v1/infra/metrics`

Retorna métrica de requisições

#### Query Parameters

| Name      | Type | Description                            |
| --------- | ---- | -------------------------------------- |
| startDate |      | example: startDate=2023-02-27T00:00:00 |
| endDate   |      | example: endDate=2023-02-27T23:59:00   |

#### Headers

| Name                                                        | Type | Description     |
| ----------------------------------------------------------- | ---- | --------------- |
| Ocp-Apim-Subscription-Key<mark style="color:red;">\*</mark> | md5  | Chave de acesso |

{% tabs %}
{% tab title="200: OK Retorno da métrica de requsições" %}

```json
{
    "value": [
        {
            "apiTimeAvg": 1026.9530200000002,
            "apiTimeMax": 1958.8924000000002,
            "apiTimeMin": 679.7546,
            "bandwidth": 11070,
            "cacheHitCount": 0,
            "cacheMissCount": 0,
            "callCountBlocked": 0,
            "callCountFailed": 0,
            "callCountOther": 0,
            "callCountSuccess": 15,
            "callCountTotal": 15,
            "name": "FF 4 devs",
            "productId": "/products/ff-4-devs",
            "serviceTimeAvg": 1026.4037666666668,
            "serviceTimeMax": 1958.4173,
            "serviceTimeMin": 679.2035000000001,
            "subscriptionId": "/subscriptions/630389ade7ba8e146c1ee625",
            "userId": "/users/1"
        }
    ],
    "count": 1,
    "success": true,
    "executed": "2023-02-28T10:43:36.3911772Z"
    }

```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
Se não for passando nenhum range de datas, por padrão a busca será feita com base no primeiro ao ultimo dia do mes.
{% endhint %}

> **Field**: value\[].apiId\
> **Type**: `string`
>
> Path identificador de API - /apis/{apiId}.

> **Field**: value\[].apiRegion\
> **Type**: `string`
>
> Identificador da região API.

> **Field**: value\[].apiTimeAvg\
> **Type**: number
>
> Tempo médio que levou para processar a solicitção.

> **Field**: value\[].apiTimeMax\
> **Type**: `number`
>
> Tempo maximo que levou para processar a solicitação.

> **Field**: value\[].apiTimeMin\
> **Type**: `number`
>
> Tempo minimo que levou para processar a solicitação.

> **Field**: value\[].bandwidth\
> **Type**: `interger`
>
> Largura de banda consumida.

> **Field**: value\[].cacheHitCount\
> **Type**: `interger`
>
> Numero de vezes em que o conteúdo foi exibido a partir da politica de cache.

> **Field**: value\[].cacheMissCount\
> **Type**: `interger`
>
> Numero de vezes em que o conteúdo foi obtido do backend.

> **Field**: value\[].callCountBlocked\
> **Type**: `interger`
>
> Número de chamadas bloqueadas devido a credenciais inválidas. Isso inclui chamadas que retornam HttpStatusCode.Unauthorized e HttpStatusCode.Forbidden e HttpStatusCode.TooManyRequests.

> **Field**: value\[].callCountFailed\
> **Type**: `interger`
>
> Número de chamadas com falha devido a erros de proxy ou back-end. Isso inclui chamadas que retornam HttpStatusCode.BadRequest(400) e qualquer código entre HttpStatusCode.InternalServerError (500) e 600.

> **Field**: value\[].callCountOther\
> **Type**: `interger`
>
> Número de outras chamadas.

> **Field**: value\[].callCountSuccess\
> **Type**: `interger`
>
> Número de chamadas bem-sucedidas. Isso inclui chamadas que retornam HttpStatusCode <= 301 e HttpStatusCode.NotModified e HttpStatusCode.TemporaryRedirect.

> **Field**: value\[].callCountTotal\
> **Type**: `interger`
>
> Número total de chamadas.

> **Field**: value\[].country\
> **Type**: `string`
>
> País ao qual os dados deste registro estão relacionados.

> **Field**: value\[].interval\
> **Type**: `string`
>
> Duração do período de agregação. O intervalo deve ser múltiplo de 15 minutos e não pode ser zero. O valor deve estar no formato ISO 8601.
>
> (<http://en.wikipedia.org/wiki/ISO_8601#Durations>).

> **Field**: value\[].name\
> **Type**: `string`
>
> O nome, dependendo do endpoint do relatório, especifica o nome do produto, API, operação ou desenvolvedor.

> **Field**: value\[].operationId\
> **Type**: `string`
>
> Caminho do identificador de operação - /apis/{apiId}/operations/{operationId}.

> **Field**: value\[].productId\
> **Type**: `string`
>
> Caminho do identificador do produto - /products/{productId}.

> **Field**: value\[].region\
> **Type**: `string`
>
> Região do país à qual esses dados de registro estão relacionados.

> **Field**: value\[].serviceTimeAvg\
> **Type**: `number`
>
> Tempo médio que levou para processar a solicitação no backend.

> **Field**: value\[].serviceTimeMax\
> **Type**: `number`
>
> Tempo máximo que levou para processar a solicitação no backend.

> **Field**: value\[].serviceTimeMin\
> **Type**: `number`
>
> Tempo minimo que levou para processar a solicitação no backend.

> **Field**: value\[].subscriptionId\
> **Type**: `string`
>
> Caminho do identificador de assinatura - /subscriptions/{subscriptionId}.

> **Field**: value\[].timestamp\
> **Type**: `string`
>
> Início do período de agregação. A data segue o seguinte formato: aaaa-MM-ddTHH:mm:ssZ conforme especificado pelo padrão ISO 8601.

> **Field**: value\[].userId\
> **Type**: `string`
>
> Caminho do identificador do usuário - /users/{userId}.

> **Field**: value\[].zip\
> **Type**: `string`
>
> Código postal ao qual os dados deste registro estão relacionados.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://ffdesenvolvedores.gitbook.io/ff-desenvolvedores/metricas.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
