You are viewing the documentation for Blueriq 15. Documentation for other versions is available in our documentation directory.

Since Blueriq 14.6, the Timeline DAO, which used to be included in the Trace SQL Store Component, has been split to a separate component. See Timeline SQL Store component for details.



Table of contents 

Description

This Trace SQL Store Component contains a Trace DAO implementation that can be used by the trace engine to store trace messages in a database.

Blueriq 14.8 introduced the possibility to consume trace events that are pushed on a queue by the Trace Event Publisher Component and then store them in a database in an asynchronous way. See consume trace events.

Requirements

This component persists data in a database, that must be provided. See platform support for the supported databases.

Optional: the consumer functionality needs to be able to access a queue. Currently only RabbitMQ is supported. For setting this up see Configuration of RabbitMQ for Customerdata service and Trace Event Publisher.

Installation

In order to use this component, the trace-sql-store profile must be active. More information on how to configure the application using Spring Profiles can be found here: Component configuration with Spring Profiles.

This component will only write trace message to the database and not timeline messages. See Timeline SQL Store component for writing timeline messages to a separate database.

Add the artifact with groupId "com.blueriq" and artifactId "blueriq-component-trace-sql-store" as a dependency to your Blueriq runtime POM file if you want to depend on it.

Configuration

Database

Scripts to create the required database content are provided for the following databases:

  • SQL Server
  • Oracle
  • H2 (we do not recommend using a H2 database in production environments)


For customers that are upgrading an existing version of Blueriq, database upgrade scripts are provided in the Upgrade instructions when applicable.

Please make sure the trace-sql-store has a separate datasource. Using the same datasource for other components is known to cause errors.


Use the following steps to configure the datasource:

  1. If necessary, create a new datasource. See Configuring JDBC database drivers for information on how to do this.
  2. Trace SQL Store component is using the trace-sql-store datasource to store data. The trace-sql-store datasource can be configured using JDBC or JNDI.
    1. Using JDBC datasource : this can be configured in the application-externaldatasources.properties file. When configuring external datasources, the externaldatasources profile should be enabled.

      application-externaldatasources.properties
      blueriq.datasource.trace-sql-store.url=jdbc:sqlserver://<database_url>:<port>;databaseName=bq_comments;instance=SQL_EXPRESS
      blueriq.datasource.trace-sql-store.username=<username>
      blueriq.datasource.trace-sql-store.password=<password>
      blueriq.datasource.trace-sql-store.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
      blueriq.hibernate.trace-sql-store.hbm2ddl.auto=validate
      blueriq.hibernate.trace-sql-store.dialect=org.hibernate.dialect.SQLServer2012Dialect
    2. Using JNDI datasource : this can be configured in the application-jndidatasources.properties file. When configuring JNDI datasources the jndidatasources profile should be enabled.

      application-jndidatasources.properties
      blueriq.datasource.trace-sql-store.jndiName=java:/comp/env/jdbc/blueriqTrace
      blueriq.hibernate.trace-sql-store.hbm2ddl.auto=validate
      blueriq.hibernate.trace-sql-store.dialect=org.hibernate.dialect.SQLServer2012Dialect
  3. Configuring the datasource from the Development Dashboard
    Go to Settings Widget → Datasources tab → On the left side menu : select trace-sql-store datasource. The same properties are available for configuration as from the properties file. Make sure the corresponding profile is enabled (externaldatasources or jndidatasources)
  4. Hibernate settings
    These settings apply to each datasource type in the corresponding properties file, as in the examples above.

Supported dialects:

  • org.hibernate.dialect.SQLServer2012Dialect (for SQL Server)
  • org.hibernate.dialect.Oracle12cDialect (for Oracle)
  • org.hibernate.dialect.H2Dialect (for H2) (we do not recommend using a H2 database in production environments)

Supported hbm2ddl.auto values:

  • validate

Consume trace events

The Trace SQL Store component can store trace messages directly in the database, but it is also possible to decouple the storage of trace messages using the Trace Event Publisher Component to publish trace events to a queue and then consume them using this component.

To be able to consume event messages, the event channel needs to be configured in the application.properties. This file can be found, or otherwise should be placed in the

spring.config.additional-location

The Trace SQL Store either stores trace messages in the database, or consumes trace events from the queue. When the configuration below is enabled, only trace events are consumed, no trace messages are saved to the database directly. So if you enable this configuration, be sure to also enable the Trace Event Publisher Component, otherwise no trace information is saved anywhere.

# RabbitMQ configuration
blueriq.trace.event.listener.amqp.rabbitmq.host=localhost
blueriq.trace.event.listener.amqp.rabbitmq.port=5672
blueriq.trace.event.listener.amqp.rabbitmq.virtualHost=/
blueriq.trace.event.listener.amqp.rabbitmq.username=guest
blueriq.trace.event.listener.amqp.rabbitmq.password=guest
blueriq.trace.event.listener.amqp.rabbitmq.queueNames=trace

blueriq.trace.event.listener.amqp.concurrency.max-concurrent-consumers=1
blueriq.trace.event.listener.amqp.concurrency.concurrent-consumers=1

# Enable consumer functionality
blueriq.trace.event.listener.amqp.enabled=true

In certain circumstances it is possible that an error happens while consuming the trace event. Because of the workings of RabbitMQ, this will result in an endless loop where it tries to re-send the trace event until it is correctly consumed. To prevent this, a republish mechanism is added with Blueriq 15.7. This mechanism sends trace events to a dead-letter-queue when an error occurs. This will prevent the creation of the endless loop. For information see Configuring RabbitMQ

For more information on concurrent consumers see Configuring RabbitMQ.

Enable TLS connection

To enable a secure (TLS) AMQP connection to the queue, set the property "blueriq.trace.event.listener.amqp.rabbitmq.ssl.enabled" to "true".
The default for AQMP port with TLS on RabbitMQ is '5671', it needs to be explicitly enabled though, see https://www.rabbitmq.com/ssl.html for more information.

Performance

The performance impact of the Trace SQL Store is minimal when used normally: to write trace messages to the database.

It is also possible to use the Trace SQL Store to query the trace engine database, like the timeline container does. The Trace SQL Store offers good performance as long as the result set is limited. For large scale analysis, when summaries or aggregates are desired, the Trace SQL Store is not recommended because it is primarily designed to return a list of trace entries. For these scenarios it is recommended to use SQL (or HQL) to query the database.