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 application 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 an application to differentiate between different types of users. Depending on the purpose of your application, 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 an application 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 application 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.

Defaults

All web-facing SAPIs (Apache, PHP-FPM, PHP-CGI) and the CLI SAPI, have two default services: cli and web.

Configuration

By default all monitored requests are assigned to the service web, which is also the default service being shown in the application 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 application dashboard (which you can see highlighted in the screenshot below).

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

The service "web" for user-facing traffic

Currently there is a limitation that user facing traffic should all be in the default service named "web". This is the default service shown to you when clicking on the application and it is currently the service that is used for computing the historical data.

Service Limits

It depends on your plan and application license how many services you can use with an application. You can look up the limit on the "Application Settings ⇒ Services" screen and on the pricing page.

When your application 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 an application from a higher license to a lower license.

Still need help? Email [email protected]