Skip to content

Monitoring Generated Services

Use logging and metrics to monitor your generated OData service.

Logging

For simple logging configuration with good log readability of logs, see the "-console:log", "-log:debug" and "-log:trace" options.

If the -console:log option is not used, the generated main servlet class declares an SLF4J application logger.

See SLF4J for more details.

  • The application's logger name is odata.server.

  • Configure the logger with the DEBUG log level to get basic request and response information (URL and status).

  • Configure the logger with the TRACE log level to get detailed request and response content (headers and payload).

Caution

Using the TRACE log level, and to a lesser extent the DEBUG log level, may result in personal or sensitive information being included in the application server-side log files. It may also result in performance issues, or out-of-disk-space conditions. Once your application is tested and ready for production, you may need to use a reduced log level (such as INFO, WARN, or ERROR) to ensure compliance with the EU General Data Protection Regulation or other applicable regulations. If you temporarily enable logging for diagnostic purposes in a system that stores sensitive or personal information, regulations may dictate that you retain the log files only for the minimum period required for the purposes of such diagnostic activities. Transmitting log files outside the administrative boundaries of the regulations (for example for technical support purposes) might be prohibited.

Logging for SAP Business Technology Platform – Cloud Foundry

Note

Using the -log:console option is simpler than configuring SLF4J, so may be appropriate for basic testing (or even for temporary usage in production deployments).

The remainder of this section assumes that you have installed the Cloud Foundry command-line tools. You can also view the logs from the SAP Business Technology Platform Cockpit.

To set up SLF4J for monitoring for your generated OData service:

  1. By default, the generated manifest.yml enables the INFO log level. Change the log level to DEBUG or TRACE as required, then rebuild and redeploy the application.

  2. Test your application, then use the cf logs command to download logs as required:

    • Download recent logs for your application using: cf logs --recent myapp

    • Stream logs as they are produced using: cf logs myapp

  3. See Application Logging for the Cloud Foundry Environment for further details.

Logging for SAP Business Technology Platform – Neo Environment

Note

Using the -log:console option is simpler than configuring SLF4J, so may be appropriate for basic testing or even for temporary usage in production deployments.

To set up SLF4J for monitoring your generated OData service:

  1. In the cockpit, after selecting your account, select Applications > Java Applications, then select your application name.

  2. Select Logging > Configure Loggers.

  3. Enter sap.xs as the Filter, and change the log level to DEBUG or TRACE as required.

  4. Enter odata.service as the Filter, and change the log level to DEBUG or TRACE as required.

  5. Test your application. Then use the SAP Business Technology Platform Cockpit to download trace files as required.

  6. See Logging for the Neo Environment for further details.

Metrics

The generated OData service includes an embedded metrics OData service for use by administrators.

Metrics are collected and aggregated according to the SAVE_METRICS_EVERY_PERIOD parameter in the generated metric settings class, which is one hour by default. The accepted values for this parameter are: 1 day (for example, P1D), N hours where 24 mod N = 0 (for example, PT1H), or N minutes where 60 mod N = 0 (for example, PT5M). Metrics are automatically retained in accordance with the RETAIN_METRICS_FOR_PERIOD parameter, which is seven days by default. Newly collected metrics are available only at the end of each aggregation period, for example at the end of each hour.

To access metrics, append /admin/metrics to the main service root URL, followed by one of these read-only entity sets: history, recent, or last. For example, if you deployed a test application (in either a Cloud Foundry or Neo environment), and wanted to collect metrics for it, you'd use the following URLs:

  • https://insert-your-local-host-info-here.hana.ondemand.com/admin/metrics/history – all available metrics that have not yet been deleted according to the retainMetricsFor parameter.

  • https://insert-your-local-host-info-here.hana.ondemand.com/admin/metrics/recent – metrics for the last five completed aggregation periods.

  • https://insert-your-local-host-info-here.hana.ondemand.com/admin/metrics/last – metrics for the last completed aggregation period.

Use regular OData URL conventions to filter or select metrics.

You can look at metrics in HTML format using a browser client, or by appending ?$format=html to the URL. This allows you to conveniently access the metrics via HTML import into spreadsheet software.

Note

Metrics are primarily provided for SQL database operations and back-end system interactions; when you are using the in-memory database (-imdb option), there may be no metrics available.


Last update: July 11, 2022