Configuring Services
Without explicit configuration all monitored requests are assigned to the service app
, which is
also the default service being shown in the project overview inside Tideways
and in the weekly report e-mail and history.
Until September 2022 the default service name was web .
|
To start collecting data with a different service name, you can use one of three different configuration mechanisms to set different services names.
The service name can contain alphanumeric characters, a dash or underscore. It must not contain spaces or other non alphanumeric characters or it will be rejected.
Services are created automatically in Tideways backend as soon as they collecet data.
Sending Data for Services
ini-Configuration
Inside your tideways.ini
, php.ini
or webserver ini directives you can set
the variable:
tideways.service=myservice1
Environment Variable
In environment variables passed to PHP you can set:
TIDEWAYS_SERVICE=myservice1
Configuration in Code
Programmatically in your PHP code you can set the service at runtime:
<?php
if (class_exists('Tideways\Profiler')) {
\Tideways\Profiler::setServiceName('myservice1');
}
Of if you are starting Tideways from within your PHP code you can set it as well:
<?php
if (class_exists('Tideways\Profiler')) {
\Tideways\Profiler::start(array('api_key' => 'XYZ', 'service' => 'myservice1'));
}
Automatic Service Detection
For a few off-the-shelf PHP applications, Tideways provides automatic service detection to separate frontend users from backend/API traffic.
The following applications have automatic service detection. All other requests will record to the default service of the project unless configured otherwise.
Application/Framework |
Automatic Service |
Description |
Since |
Shopware 6 |
|
All requests to REST API and Admin API |
5.0+ |
Spryker |
|
All requests to the "Glue" application |
5.0+ |
Shopware 5 |
|
All requests to Backend controllers (ExtJS) |
5.6+ |
Magento 2 |
|
All requests going to the Magento 2 backend |
5.6+ |
Automatic service detection has the lowest priority, setting the service name explicitly will always override the automatic service detection.
You can disable automatic service detection by setting the PHP.ini setting
tideways.features.automatic_service_detection=0
.
Mark for web context
When Tideways runs in the "CLI" SAPI, then each collected trace is automatically suffixed with the subservice name ":cli" and assigned to the CLI context of this service.
If you are running an application server for PHP such as RoadRunner, Swoole, ReactPHP, Laravel Octane then web-requests are served from the CLI SAPI and you need to mark them as web request explicitly:
<?php
if (class_exists('Tideways\Profiler')) {
\Tideways\Profiler::markAsWebTransaction();
}
Mark for CLI context
If you are running cronjobs through the web, for example by performing a background AJAX call then these requests are considered regular "web" context requests, even though they might be long running and not affecting user performance visibly.
You can mark these requests to be considered part of the CLI context of a service by calling a method during the request execution:
<?php
if (class_exists('Tideways\Profiler')) {
\Tideways\Profiler::markAsCliTransaction();
}
Default Service
Every project has a default service that is the first service shown when viewing the project. Absent further configuration only the default service is included in the weekly report.
The first service reporting data to a Tideways project is automatically
selected to be the default service. If none is configured this is app
.
You can change the default service and weekly report inclusion in the Project Settings.
Deactivate Service
To deactivate a service, click "Deactivate Service" in the options menu on the far right of each service row in the settings screen. You will be redireted to a confirmation dialog that explains the consequences of service deactivation.
Only active services are reporting monitoring data, traces and errors back to Tideways. The number of services is limited by the application license. You can deactivate services to free up space for activating other services.
After 45 days this service gets deleted automatically when it does not record data anymore.
Service Limits
Your plan and project license determines how many services you can use with a project. You can look up the limit on the "Project Settings ⇒ Services" screen and on the pricing page.
When your project reports more than the allowed limit of services, then the excess services data will be discarded and the service is marked as inactive on the "Services" settings screen. This can also happen if you downgrade a project from a higher license to a lower license.