Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified docs/images/synthetics/cert-authority.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/synthetics/cert-expiry2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/synthetics/http-add-new-monitor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/synthetics/ssl-check-type.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 11 additions & 13 deletions docs/synthetics/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,22 @@ To start monitoring your website or API, create a Sematext Cloud account in eith
* [Click here](https://apps.sematext.com/ui/synthetics-create/app/Synthetics) to create the App in the US data center; or
* [Click here](https://apps.eu.sematext.com/ui/synthetics-create/app/Synthetics) to create the App in the EU data center

You should see the form below:
## Create a Synthetics App

- Enter a name for your Synthetics App. Using the domain or API endpoint you want to monitor works well here.
- After naming your App, choose the type of monitor you want to create.

<img
class="content-modal-image"
alt="Create Synthetics App Form"
src="/docs/images/synthetics/create-app.png"
title="Create Synthetics App Form"
alt="Choose Monitor Type - HTTP or Browser"
src="/docs/images/synthetics/create-first-monitor.png"
title="Choose Monitor Type - HTTP or Browser"
/>

### HTTP Monitor

* Fill in the App Name, usually the domain or API Endpoint will work great for this purpose
* Enter the emails of your team members so that they're invited to the App if they don't have access to your account
The [HTTP monitor](/docs/synthetics/http-monitor/) sends a single HTTP request to the specified URL and records the response — status code, headers, body, and timing metrics. Use it to monitor APIs, endpoints, or any URL where you want to verify availability and response correctness.

After clicking Continue you will be taken to the next screen where you can create your first Synthetic monitor by clicking the **New Monitor** button in the top right corner of the page. You can then choose between creating an HTTP monitor and a Browser monitor, as shown in the screenshot below.
### Browser Monitor

<img
class="content-modal-image"
alt="Create First Monitor"
src="/docs/images/synthetics/create-first-monitor.png"
title="Create First Monitor"
/>
The [Browser monitor](/docs/synthetics/browser-monitor/) loads a URL or executes a script in a real Chrome browser. It records performance metrics, screenshots, and Web Vitals. Use it to monitor web pages or simulate user journeys across multiple pages.
8 changes: 5 additions & 3 deletions docs/synthetics/http-monitor.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ The HTTP monitor sends a single HTTP request with its configured request setting
* **Locations** - List of locations to run the monitor.
* **[Scheduled Monitor Pauses](/docs/synthetics/scheduled-pauses/)** - Specify one or more time periods a monitor should be paused

### Request Settings
### Advanced Settings

#### Request Settings

* **Authentication** - Fetch token for each run and pass it in your API requests, or pass username and password to connect to your protected APIs.
* **Headers** - List of HTTP headers to be sent.
Expand All @@ -35,7 +37,7 @@ By default, the HTTP monitor adds the headers below for all requests sent from t
| `x-sematext-synthetics-id` | `<run-id>` | Uniquely identifies this request. Can be used for tracing and correlation in the back end. |


### Response Settings
#### Response Settings

* **Save Response Body** - Disable this option to prevent response body from being saved at runtime. This can be helpful to ensure no sensitive data gets featured in your test results.

Expand All @@ -62,7 +64,7 @@ To monitor pages protected by some form of authentication each monitor can be co

You can **dynamically fetch a token** for each run with token support and pass that token in your API requests.

When creating an HTTP monitor, navigate to the Authentication tab and select **Bearer/Access Token** authentication option.
When creating an HTTP monitor, expand the **Show Advanced Settings** and navigate to the Authentication tab and select **Bearer/Access Token** authentication option.

![Access Token Authentication](/docs/images/synthetics/authentication-token.png)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
title: Expose Trace ID in Response Headers
description: Expose your active trace ID in HTTP response headers so Sematext Synthetics can correlate failed monitor runs with the exact matching logs and traces.

When Sematext Synthetics runs a monitor and the request fails, it checks the response headers for a trace ID. If one is present, it uses it to filter logs and traces to that exact request. Without it, correlation falls back to URL and time window matching, which may include data from unrelated requests.

Adding a trace ID to your response headers is a small, one-time change to your application. The trace ID comes from your existing OpenTelemetry instrumentation — no additional setup is required.

## Prerequisites

Your service must already be instrumented with OpenTelemetry and shipping traces to a Sematext Tracing App. If you haven't set that up yet, see [Getting Started with Tracing](/docs/tracing/getting-started/) and the [OpenTelemetry SDKs](/docs/tracing/sdks/) documentation.

For complete working examples, see the [sematext-opentelemetry-examples](https://github.com/sematext/sematext-opentelemetry-examples) repository.

## Java / Spring Boot
Comment thread
fulyauluturk marked this conversation as resolved.

Add a servlet filter that reads the active span context from the OTel agent and writes the trace ID to the response headers before the request is processed.

```java
import io.opentelemetry.api.trace.Span;
import io.opentelemetry.api.trace.SpanContext;
import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import org.springframework.web.filter.OncePerRequestFilter;

import java.io.IOException;

@Component
@Order(Ordered.LOWEST_PRECEDENCE - 10)
public class TraceIdFilter extends OncePerRequestFilter {

@Override
protected boolean shouldNotFilter(HttpServletRequest request) {
return "/error".equals(request.getRequestURI());
}

@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
throws ServletException, IOException {

SpanContext ctx = Span.current().getSpanContext();
if (ctx.isValid()) {
response.setHeader("X-Trace-Id", ctx.getTraceId());
}

chain.doFilter(request, response);
}
}
```

The OTel Java agent creates the span at the Tomcat connector level, above the filter chain, so `Span.current()` is already valid when the filter runs. Headers must be set before `chain.doFilter()` is called because the response is committed after that point. No additional dependency is needed beyond the OTel API, which is already on the classpath when using the Java agent.

## Node.js / Express

Add a middleware that runs on every request and sets the trace ID header using the OTel API.

```js
const { trace } = require('@opentelemetry/api');

app.use((req, res, next) => {
const span = trace.getActiveSpan();
if (span) {
res.setHeader('X-Trace-Id', span.spanContext().traceId);
}
next();
});
```

Register this middleware early in your Express app, before your route handlers.

## Python / Flask

Use Flask's `after_request` hook to add the trace ID to every response.

```python
from opentelemetry import trace

@app.after_request
def add_trace_id(response):
span = trace.get_current_span()
ctx = span.get_span_context()
if ctx.is_valid:
response.headers['X-Trace-Id'] = format(ctx.trace_id, '032x')
return response
```

## Verifying It Works

How you verify the header depends on the Synthetics Monitor type.

**HTTP Monitor** — open the monitor's run details and check the **Request** tab. You should see the `X-Trace-Id` header in the response headers section.

**Browser Monitor** — open the monitor's run details and go to the **Waterfall** view. Click on the URL you instrumented, then open its **Request** tab to inspect the response headers for that specific request.

![Trace ID in Response Headers](/docs/images/synthetics/root-cause-discovery/trace-id-response-header.png)

Once Sematext detects the trace ID, the Logs and Traces tabs in the Troubleshoot section will let you drill into the exact logs and the individual trace associated with the failed monitor run. Without trace ID, logs and traces will be filtered by the URL and time window, which could include logs and traces from other requests as well.

## Further Reading

- [Logs Correlation](/docs/synthetics/root-cause-discovery/logs-correlation/)
- [Traces Correlation](/docs/synthetics/root-cause-discovery/traces-correlation/)
- [OpenTelemetry SDKs](/docs/tracing/sdks/)
- [Sematext OpenTelemetry Examples](https://github.com/sematext/sematext-opentelemetry-examples)
- [Getting Started with Tracing](/docs/tracing/getting-started/)
40 changes: 40 additions & 0 deletions docs/synthetics/root-cause-discovery/logs-correlation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
title: Logs Correlation
description: Correlate failed Synthetics monitor runs with application and service logs.

The Logs tab in the failed run flyout finds logs from [connected](/docs/guide/connected-apps/) Logs Apps that match the failed request. Depending on your setup, logs are matched by exact trace ID or by URL and time window.

## Connecting a Logs App

If you don't have a Logs App, the Logs section in the Troubleshoot tab will prompt you to create one and connect it to your Synthetics App automatically. If you already have Logs Apps in your account, you can select and connect the relevant one directly from the same tab.

We recommend using the [OpenTelemetry Logs integration](/docs/integration/opentelemetry-logs/) for two reasons: if you expose your trace ID in response headers, Sematext can filter logs to the exact failing request; and even without a trace ID, OTel logs are structured and enriched, making it easier to spot errors and correlate across services. The [Sematext OpenTelemetry Examples](https://github.com/sematext/sematext-opentelemetry-examples) repo includes log shipping examples alongside the tracing and metrics setup.

If Sematext detects a known service on the monitored host, such as [Nginx](/docs/integration/nginx-integration/) or [Apache](/docs/integration/apache-integration/), it will also suggest creating a service-specific Logs App. These come with out-of-the-box dashboards and alerts tailored to that service. Connecting both gives you application-level events from OTel logs and infrastructure-level events from the service logs in one place.

## How Logs Are Matched

### With a Trace ID

This applies to **OpenTelemetry Logs Apps** and is the recommended way to correlate logs. If your backend includes the active trace ID in its HTTP response headers, Sematext reads it from the monitor run result and uses it to filter logs to that exact request. See [Expose Trace ID in Response Headers](/docs/synthetics/root-cause-discovery/adding-trace-id-to-response-headers/) to set this up.

![Logs Tab - Matched by Trace ID](/docs/images/synthetics/root-cause-discovery/logs-trace-match.png)

This eliminates noise from unrelated requests that happened around the same time and takes you directly to the logs for the specific request that triggered the monitor failure.

### Without a Trace ID

If your backend does not include a trace ID in its response headers, logs are matched by the monitored URL and the time window around the failure. The tab shows the number of matching logs — open them in a new tab by clicking the Logs App link.

![Logs Tab - Matched by URL and Time Window](/docs/images/synthetics/root-cause-discovery/logs-url-match.png)

## Exploring Logs

Once you open the Logs App from this tab, filters are applied automatically — the URL and time range, or the trace ID if available.

## Further Reading

- [Expose Trace ID in Response Headers](/docs/synthetics/root-cause-discovery/adding-trace-id-to-response-headers/)
- [OpenTelemetry Logs integration](/docs/integration/opentelemetry-logs/)
- [OpenTelemetry SDKs](/docs/tracing/sdks/)
- [Logs Discovery](/docs/logs/discovery/intro/)
- [Context View](/docs/logs/context-view/)
33 changes: 33 additions & 0 deletions docs/synthetics/root-cause-discovery/metrics-correlation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
title: Metrics Correlation
description: Correlate failed Synthetics monitor runs with infrastructure and service metrics.

The Metrics tab in the failed run flyout lists all Monitoring Apps [connected](/docs/guide/connected-apps/) to your Synthetics App. It gives you a direct path to the metrics of the services hosting your monitored endpoint, scoped to the time of the failure.

## Connecting a Monitoring App

If you don't have a Monitoring App yet, the Metrics section in the Troubleshoot tab will prompt you to create one and connect it to your Synthetics App automatically. If you already have Monitoring Apps in your account, you can select and connect the relevant one directly from the same tab.

We recommend using the [OpenTelemetry Metrics integration](/docs/integration/opentelemetry-monitoring/) — it produces structured, enriched telemetry that correlates well across signals and gives you more context when investigating failures.

If Sematext detects a known service on the monitored host, such as [Nginx](/docs/integration/nginx-integration/) or [Apache](/docs/integration/apache-integration/), it will also suggest creating a service-specific Monitoring App. These come with out-of-the-box dashboards and alerts tailored to that service, so you can start monitoring what matters immediately after installing the [Sematext Agent](/docs/agents/sematext-agent/) on your host.

## Using the Metrics Tab

Once a Monitoring App is connected, it appears in the Metrics tab when a monitor run fails.

![Metrics Tab - Connected Monitoring Apps](/docs/images/synthetics/root-cause-discovery/metrics-tab.png)

Click the App name to open it in a new tab. The Monitoring App opens with the time range pre-set to around the time of the failure. From there, check for anomalies that coincide with the failure:

- CPU and memory spikes
- Elevated error rates or dropped request counts
- Database connection pool exhaustion or high query latency
- Network throughput drops

## Further Reading

- [Monitoring overview](/docs/monitoring/)
- [OpenTelemetry Metrics integration](/docs/integration/opentelemetry-monitoring/)
- [Nginx integration](/docs/integration/nginx-integration/)
- [Apache integration](/docs/integration/apache-integration/)
- [Available integrations](/docs/integration/)
Loading