How to use TAGs efficiently with Datasentinel


DataSentinel uses the popular time-series database InfluxDB to store activity metrics for PostgreSQL instances. InfluxDB offers a feature that allows tags to be associated with measurements, allowing metrics to be indexed based on certain criteria.

A tag is made up of a key and a value. (Ex application=crm)

DataSentinel automatically creates some tags for each PostgreSQL instance.

Tag Description
pg_instance Concatenation of the server name and the instance name
pg_version PostgreSQL version
server Server name
database Database name, if any

Define your own tags

For example, you can specify the application to which the instance belongs or the environment or provider.
There are no restrictions on creating tags according to your needs.

Here is an example of tag association with an instance registration on a Datasentinel agent:

    "name": "crm", 
    "host": "pg-crm-2031",
    "port": 9342,
    "user": "datasentinel",
    "password": "password",
    "tags": "application=crm,environment=production,provider=azure,datacenter=lyon"

The GUI allows you to easily and efficiently navigate and use tags.
Additionally, you can use tags in your role-based access strategy for users.

To avoid any issues, it’s recommended to avoid using special characters in the keys and their values except for the underscore character

Sessions history module

When Datasentinel performs a sampling of active sessions (viewing pg_stat_activity), it automatically adds tags related to those sessions. (See Documentation)

Tag Description
application_name Application name, if any
client_host_name Server name or IP address
command_type SQL command type
process_id Process identifier
query_md5_id Identifier (MD5 value calculated by Datasentinel) of the running sql
user_name User name
wait_event Wait event (Ios wait, Lock, …) or running on CPU
wait_event_type Event type (CPU, IOS, ..)

PostgreSQL top consumers per provider

Tags: but what for?

Using tags allows you to easily filter a specific subset of instances based on certain criteria, such as environment, application, or any other custom tag.
This can be particularly useful when managing a large number of instances, as it allows you to quickly narrow down your focus and see only the instances that are relevant to your current task or analysis.

For example, if you have tagged all your production instances with the tag prod, you can easily filter for those instances and view their metrics or logs without being distracted by non-production instances.

PostgreSQL how to use filters

The Data analysis module in Datasentinel allows you to extract statistics by tags, providing a global view of activity.

For example, you can group the top consumers by a specific tag such as the provider.

PostgreSQL top consumers per provider

Consolidated workload

By using tags, it becomes possible to extract different statistics and gain a global view of the activity across multiple instances.
This can be useful for various purposes.
For example, it allows you to group the workload of multiple instances based on a particular tag.
This makes it easy to perform different types of analysis and extract useful insights:

  • List the Top queries of several instances of the same application.
  • See the overall activity for instances of a server
  • Analyse the consolidated workload of your primary and replicated read-only instances
  • And so on…

All this in just a few clicks, thanks to tags

PostgreSQL consolidated workload

But that’s not all

Datasentinel offers a management of users (See Documentation)
The Role based access feature allows you to create roles based on the value of one or more tags.

Associating a role with a user makes it possible to limit access to all or part of a scope of your PostgreSQL instances.

For example:

  • Create a user with access only to development instances.


In conclusion, tags are a powerful feature offered by Datasentinel that enables users to easily filter, group, and analyze data based on certain criteria.
Tags can be used to categorize PostgreSQL instances, sessions, queries, and more, and can be customized according to the needs of the user.
With tags, it is possible to quickly analyze and understand the overall activity of instances across different dimensions, such as application, environment, provider, and more, making it a useful tool for monitoring and managing large-scale PostgreSQL deployments.

Additionally, tags can be leveraged in role-based access strategies to limit access to specific instances or groups of instances, adding an extra layer of security and control.

Overall, tags are a valuable feature that can help users optimize their PostgreSQL deployments and improve their overall management experience.

Stay connected!