Services

The services feature allows you to group transactions into different sets that belong together and get aggregated together in their own chart and overall response time.

When your project is a combination of multiple services combined with CLI scripts or workers running in different contexts, then having just one aggregated chart with just one response time can distort your view of the real picture. The response times, request numbers and error rates are aggregated by comparing apples with oranges.

How Services Work

Services allow for a project to differentiate between different types of users. Depending on the purpose of your project, this distinction may be helpful,_or it may be critical. This is because it’s only when the group of users is uniform (e.g., a shop’s end-users vs its backend administrators) is the aggregated data meaningful.

Why? When a project is composed of multiple services (such as micro services and different user types) combined with CLI scripts and workers running in different contexts, having just one aggregated chart can distort the perception of how the project is working. This is because the needs and timing of regular users are notably different from backend, administration-type, users.

If, for example the performance of backend transactions are slower than for regular users, that may be entirely acceptable. However, for regular users, slow transaction response times can mean the difference between a successful purchase and abandoning a cart for another online shop.

By aggregating them together, neither could be distinguished from the other. You couldn’t discern if the frontend response times were higher than they should be, or backend response times were unnaturally low. By using multiple services, the information stored becomes far more meaningful.

Special Services

When no explicit service is configured then metrics will be recorded on the web service for all web-facing SAPIs (Apache, PHP-FPM, PHP-CGI) and cli for all command line use.

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.

You can change the default service and weekly report inclusion in the Project Settings.

Configuration

Without explicit configuration all monitored requests are assigned to the service web, which is also the default service being shown in the project overview inside Tideways and in the weekly report e-mail and history.

To start collecting data with a different service name, you can use one of three different configuration mechanisms.

Inside your tideways.ini, php.ini or webserver ini directives you can set the variable:

tideways.service=myservice1

In environment variables passed to PHP you can set:

TIDEWAYS_SERVICE=myservice1

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'));
}

No other configuration is needed, service names are automatically registered with the Tideways backend and data gets aggregated accordingly. Once services in addition to web are reporting, the user interface automatically shows a dropdown for selection.

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.

Switching Between Services

You can switch between available services, using the Service Selector in the top left-hand corner of the project dashboard (which you can see highlighted in the screenshot below).

The Service Selector in the Tideways Project Dashboard
Figure 1. The Service Selector

Service Limits

It depends on your plan and project license 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.

Still need help? Email [email protected]