# Synthetic HTTP Testing + qryn

Synthetic testing holds a crucial role in the Observability toolbox, serving various purposes such as assessing application SLAs, tracking endpoint performance across diverse geographic regions, simulating user interactions with web applications, and proactively spotting post-deployment issues before they impact end-users.

As always, the Opentelemetry community leads by example and recently released **HTTP Check Receiver**, a vendor-agnostic toolset for their popular collector.

> In the [v0.63.0 release](https://github.com/open-telemetry/opentelemetry-collector/releases/tag/v0.63.0), the [OTel Collector](https://opentelemetry.io/docs/collector/) added support for synthetic HTTP checks via a receiver called the [HTTP Check Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/httpcheckreceiver). This component sends a request via HTTP or HTTPS and produces metrics to capture the duration of the request and record the returned status code. You can now deploy an agent to your preferred environment to test public OR private endpoints without the need to whitelist IPs in your firewall and transfer the tests between your preferred destination like any other piece of OTel data.

<div data-node-type="callout">
<div data-node-type="callout-emoji">💡</div>
<div data-node-type="callout-text"><em>Days like this make us extra proud of our polyglot compatibility! Let's use it!</em></div>
</div>

### HTTPCheck with qryn

If you already have an existing [qryn](https://qryn.dev) setup or a [qryn.cloud account](https://qryn.cloud), you can instantly leverage this receiver or add it to your existing open telemetry pipelines.

Here's an example recipe for sending collected ***httpcheck*** metrics to [qryn](https://github.com/metrico/qryn) using our *Clickhouse* [*otel-contrib*](https://github.com/metrico/otel-collector) *or* [*qryn.cloud*](https://qryn.cloud) *using built-in Prometheus remote\_write.*

### ClickHouse Exporter for qryn.dev

Here's how to use the HTTP Check with **qryn-otel** **ClickHouse** driver:

```yaml
receivers:
  httpcheck:
    targets:
      - endpoint: https://api.restful-api.dev/objects
        method: GET
      - endpoint: https://httpbin.org/delete
        method: DELETE
      - endpoint: https://httpbin.org/post
        method: POST
        headers:
          test-key: 'test-123'
    collection_interval: 10s

exporters:
  qryn:
    dsn: tcp://clickhouse-server:9000/cloki?username=default&password=*************
    timeout: 10s
    sending_queue:
      queue_size: 100
    retry_on_failure:
      enabled: true
      initial_interval: 5s
      max_interval: 30s
      max_elapsed_time: 300s
    logs:
       format: raw
processors:
  batch:

service:
  pipelines:
    metrics:
      receivers: [httpcheck]
      processors: [batch]
      exporters: [qryn]
```

### Prometheus Exporter for qryn.cloud

With [qryn.cloud](https://qryn.cloud) we can simply use the stock otel/opentelemetry-collector-contrib and a **Prometheus** *remote\_write exporter* pointed at your qryn.cloud endpoint:

```yaml
receivers:
  httpcheck:
    targets:
      - endpoint: https://api.restful-api.dev/objects
        method: GET
      - endpoint: https://httpbin.org/delete
        method: DELETE
      - endpoint: https://httpbin.org/post
        method: POST
        headers:
          test-key: 'test-123'
    collection_interval: 10s

exporters:
  prometheusremotewrite:
    endpoint: "https://qryn.gigapipe.com/api/v1/prom/remote/write"
    headers:
      X-API-Key: your-qryn-cloud-api-key
      X-API-Secret: your-qryn-cloud-api-secret
    resource_to_telemetry_conversion:
      enabled: true 

processors:
  batch:

service:
  pipelines:
    metrics:
      receivers: [httpcheck]
      processors: [batch]
      exporters: [prometheusremotewrite]
```

The **HTTPCheck receiver** generates the following metrics:

* <mark>httpcheck.duration</mark>
    
* <mark>httpcheck.status</mark>
    
* <mark>httpcheck.error</mark>
    

You can instantly browse data using the **qryn** *prometheus compatible* features:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1696627796957/53f54490-bbb3-4981-87f4-1d0adb37be93.png align="center")

[![](https://cdn.hashnode.com/res/hashnode/image/upload/v1696620389291/4a25b096-045f-4f73-bb87-cb7b56dd7d12.png align="center")](https://qryn.cloud)

> Here's a [full docker compose recipe](https://gist.github.com/lmangani/7e5d14e9470acdd262073dd2d17481a6) you can copy-paste into action

*That's it. Everything is simple when you don't have to worry about protocols!*

[![](https://cdn.hashnode.com/res/hashnode/image/upload/v1696621895077/69bd3e73-9060-4ceb-a00e-929503372652.png align="center")](https://qryn.cloud)
