Loading…
Loading…
Explains how the Synthetic Monitor Service automatically probes SOAP backend endpoints to check for availability and correctness. Covers configuration
The Synthetic Monitor Service is an automated background process that executes synthetic monitoring checks against configured SOAP backend services. It periodically sends pre-defined SOAP requests to backend endpoints to verify their availability, correctness, and performance.
This service operates in a multi-tenant environment, ensuring that monitoring jobs for one tenant are isolated and do not interfere with others. The main entry point, runEvaluation, identifies all tenants with enabled monitors and executes the checks for each one independently.
The service reads monitor configurations from the s2r_service_synthetic_monitor table, fetches credentials and mTLS settings from the associated s2r_backend_profile, executes the HTTP request, and records detailed results in the s2r_backend_test_preview table. It also updates the status of the monitor configuration with the outcome of the run.
The synthetic monitoring process runs in a series of steps, starting with a top-level evaluation run that iterates through all applicable tenants and their configured monitors.
flowchart TD
subgraph Synthetic Monitor Job
A[Start: runEvaluation] --> B{Get tenants with<br>enabled monitors};
B --> C{For each tenant...};
C --> D[Run as tenant];
end
subgraph Tenant-Specific Evaluation
direction TD
D --> E{Find enabled monitors<br>for the tenant};
E --> F{For each monitor...};
F --> G{Is service 'active'?};
G -- No --> H[Skip];
G -- Yes --> I{Is monitor due to run?};
I -- No --> H;
I -- Yes --> J[Execute Check];
end
subgraph Check Execution
direction TD
J --> K[Perform credential safety check];
K -- Mismatch --> L[Fail: Withhold credentials];
K -- Match --> M{Resolve auth & mTLS};
M --> N[Send HTTP POST to endpoint];
N --> O{Retry on failure?};
O -- Yes --> N;
O -- No --> P{Process result};
end
subgraph Result Recording
direction TD
P --> Q[Record execution in<br>preview log];
Q --> R[Update monitor's<br>last-run status];
R --> S[Add to job summary];
end
S --> T{...next monitor};
F -.-> T;
T --> F;
H --> T;
L --> P;
subgraph Final Summary
direction TD
U[Aggregate results<br>from all tenants] --> V[Return job summary];
end
C -- All tenants processed --> U;The runEvaluation method begins by querying the s2r_service_synthetic_monitor table for all distinct tenant IDs that have at least one monitor with enabled = true. This ensures the job only considers tenants with active monitoring configurations.
For each tenant identified, the service executes the evaluateBoundTenant method within that tenant's security context. This guarantees that all database queries for monitor configurations, credentials, and result persistence are correctly scoped to the specific tenant. A failure during one tenant's evaluation is logged (S2R-TENANT-JOB-FAIL) and does not stop the process for other tenants.
Within a tenant's context, the service fetches all enabled synthetic monitor configurations. For each monitor, it performs two checks before execution:
active. Monitors for services in other states are skipped.dueState): The monitor must be due to run. A monitor is considered due if either of the following conditions is met:
last_run_at exceeds the schedule_hours interval.last_api_usage_at and the monitor's last_run_at both exceed the idle_after_hours interval.If a monitor is not due, it is skipped with the reason not_due.
If a monitor is due, the execute method is called:
endpoint_url stored on the monitor configuration matches the profile_endpoint_url from the associated backend profile (scheme, host, and port). If they do not match and the monitor requires credentials (via auth_type or mTLS), the execution is aborted to prevent sending secrets to an unintended destination.auth_type, credentials envelope, and mtls_enabled flag.endpoint_url. The request includes standard SOAP headers, any resolved Authorization or custom API key headers, and the configured SOAP payload.retry_count times, with a delay of retry_backoff_ms between each attempt.After execution, the results are persisted:
s2r_backend_test_preview table. This includes the request and response payloads, HTTP status, latency, and any error messages.s2r_service_synthetic_monitor table is updated with the last_run_at timestamp, last_status, and last_error_message. If the run was successful, last_success_at is also updated.Finally, the runEvaluation method returns a summary map containing aggregate counts of all checks performed across all tenants.
The service resolves authentication credentials from the credentials envelope stored in the backend profile associated with the monitor. The auth_type field on the monitor configuration dictates which authentication mode to use.
IMPORTANT
The auth_type field on the monitor configuration determines the authentication behavior. If auth_type is none or empty, no credentials will be sent, even if they are present in the backend profile.
The following auth_type values are supported:
auth_type | Description | Required Credential Fields |
|---|---|---|
none (or blank) | No authentication is performed. | — |
basic | HTTP Basic Authentication. | username, password |
bearer | Bearer Token Authentication. | bearerToken |
api_key_header | A custom header containing an API key. | apiKeyHeaderName, apiKeyValue |
oauth2_client_credentials | No-op. This is a consumer-facing auth mode and does not apply to backend probes. The monitor will send a request with no Authorization header. | — |
If an auth_type is specified but the corresponding fields are missing from the decrypted credentials envelope, the check will fail with an "auth failed" error.
To prevent accidental exposure of secrets, the service enforces a strict endpoint matching rule before attaching any credentials or mTLS certificates to a request.
This check is performed if mtls_enabled is true or if auth_type is anything other than none. The service compares the endpoint_url from the synthetic monitor configuration against the profile_endpoint_url from the associated backend profile.
If the scheme, host, or port of these two URLs do not match, the check is immediately failed, and no request is sent. The result will contain the following error message:
credentials withheld: the synthetic monitor endpoint differs from the backend profile endpoint (scheme, host or port). Save the synthetic monitor again so it uses the backend's current endpoint.
A S2R-WRK-SYNTH warning is also logged with the reason endpoint-mismatch.
WARNING
To resolve a "credentials withheld" error, you must edit and save the synthetic monitor configuration. This action updates the monitor's endpoint_url to match the current URL of the selected backend profile, ensuring they are in sync.
The behavior of each synthetic monitor is defined by fields in the s2r_service_synthetic_monitor table. The service uses the following fields during an evaluation run.
| Field | Type | Description |
|---|---|---|
enabled | boolean | If true, the monitor is eligible to be run by the service. |
endpoint_url | string | The target URL for the SOAP request. Must match the backend profile's URL to use credentials. |
auth_type | string | The authentication mode to use. See the Authentication section for details. |
schedule_hours | integer | The interval in hours at which to run the check. A null value disables scheduled runs. |
idle_after_hours | integer | The number of hours of API inactivity after which to run the check. A null value disables idle-based runs. |
connection_timeout_ms | integer | Timeout in milliseconds for establishing the HTTP connection. |
read_timeout_ms | integer | Timeout in milliseconds for waiting for data from the backend after a connection is established. |
retry_count | integer | The number of times to retry a failed request. A value of 0 means no retries. The total number of attempts is retry_count + 1. |
retry_backoff_ms | integer | The delay in milliseconds to wait between retry attempts. |
soap_request_template | string | The SOAP XML request body template. |
soap_action | string | The value for the SOAPAction HTTP header. |
soap_namespace | string | The source does not specify the usage of this field. |
backend_profile_id | UUID | Foreign key to the s2r_backend_profile containing credentials and mTLS settings. |
service_id | UUID | Foreign key to the s2r_service this monitor belongs to. |
operation_id | UUID | The source does not specify the usage of this field. |
sample_flavor | string | The source does not specify the usage of this field. |
sample_overrides | JSON | The source does not specify the usage of this field. |
request_format | string | The source does not specify the usage of this field. |
request_payload | string | The source does not specify the usage of this field. |
The following fields from the associated s2r_backend_profile are also used:
| Field | Type | Description |
|---|---|---|
credentials | string (encrypted) | The encrypted JSON envelope containing secrets for authentication modes like basic, bearer, and api_key_header. |
mtls_enabled | boolean | If true, the service will use the mTLS certificate from the profile's credentials envelope to establish the connection. |
endpoint_url | string | The canonical endpoint URL for the backend profile. Used for the credential safety check. |
The runEvaluation method returns a JSON object that summarizes the results of the entire job across all tenants.
{
"status": "DONE",
"evaluatedServices": 15,
"executedChecks": 10,
"successfulChecks": 8,
"failedChecks": 2,
"results": [
{
"serviceId": "a1b2c3d4-e5f6-7890-1234-567890abcdef",
"serviceKey": "my-service",
"environment": "production",
"operationId": null,
"status": "ok",
"reason": "scheduled",
"httpStatus": 200,
"errorMessage": null
},
{
"serviceId": "b2c3d4e5-f6a7-8901-2345-67890abcdef0",
"serviceKey": "another-service",
"environment": "production",
"operationId": null,
"status": "failed",
"reason": "idle",
"httpStatus": 503,
"errorMessage": "backend returned HTTP 503"
},
{
"serviceId": "c3d4e5f6-a7b8-9012-3456-7890abcdef01",
"serviceKey": "inactive-service",
"environment": "staging",
"operationId": null,
"status": "skipped",
"reason": "not_due",
"httpStatus": null,
"errorMessage": null
}
],
"time": "2023-10-27T10:00:00.123456789Z"
}
For each executed check, a detailed record is inserted into the s2r_backend_test_preview table. These records contain the full request and response payloads (trimmed to 250,000 characters), latency, HTTP status, and other diagnostic information. These records are created with a test_type of synthetic-monitor.
| Error / Log Message | Condition | Meaning and Resolution |
|---|---|---|
credentials withheld: ... | The monitor's endpoint_url does not match the associated backend profile's profile_endpoint_url. | This is a security feature to prevent sending secrets to the wrong host. To fix this, edit and save the synthetic monitor configuration, which will sync its URL with the profile's current URL. |
auth failed: ... | The credentials envelope in the backend profile is missing fields required for the selected auth_type (e.g., username for basic auth). | The check fails because it cannot construct the authentication headers. Update the backend profile's credentials to include the required fields for the specified auth_type. |
unsupported auth_type: ... | The auth_type field on the monitor configuration contains a value that is not recognized by the service. | The check fails because the service does not know how to handle this authentication mode. Correct the auth_type to a supported value. |
S2R-TENANT-JOB-FAIL (in logs) | An unhandled exception occurred during the evaluation of all monitors for a single tenant. | The job will continue to process other tenants. The log message contains the tenant ID and error details. This typically indicates a misconfiguration or bug specific to that tenant's data. |
backend returned HTTP <status> | The backend service responded with a non-2xx HTTP status code. | The synthetic check failed because the backend indicated an error. Investigate the backend service logs for the cause of the error status. |
| General connection or read errors | The service could not connect to the backend endpoint or timed out while waiting for a response. | This indicates a network issue between the worker and the backend, or that the backend is down or too slow to respond. Check network connectivity and the health of the backend service. |