<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>metrics Archives | Clever Cloud</title>
	<atom:link href="https://www.clever.cloud/blog/tag/metrics/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.clever.cloud/blog/tag/metrics/</link>
	<description>From Code to Product</description>
	<lastBuildDate>Thu, 05 Oct 2023 13:35:46 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://cdn.clever-cloud.com/uploads/2023/03/cropped-cropped-favicon-32x32.png</url>
	<title>metrics Archives | Clever Cloud</title>
	<link>https://www.clever.cloud/blog/tag/metrics/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How does Matomo work on Clever Cloud ?</title>
		<link>https://www.clever.cloud/blog/engineering/2023/08/21/how-does-matomo-work-on-clever-cloud/</link>
		
		<dc:creator><![CDATA[Julia March]]></dc:creator>
		<pubDate>Mon, 21 Aug 2023 08:37:50 +0000</pubDate>
				<category><![CDATA[Engineering]]></category>
		<category><![CDATA[Google Analytics]]></category>
		<category><![CDATA[matomo]]></category>
		<category><![CDATA[metrics]]></category>
		<category><![CDATA[self-hosted]]></category>
		<guid isPermaLink="false">https://www.clever-cloud.com/?p=8062</guid>

					<description><![CDATA[<p><img width="2800" height="1080" src="https://cdn.clever-cloud.com/uploads/2023/08/banner-matomo-5.png" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="banner matomo 5" decoding="async" fetchpriority="high" srcset="https://cdn.clever-cloud.com/uploads/2023/08/banner-matomo-5.png 2800w, https://cdn.clever-cloud.com/uploads/2023/08/banner-matomo-5-300x116.png 300w, https://cdn.clever-cloud.com/uploads/2023/08/banner-matomo-5-1024x395.png 1024w, https://cdn.clever-cloud.com/uploads/2023/08/banner-matomo-5-768x296.png 768w, https://cdn.clever-cloud.com/uploads/2023/08/banner-matomo-5-1536x592.png 1536w, https://cdn.clever-cloud.com/uploads/2023/08/banner-matomo-5-2048x790.png 2048w, https://cdn.clever-cloud.com/uploads/2023/08/banner-matomo-5-1368x528.png 1368w" sizes="(max-width: 2800px) 100vw, 2800px" /></p><!-- wp:paragraph -->
<p>In <a href="https://www.clever.cloud/blog/features/2022/05/16/how-and-why-to-install-matomo-to-replace-google-analytics/" target="_blank" rel="noopener">a previous post</a>, we explained why you should switch from Google Analytics to Matomo for your audience measurement. Some of our customers have decided to take this step, and Clever Cloud has helped them get to grips with the solution. Based on this experience, find out in this article how to maximize the use of our Matomo addon on Clever Cloud.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2 class="wp-block-heading">Selecting the optimal instance size</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>As soon as the Matomo addon is created, Clever Cloud deploys three optimized instances (a PHP runtime, a MySQL addon and a Redis addon). Initially, they are sized to the minimum server requirements in order to evolve according to your needs, thus ensuring cost optimization. If you need to make adjustments (for example, if you start to experience errors or slowdowns when launching some processes), our integrated Grafana is your best ally for monitoring your metrics and adjusting your resources accordingly.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3 class="wp-block-heading">Easy access to your metrics</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Thanks to the intuitive dashboard for each application, you're provided with a clear view of it all. We've <a href="https://www.clever.cloud/blog/features/2023/03/16/a-metric-tile-to-simplify-application-monitoring/" target="_blank" rel="noopener">recently integrated a metrics tile</a> into this dashboard, allowing you to track RAM and CPU consumption in real time from the console.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":8069,"sizeSlug":"medium","linkDestination":"none"} -->
<figure class="wp-block-image aligncenter size-medium"><img src="https://cdn.clever-cloud.com/uploads/2023/08/capture-decran-2023-08-17-a-16-33-06.png" alt="Tile metrics from app Overview panel indicating CPU and RAM usage." class="wp-image-8069"/></figure>
<!-- /wp:image -->

<!-- wp:spacer {"height":"34px"} -->
<div style="height:34px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->

<!-- wp:paragraph -->
<p>For a more in-depth analysis, a simple click on the Grafana logo from the tile gives you access to all your application's metrics. </p>
<!-- /wp:paragraph -->

<!-- wp:image {"id":8036,"width":493,"height":274,"sizeSlug":"large","linkDestination":"none"} -->
<figure class="wp-block-image size-large is-resized"><img src="https://cdn.clever-cloud.com/uploads/2023/07/capture-decran-2023-07-31-a-15-27-32.png" alt="Metrics dashboard on Grafana for Matomo PHP application" class="wp-image-8036" style="width:493px;height:274px" width="493" height="274"/></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>In addition, Matomo's PHP instance logs are always there to provide you with additional information. </p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3 class="wp-block-heading">All about auto-scalability</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Self-scalability on Clever Cloud is a major advantage, giving you peace of mind and flexible billing. With Matomo, this feature guarantees a smooth experience even in times of high demand. Keep in mind certain specifics, such as the occasional need for certain extensions, and you'll you make the most of this feature.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":4} -->
<h4 class="wp-block-heading">Perks from enabling auto-scalability on the PHP instance</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>With auto-scalability, you can use Matomo smoothly and adaptively, even during peak periods! Benefit from powerful on-demand resources, while paying only for the consumption/second. Once you've completed your intensive tasks, your instance returns to an optimal size, guaranteeing efficiency and savings. So there's no need to reserve a large infrastructure to meet occasional needs.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":4} -->
<h4 class="wp-block-heading">When to disable auto-scalability?</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Clever Cloud provides a service that can be adapted to your needs, with the option of limiting or completely disabling instance auto-scalability. In some cases, it may be advisable to deactivate it from time to time.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>As Matomo is a managed service, some configuration options are unalterable to guarantee optimal operation and performance. As part of Matomo's continuous improvement, we have integrated the Google Analytics data import extension in response to common customer requests. This extension, generally used for a one-off migration from Google Analytics to Matomo, is deactivated by default.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>If you activate the extension and start importing data, and your application scales, your instance reboots and redeploys the application... with the default configurations. Restarting will therefore disable this extension and kill the import process at the same time. If you decide to use an extension that appears as disabled by default in our Matomo, we recommend the following procedure:</p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><!-- wp:list-item -->
<li>Disable auto-scalability for your Matomo PHP instance</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Increase the instance size until the process is complete</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Restart instance</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Once the instance has been redeployed, activate the extension in Matomo</li>
<!-- /wp:list-item --></ol>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p>Now you're ready to use the extension, which will remain active until the next server restart. </p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3 class="wp-block-heading"></h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Matomo, with its MySQL addon, is designed to grow with you. While the database is created with sufficient capacity at start-up, Matomo will quickly exploit its potential. To avoid surprises, why not set up Grafana alerts to monitor memory levels?</p>
<!-- /wp:paragraph -->

<!-- wp:image {"id":8034,"width":575,"height":281,"sizeSlug":"large","linkDestination":"none"} -->
<figure class="wp-block-image size-large is-resized"><img src="https://cdn.clever-cloud.com/uploads/2023/07/grafana-mysql-1.png" alt="Database metrics on Grafana" class="wp-image-8034" style="width:575px;height:281px" width="575" height="281"/><figcaption class="wp-element-caption">Your database metrics are also available in Grafana, in the Addon panel.</figcaption></figure>
<!-- /wp:image -->

<!-- wp:heading {"level":4} -->
<h4 class="wp-block-heading">Creating alerts</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Among its many features, Grafana lets you create alerts on the metrics of your choice. You'll find <a href="https://www.clever.cloud/blog/features/2021/12/03/slack-alerts-for-grafana/" target="_blank" rel="noopener">a tutorial here</a> to show you how to create your alerts from Grafana to Slack, which you can also apply to other contact points like Discord, Teams, etc.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>We recommend that you leave around 20% disk space available, as the MySQL instance will need disk to migrate.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":4} -->
<h4 class="wp-block-heading">Migrating the database</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Although scalability has its peculiarities for databases, Clever Cloud provides a smooth and intuitive manual solution. When you receive the alert, a simple connection to the Console on your MySQL addon dashboard will enable you to launch our one-click migration tool. This operation can take from a few seconds to a few minutes, depending on the size of your database.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>💡 <strong>Tip:</strong> Include a direct link to the migration tab in your Grafana alert message. This will give you instant access to the migration tool, making the process even easier.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2 class="wp-block-heading">Leveraging Matomo and Clever Cloud</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Although a managed service is pre-configured, you have Matomo administrator status and can use it as such. Here are just a few examples of what you can do with Matomo and Clever Cloud.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3 class="wp-block-heading">Adding new Matomo users</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>All our managed services use Clever Cloud SSO, enabling you to access deployed addons from your platform credentials. Perhaps you'd like to add users to Matomo without giving them access to the platform.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Matomo lets you <a href="https://matomo.org/faq/general/user-roles-in-matomo/" target="_blank" rel="noopener">add users with different levels of permissions</a> to the application. You can invite them by email directly from the Matomo interface. Users invited by this method will not have access to Matomo's system settings or extensions, unlike Clever Cloud users.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":4} -->
<h4 class="wp-block-heading">Elevating permission levels</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>If you have added a user from the Matomo interface, but now wish to add them to your Clever Cloud organization with the same email address, access to Matomo will be denied for security reasons, since this user already exists in the database.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>To avoid duplication, simply delete the Matomo user from your database.</p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><!-- wp:list-item -->
<li>Launch your MySQL addon's PHPMyAdmin interface</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Click on your database name (not schema)</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Search by keyword <code>user</code> and choose the table <code>matomo_user</code></li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Delete the user you wish to add to the Clever Cloud organization</li>
<!-- /wp:list-item --></ol>
<!-- /wp:list -->

<!-- wp:image {"id":8038,"sizeSlug":"large","linkDestination":"none"} -->
<figure class="wp-block-image size-large"><img src="https://cdn.clever-cloud.com/uploads/2023/07/phpmyadmin-1.png" alt="PHPMyAdmin Structure tab showing matomo_user table" class="wp-image-8038"/></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>Now you can <a href="https://www.clever.cloud/developers/account/organizations/" target="_blank" rel="noopener">invite the user to your organization with his email address</a>, giving him administration rights on the instance.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3 class="wp-block-heading">Measure the audience of any application</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>On Clever Cloud, you can separate your collaborative environments by creating organizations to which you invite members. Organizations remain isolated, ensuring that no member has uninvited access to an organization's applications and addons.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Matomo makes it possible to track apps to which a simple script has been added to the head. So, even if an application is deployed within a different organization, Matomo offers a unified and complete view of its audience tracking as soon as the application contains this script.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"id":8070,"sizeSlug":"large","linkDestination":"none"} -->
<figure class="wp-block-image size-large"><img src="https://cdn.clever-cloud.com/uploads/2023/08/capture-decran-2023-08-17-a-16-35-05.png" alt="Matomo tracking code from its interface" class="wp-image-8070"/></figure>
<!-- /wp:image -->

<!-- wp:heading {"level":4} -->
<h4 class="wp-block-heading">Optimizing role separation</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>You can set up a dedicated organization for the Matomo administrator of your company or association. From this organization, the administrator can monitor the audience of applications hosted in other organizations, even if these are inaccessible to him/her.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>To implement this configuration, the administrator simply provides the appropriate script to be integrated into the head tag of each application. Once integrated, the tracking data will be visible in Matomo. This process ensures that developers have no access to Matomo, while restricting the Matomo administrator's access to applications.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3 class="wp-block-heading">📢 New: Migrate Google Analytics data to Matomo</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>As we mentioned, you can now use the extension to migrate your Google Analytics data to Matomo. It might be challenging to determine the right database sizing , due to Google Analytics' opacity regarding its metrics.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>With this in mind, we suggest you keep an eye on your database metrics and opt for a gradual increase in storage capacity. To facilitate this procedure, Matomo provides <a href="https://matomo.org/faq/general/running-the-google-analytics-import/" target="_blank" rel="noopener">a detailed guide to migration</a>.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2 class="wp-block-heading">Conclusion</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Clever Cloud not only facilitates the deployment of on-demand applications and services in the form of add-ons. In addition, we include an integrated suite for all our customers, offering in-depth monitoring of application and database activity, as well as automatic and adaptive scaling capabilities.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Whether you've opted for Matomo or one of our other add-ons, we're always listening to our customers' needs, so we can continually improve the services we offer. We look forward to hearing from you!</p>
<!-- /wp:paragraph -->]]></description>
										<content:encoded><![CDATA[<p><img width="2800" height="1080" src="https://cdn.clever-cloud.com/uploads/2023/08/banner-matomo-5.png" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="banner matomo 5" decoding="async" loading="lazy" srcset="https://cdn.clever-cloud.com/uploads/2023/08/banner-matomo-5.png 2800w, https://cdn.clever-cloud.com/uploads/2023/08/banner-matomo-5-300x116.png 300w, https://cdn.clever-cloud.com/uploads/2023/08/banner-matomo-5-1024x395.png 1024w, https://cdn.clever-cloud.com/uploads/2023/08/banner-matomo-5-768x296.png 768w, https://cdn.clever-cloud.com/uploads/2023/08/banner-matomo-5-1536x592.png 1536w, https://cdn.clever-cloud.com/uploads/2023/08/banner-matomo-5-2048x790.png 2048w, https://cdn.clever-cloud.com/uploads/2023/08/banner-matomo-5-1368x528.png 1368w" sizes="auto, (max-width: 2800px) 100vw, 2800px" /></p><!-- wp:paragraph -->
<p>In <a href="https://www.clever.cloud/blog/features/2022/05/16/how-and-why-to-install-matomo-to-replace-google-analytics/" target="_blank" rel="noopener">a previous post</a>, we explained why you should switch from Google Analytics to Matomo for your audience measurement. Some of our customers have decided to take this step, and Clever Cloud has helped them get to grips with the solution. Based on this experience, find out in this article how to maximize the use of our Matomo addon on Clever Cloud.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2 class="wp-block-heading">Selecting the optimal instance size</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>As soon as the Matomo addon is created, Clever Cloud deploys three optimized instances (a PHP runtime, a MySQL addon and a Redis addon). Initially, they are sized to the minimum server requirements in order to evolve according to your needs, thus ensuring cost optimization. If you need to make adjustments (for example, if you start to experience errors or slowdowns when launching some processes), our integrated Grafana is your best ally for monitoring your metrics and adjusting your resources accordingly.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3 class="wp-block-heading">Easy access to your metrics</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Thanks to the intuitive dashboard for each application, you're provided with a clear view of it all. We've <a href="https://www.clever.cloud/blog/features/2023/03/16/a-metric-tile-to-simplify-application-monitoring/" target="_blank" rel="noopener">recently integrated a metrics tile</a> into this dashboard, allowing you to track RAM and CPU consumption in real time from the console.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":8069,"sizeSlug":"medium","linkDestination":"none"} -->
<figure class="wp-block-image aligncenter size-medium"><img src="https://cdn.clever-cloud.com/uploads/2023/08/capture-decran-2023-08-17-a-16-33-06.png" alt="Tile metrics from app Overview panel indicating CPU and RAM usage." class="wp-image-8069"/></figure>
<!-- /wp:image -->

<!-- wp:spacer {"height":"34px"} -->
<div style="height:34px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->

<!-- wp:paragraph -->
<p>For a more in-depth analysis, a simple click on the Grafana logo from the tile gives you access to all your application's metrics. </p>
<!-- /wp:paragraph -->

<!-- wp:image {"id":8036,"width":493,"height":274,"sizeSlug":"large","linkDestination":"none"} -->
<figure class="wp-block-image size-large is-resized"><img src="https://cdn.clever-cloud.com/uploads/2023/07/capture-decran-2023-07-31-a-15-27-32.png" alt="Metrics dashboard on Grafana for Matomo PHP application" class="wp-image-8036" style="width:493px;height:274px" width="493" height="274"/></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>In addition, Matomo's PHP instance logs are always there to provide you with additional information. </p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3 class="wp-block-heading">All about auto-scalability</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Self-scalability on Clever Cloud is a major advantage, giving you peace of mind and flexible billing. With Matomo, this feature guarantees a smooth experience even in times of high demand. Keep in mind certain specifics, such as the occasional need for certain extensions, and you'll you make the most of this feature.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":4} -->
<h4 class="wp-block-heading">Perks from enabling auto-scalability on the PHP instance</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>With auto-scalability, you can use Matomo smoothly and adaptively, even during peak periods! Benefit from powerful on-demand resources, while paying only for the consumption/second. Once you've completed your intensive tasks, your instance returns to an optimal size, guaranteeing efficiency and savings. So there's no need to reserve a large infrastructure to meet occasional needs.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":4} -->
<h4 class="wp-block-heading">When to disable auto-scalability?</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Clever Cloud provides a service that can be adapted to your needs, with the option of limiting or completely disabling instance auto-scalability. In some cases, it may be advisable to deactivate it from time to time.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>As Matomo is a managed service, some configuration options are unalterable to guarantee optimal operation and performance. As part of Matomo's continuous improvement, we have integrated the Google Analytics data import extension in response to common customer requests. This extension, generally used for a one-off migration from Google Analytics to Matomo, is deactivated by default.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>If you activate the extension and start importing data, and your application scales, your instance reboots and redeploys the application... with the default configurations. Restarting will therefore disable this extension and kill the import process at the same time. If you decide to use an extension that appears as disabled by default in our Matomo, we recommend the following procedure:</p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><!-- wp:list-item -->
<li>Disable auto-scalability for your Matomo PHP instance</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Increase the instance size until the process is complete</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Restart instance</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Once the instance has been redeployed, activate the extension in Matomo</li>
<!-- /wp:list-item --></ol>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p>Now you're ready to use the extension, which will remain active until the next server restart. </p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3 class="wp-block-heading"></h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Matomo, with its MySQL addon, is designed to grow with you. While the database is created with sufficient capacity at start-up, Matomo will quickly exploit its potential. To avoid surprises, why not set up Grafana alerts to monitor memory levels?</p>
<!-- /wp:paragraph -->

<!-- wp:image {"id":8034,"width":575,"height":281,"sizeSlug":"large","linkDestination":"none"} -->
<figure class="wp-block-image size-large is-resized"><img src="https://cdn.clever-cloud.com/uploads/2023/07/grafana-mysql-1.png" alt="Database metrics on Grafana" class="wp-image-8034" style="width:575px;height:281px" width="575" height="281"/><figcaption class="wp-element-caption">Your database metrics are also available in Grafana, in the Addon panel.</figcaption></figure>
<!-- /wp:image -->

<!-- wp:heading {"level":4} -->
<h4 class="wp-block-heading">Creating alerts</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Among its many features, Grafana lets you create alerts on the metrics of your choice. You'll find <a href="https://www.clever.cloud/blog/features/2021/12/03/slack-alerts-for-grafana/" target="_blank" rel="noopener">a tutorial here</a> to show you how to create your alerts from Grafana to Slack, which you can also apply to other contact points like Discord, Teams, etc.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>We recommend that you leave around 20% disk space available, as the MySQL instance will need disk to migrate.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":4} -->
<h4 class="wp-block-heading">Migrating the database</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Although scalability has its peculiarities for databases, Clever Cloud provides a smooth and intuitive manual solution. When you receive the alert, a simple connection to the Console on your MySQL addon dashboard will enable you to launch our one-click migration tool. This operation can take from a few seconds to a few minutes, depending on the size of your database.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>💡 <strong>Tip:</strong> Include a direct link to the migration tab in your Grafana alert message. This will give you instant access to the migration tool, making the process even easier.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2 class="wp-block-heading">Leveraging Matomo and Clever Cloud</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Although a managed service is pre-configured, you have Matomo administrator status and can use it as such. Here are just a few examples of what you can do with Matomo and Clever Cloud.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3 class="wp-block-heading">Adding new Matomo users</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>All our managed services use Clever Cloud SSO, enabling you to access deployed addons from your platform credentials. Perhaps you'd like to add users to Matomo without giving them access to the platform.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Matomo lets you <a href="https://matomo.org/faq/general/user-roles-in-matomo/" target="_blank" rel="noopener">add users with different levels of permissions</a> to the application. You can invite them by email directly from the Matomo interface. Users invited by this method will not have access to Matomo's system settings or extensions, unlike Clever Cloud users.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":4} -->
<h4 class="wp-block-heading">Elevating permission levels</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>If you have added a user from the Matomo interface, but now wish to add them to your Clever Cloud organization with the same email address, access to Matomo will be denied for security reasons, since this user already exists in the database.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>To avoid duplication, simply delete the Matomo user from your database.</p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><!-- wp:list-item -->
<li>Launch your MySQL addon's PHPMyAdmin interface</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Click on your database name (not schema)</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Search by keyword <code>user</code> and choose the table <code>matomo_user</code></li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li>Delete the user you wish to add to the Clever Cloud organization</li>
<!-- /wp:list-item --></ol>
<!-- /wp:list -->

<!-- wp:image {"id":8038,"sizeSlug":"large","linkDestination":"none"} -->
<figure class="wp-block-image size-large"><img src="https://cdn.clever-cloud.com/uploads/2023/07/phpmyadmin-1.png" alt="PHPMyAdmin Structure tab showing matomo_user table" class="wp-image-8038"/></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>Now you can <a href="https://www.clever.cloud/developers/account/organizations/" target="_blank" rel="noopener">invite the user to your organization with his email address</a>, giving him administration rights on the instance.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3 class="wp-block-heading">Measure the audience of any application</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>On Clever Cloud, you can separate your collaborative environments by creating organizations to which you invite members. Organizations remain isolated, ensuring that no member has uninvited access to an organization's applications and addons.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Matomo makes it possible to track apps to which a simple script has been added to the head. So, even if an application is deployed within a different organization, Matomo offers a unified and complete view of its audience tracking as soon as the application contains this script.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"id":8070,"sizeSlug":"large","linkDestination":"none"} -->
<figure class="wp-block-image size-large"><img src="https://cdn.clever-cloud.com/uploads/2023/08/capture-decran-2023-08-17-a-16-35-05.png" alt="Matomo tracking code from its interface" class="wp-image-8070"/></figure>
<!-- /wp:image -->

<!-- wp:heading {"level":4} -->
<h4 class="wp-block-heading">Optimizing role separation</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>You can set up a dedicated organization for the Matomo administrator of your company or association. From this organization, the administrator can monitor the audience of applications hosted in other organizations, even if these are inaccessible to him/her.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>To implement this configuration, the administrator simply provides the appropriate script to be integrated into the head tag of each application. Once integrated, the tracking data will be visible in Matomo. This process ensures that developers have no access to Matomo, while restricting the Matomo administrator's access to applications.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3 class="wp-block-heading">📢 New: Migrate Google Analytics data to Matomo</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>As we mentioned, you can now use the extension to migrate your Google Analytics data to Matomo. It might be challenging to determine the right database sizing , due to Google Analytics' opacity regarding its metrics.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>With this in mind, we suggest you keep an eye on your database metrics and opt for a gradual increase in storage capacity. To facilitate this procedure, Matomo provides <a href="https://matomo.org/faq/general/running-the-google-analytics-import/" target="_blank" rel="noopener">a detailed guide to migration</a>.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2 class="wp-block-heading">Conclusion</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Clever Cloud not only facilitates the deployment of on-demand applications and services in the form of add-ons. In addition, we include an integrated suite for all our customers, offering in-depth monitoring of application and database activity, as well as automatic and adaptive scaling capabilities.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Whether you've opted for Matomo or one of our other add-ons, we're always listening to our customers' needs, so we can continually improve the services we offer. We look forward to hearing from you!</p>
<!-- /wp:paragraph -->]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>A Grafana to plot applications metrics</title>
		<link>https://www.clever.cloud/blog/features/2021/10/28/a-grafana-to-plot-applications-metrics/</link>
		
		<dc:creator><![CDATA[Aurélien Hebert]]></dc:creator>
		<pubDate>Thu, 28 Oct 2021 14:01:46 +0000</pubDate>
				<category><![CDATA[Features]]></category>
		<category><![CDATA[grafana]]></category>
		<category><![CDATA[metrics]]></category>
		<category><![CDATA[observability]]></category>
		<guid isPermaLink="false">https://www.clever-cloud.com/?p=3831</guid>

					<description><![CDATA[<p><img width="1400" height="540" src="https://cdn.clever-cloud.com/uploads/2021/10/grafana.webp" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="grafana" decoding="async" loading="lazy" srcset="https://cdn.clever-cloud.com/uploads/2021/10/grafana.webp 1400w, https://cdn.clever-cloud.com/uploads/2021/10/grafana-300x116.webp 300w, https://cdn.clever-cloud.com/uploads/2021/10/grafana-1024x395.webp 1024w, https://cdn.clever-cloud.com/uploads/2021/10/grafana-768x296.webp 768w, https://cdn.clever-cloud.com/uploads/2021/10/grafana-1368x528.webp 1368w" sizes="auto, (max-width: 1400px) 100vw, 1400px" /></p><!-- wp:paragraph {"dropCap":true} -->
<p class="has-drop-cap">At Clever Cloud, we think it’s important to offer <strong>access</strong> to <strong>our metrics</strong> for our users. That’s why you can already query all our <a href="https://www.clever.cloud/developers/administrate/metrics/overview/">metrics</a>, and can choose between WarpScript or <a href="https://www.clever.cloud/blog/engineering/2021/10/12/enabling-promql-queries-with-erlenmeyer/">PromQL</a>. Besides, we wanted to provide <strong>more than only a metrics access</strong> to our users! We wanted to give a tool that will make you able to <strong>explore</strong> and <strong>visualize</strong> the state of your Clever Cloud applications. Internally, we’re using <a href="https://grafana.com/">Grafana</a> a lot to build monitoring dashboards, what if we can re-use this tool and build <strong>dedicated</strong> <strong>dashboards</strong>? That’s how we got the idea to release a <strong>Grafana for all of you</strong>!</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":6239,"sizeSlug":"full","linkDestination":"none"} -->
<figure class="wp-block-image aligncenter size-full"><img src="https://cdn.clever-cloud.com/uploads/2021/10/grafana.svg" alt="grafana" class="wp-image-6239"/><figcaption class="wp-element-caption">Grafana</figcaption></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>In this blog post, we will talk about the <strong>Grafana tool</strong>. Then we will see how we <strong>deployed</strong> it. After that we will detail all actions to do to activate our <strong>Grafana Beta</strong> on your organisation. We will conclude with our <strong>dashboard’s contents</strong>.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2 class="wp-block-heading" id="about-grafana">About Grafana</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p><a href="https://grafana.com/">Grafana</a> is an <strong>open-source</strong> tool which enables among others applications metrics, alerting or log visualization. Thus Grafana’s aim is to ease to create <a href="https://grafana.com/blog/2019/05/16/worth-a-look-public-grafana-dashboards/">efficient dashboards</a>. Grafana also comes with multiple kinds of <strong>tiles</strong> or <strong>themes</strong> and provide <strong>many data sources</strong>. In our case, we will use only <a href="https://github.com/ovh/ovh-warp10-datasource">Warp10</a> and <a href="https://grafana.com/docs/grafana/latest/datasources/prometheus/">Prometheus</a>.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3 class="wp-block-heading" id="grafana-at-clever-cloud">Grafana at Clever Cloud</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>For the one who wants to utilize Grafana, it's easy to deploy it today on Clever Cloud. For the French reader you can follow this <a href="https://blog.kbdev.io/dev/2021/08/24/grafana-clevercloud.html">blog post</a>. And also we released some scripts to automate it on <a href="https://github.com/CleverCloud/grafana-example">Github</a>. When we wanted to deploy a Grafana for our customers, we decided to re-use the same scripts. This is why our deployed instance runs as a Clever Cloud runtime application. We only activate an option as <code>force https</code> and add some <code>scalability</code>.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3 class="wp-block-heading" id="our-grafana-architecture">Our Grafana Architecture</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>As Clever Cloud, Grafana furnishes organisation too. Then it’s easy to <strong>link both</strong> and make it available to our users. Next, we created an API endpoint to connect our Grafana to our console. All <strong>data sources</strong> exposed (Warp10 and Prometheus) are <strong>handled on our side. This means that no users can change them</strong>. However we <strong>cyclically</strong> <strong>refresh</strong> all <strong>tokens</strong>. In the same way, we regularly update all custom dashboards we provide. </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Everyone<strong> </strong>features<strong> editor rights</strong> in their organisations. This means that you can customise all dashboards as you want. We will see, later in this post, how to not generates conflicts with our templates.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2 class="wp-block-heading" id="activate-the-grafana-beta-organisation">Activate the Grafana Beta Organisation</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>To activate our beta, you need to go to your Clever Cloud organisation view in the Clever Cloud console. Then you will have access to a page called <code>Metrics in Grafana</code>.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3 class="wp-block-heading" id="available-dashboards">Available Dashboards</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>We built three unique dashboards for you! First we will start by a tour of an organisation metrics. Then we will get more into the details of a runtime view. And finally we will see what we bring for the add-ons. <strong>Most graph of all Grafana dashboards contains a small information tile. There, you can retrieve a bit of help and description</strong>.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":4} -->
<h4 class="wp-block-heading" id="clever-cloud-organisation">Clever Cloud Organisation</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>The organisation view is the <strong>home</strong> <strong>dashboard</strong> in Grafana. It provides some <strong>insights</strong> about your organisation. Here, we expose some key information about the applications, the flavours and the image types. Besides, as a home, you will access some links here. You can go to all Clever Cloud template dashboards as well as the ones you set as <strong>favourite</strong> in Grafana. You can also find out direct link to reach an application.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>A tile I want to explain a bit more is the deployment <strong>state graph</strong>. What is done on this tile? Every <strong>new</strong> <strong>deployment</strong> generates a new state. We plot only each one occurring during the Grafana time range. And finally this dashboard includes a metrics counting the average <strong>requests rate</strong> per minutes, computed from the access logs.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":4862,"width":667,"height":375,"sizeSlug":"large","linkDestination":"none"} -->
<figure class="wp-block-image aligncenter size-large is-resized"><img src="https://cdn.clever-cloud.com/uploads/2021/12/home.png" alt="Grafana Metrics Home" class="wp-image-4862" style="width:667px;height:375px" width="667" height="375"/><figcaption class="wp-element-caption">Grafana home dashboard</figcaption></figure>
<!-- /wp:image -->

<!-- wp:heading {"level":4} -->
<h4 class="wp-block-heading" id="application-runtime-dashboard">Application Runtime Dashboard</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>I will now introduce the runtime dashboard. In this dashboard we retrieve several parts. First we start with a quick overview of your <strong>application</strong> <strong>state</strong>. Then we will have access to more details sections. Those sections will be about classical system metrics as the CPU, the load, the memory, the disks and the networks. Moreover in each segment, you will find many graphs as the <strong>usage</strong> or when the <strong>resource</strong> <strong>is</strong> <strong>saturated</strong>. To compute this last metrics, we apply a linear regression.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":6235,"sizeSlug":"large","linkDestination":"none"} -->
<figure class="wp-block-image aligncenter size-large"><img src="https://cdn.clever-cloud.com/uploads/2021/10/runtime-1.png" alt="runtime_board_grafana" class="wp-image-6235"/><figcaption class="wp-element-caption">Grafana runtime dashboard</figcaption></figure>
<!-- /wp:image -->

<!-- wp:heading {"level":4} -->
<h4 class="wp-block-heading" id="add-on-dashboard">Add-on Dashboard</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>The last dashboard contains the add-on metrics view. A first panel contains <strong>system</strong>-<strong>related</strong> metrics as the CPU, the memory, the disks or the network. A second one show the <strong>database</strong> metrics. This is where you will retrieve data as connections count, transactions, errors, deadlocks or tuple operations. However we collect custom data on a limited pool of add-on. This means there are only four of them: MySQL, PostgreSQL, Redis and MongoDB.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":4863,"sizeSlug":"large","linkDestination":"none"} -->
<figure class="wp-block-image aligncenter size-large"><img src="https://cdn.clever-cloud.com/uploads/2021/12/addon.png" alt="" class="wp-image-4863"/><figcaption class="wp-element-caption">Grafana add-on dashboard</figcaption></figure>
<!-- /wp:image -->

<!-- wp:heading -->
<h2 class="wp-block-heading" id="customize-your-grafana-organisation">Customize Your Grafana Organisation</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>You have full right to <strong>edit</strong> all dashboard saved in your Grafana organisation. This means you can edit our templates. However we will update them every once in a while. As a result all your dashboards will always be up to date. </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>We store all our templates on the <code>Clever Cloud</code> folder. However, you can create custom dashboards <strong>anywhere else</strong>, we will never update them! </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>The Grafana <code>manage view</code> lists all folders and files. Besides, this view is helpful to <strong>organise</strong> and to <strong>create</strong> new folders!</p>
<!-- /wp:paragraph -->

<!-- wp:image {"id":3832,"sizeSlug":"full","linkDestination":"none"} -->
<figure class="wp-block-image size-full"><img src="https://cdn.clever-cloud.com/uploads/2021/10/Manage_Grafana.png" alt="Grafana manage view" class="wp-image-3832"/><figcaption class="wp-element-caption">Grafana manage view</figcaption></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>At any time you can <strong>reset</strong> our templates. For example in case you made unwanted changes. In that case, you can reach the Grafana page of your Clever Cloud organisation. Then click on <code>reset all dashboards</code>. Finally, all <code>Clever Cloud</code> ones will be back to their initial states.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2 class="wp-block-heading" id="share-your-experience">Share Your Experience</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Thank you for <strong>reading</strong> this post, we will be more than happy to get some feedback! How do you use our available data? Is there something missing for your use case on what we have provided? I hope you will enjoy this new data ride!</p>
<!-- /wp:paragraph -->]]></description>
										<content:encoded><![CDATA[<p><img width="1400" height="540" src="https://cdn.clever-cloud.com/uploads/2021/10/grafana.webp" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="grafana" decoding="async" loading="lazy" srcset="https://cdn.clever-cloud.com/uploads/2021/10/grafana.webp 1400w, https://cdn.clever-cloud.com/uploads/2021/10/grafana-300x116.webp 300w, https://cdn.clever-cloud.com/uploads/2021/10/grafana-1024x395.webp 1024w, https://cdn.clever-cloud.com/uploads/2021/10/grafana-768x296.webp 768w, https://cdn.clever-cloud.com/uploads/2021/10/grafana-1368x528.webp 1368w" sizes="auto, (max-width: 1400px) 100vw, 1400px" /></p><!-- wp:paragraph {"dropCap":true} -->
<p class="has-drop-cap">At Clever Cloud, we think it’s important to offer <strong>access</strong> to <strong>our metrics</strong> for our users. That’s why you can already query all our <a href="https://www.clever.cloud/developers/administrate/metrics/overview/">metrics</a>, and can choose between WarpScript or <a href="https://www.clever.cloud/blog/engineering/2021/10/12/enabling-promql-queries-with-erlenmeyer/">PromQL</a>. Besides, we wanted to provide <strong>more than only a metrics access</strong> to our users! We wanted to give a tool that will make you able to <strong>explore</strong> and <strong>visualize</strong> the state of your Clever Cloud applications. Internally, we’re using <a href="https://grafana.com/">Grafana</a> a lot to build monitoring dashboards, what if we can re-use this tool and build <strong>dedicated</strong> <strong>dashboards</strong>? That’s how we got the idea to release a <strong>Grafana for all of you</strong>!</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":6239,"sizeSlug":"full","linkDestination":"none"} -->
<figure class="wp-block-image aligncenter size-full"><img src="https://cdn.clever-cloud.com/uploads/2021/10/grafana.svg" alt="grafana" class="wp-image-6239"/><figcaption class="wp-element-caption">Grafana</figcaption></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>In this blog post, we will talk about the <strong>Grafana tool</strong>. Then we will see how we <strong>deployed</strong> it. After that we will detail all actions to do to activate our <strong>Grafana Beta</strong> on your organisation. We will conclude with our <strong>dashboard’s contents</strong>.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2 class="wp-block-heading" id="about-grafana">About Grafana</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p><a href="https://grafana.com/">Grafana</a> is an <strong>open-source</strong> tool which enables among others applications metrics, alerting or log visualization. Thus Grafana’s aim is to ease to create <a href="https://grafana.com/blog/2019/05/16/worth-a-look-public-grafana-dashboards/">efficient dashboards</a>. Grafana also comes with multiple kinds of <strong>tiles</strong> or <strong>themes</strong> and provide <strong>many data sources</strong>. In our case, we will use only <a href="https://github.com/ovh/ovh-warp10-datasource">Warp10</a> and <a href="https://grafana.com/docs/grafana/latest/datasources/prometheus/">Prometheus</a>.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3 class="wp-block-heading" id="grafana-at-clever-cloud">Grafana at Clever Cloud</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>For the one who wants to utilize Grafana, it's easy to deploy it today on Clever Cloud. For the French reader you can follow this <a href="https://blog.kbdev.io/dev/2021/08/24/grafana-clevercloud.html">blog post</a>. And also we released some scripts to automate it on <a href="https://github.com/CleverCloud/grafana-example">Github</a>. When we wanted to deploy a Grafana for our customers, we decided to re-use the same scripts. This is why our deployed instance runs as a Clever Cloud runtime application. We only activate an option as <code>force https</code> and add some <code>scalability</code>.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3 class="wp-block-heading" id="our-grafana-architecture">Our Grafana Architecture</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>As Clever Cloud, Grafana furnishes organisation too. Then it’s easy to <strong>link both</strong> and make it available to our users. Next, we created an API endpoint to connect our Grafana to our console. All <strong>data sources</strong> exposed (Warp10 and Prometheus) are <strong>handled on our side. This means that no users can change them</strong>. However we <strong>cyclically</strong> <strong>refresh</strong> all <strong>tokens</strong>. In the same way, we regularly update all custom dashboards we provide. </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Everyone<strong> </strong>features<strong> editor rights</strong> in their organisations. This means that you can customise all dashboards as you want. We will see, later in this post, how to not generates conflicts with our templates.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2 class="wp-block-heading" id="activate-the-grafana-beta-organisation">Activate the Grafana Beta Organisation</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>To activate our beta, you need to go to your Clever Cloud organisation view in the Clever Cloud console. Then you will have access to a page called <code>Metrics in Grafana</code>.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3 class="wp-block-heading" id="available-dashboards">Available Dashboards</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>We built three unique dashboards for you! First we will start by a tour of an organisation metrics. Then we will get more into the details of a runtime view. And finally we will see what we bring for the add-ons. <strong>Most graph of all Grafana dashboards contains a small information tile. There, you can retrieve a bit of help and description</strong>.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":4} -->
<h4 class="wp-block-heading" id="clever-cloud-organisation">Clever Cloud Organisation</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>The organisation view is the <strong>home</strong> <strong>dashboard</strong> in Grafana. It provides some <strong>insights</strong> about your organisation. Here, we expose some key information about the applications, the flavours and the image types. Besides, as a home, you will access some links here. You can go to all Clever Cloud template dashboards as well as the ones you set as <strong>favourite</strong> in Grafana. You can also find out direct link to reach an application.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>A tile I want to explain a bit more is the deployment <strong>state graph</strong>. What is done on this tile? Every <strong>new</strong> <strong>deployment</strong> generates a new state. We plot only each one occurring during the Grafana time range. And finally this dashboard includes a metrics counting the average <strong>requests rate</strong> per minutes, computed from the access logs.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":4862,"width":667,"height":375,"sizeSlug":"large","linkDestination":"none"} -->
<figure class="wp-block-image aligncenter size-large is-resized"><img src="https://cdn.clever-cloud.com/uploads/2021/12/home.png" alt="Grafana Metrics Home" class="wp-image-4862" style="width:667px;height:375px" width="667" height="375"/><figcaption class="wp-element-caption">Grafana home dashboard</figcaption></figure>
<!-- /wp:image -->

<!-- wp:heading {"level":4} -->
<h4 class="wp-block-heading" id="application-runtime-dashboard">Application Runtime Dashboard</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>I will now introduce the runtime dashboard. In this dashboard we retrieve several parts. First we start with a quick overview of your <strong>application</strong> <strong>state</strong>. Then we will have access to more details sections. Those sections will be about classical system metrics as the CPU, the load, the memory, the disks and the networks. Moreover in each segment, you will find many graphs as the <strong>usage</strong> or when the <strong>resource</strong> <strong>is</strong> <strong>saturated</strong>. To compute this last metrics, we apply a linear regression.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":6235,"sizeSlug":"large","linkDestination":"none"} -->
<figure class="wp-block-image aligncenter size-large"><img src="https://cdn.clever-cloud.com/uploads/2021/10/runtime-1.png" alt="runtime_board_grafana" class="wp-image-6235"/><figcaption class="wp-element-caption">Grafana runtime dashboard</figcaption></figure>
<!-- /wp:image -->

<!-- wp:heading {"level":4} -->
<h4 class="wp-block-heading" id="add-on-dashboard">Add-on Dashboard</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>The last dashboard contains the add-on metrics view. A first panel contains <strong>system</strong>-<strong>related</strong> metrics as the CPU, the memory, the disks or the network. A second one show the <strong>database</strong> metrics. This is where you will retrieve data as connections count, transactions, errors, deadlocks or tuple operations. However we collect custom data on a limited pool of add-on. This means there are only four of them: MySQL, PostgreSQL, Redis and MongoDB.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":4863,"sizeSlug":"large","linkDestination":"none"} -->
<figure class="wp-block-image aligncenter size-large"><img src="https://cdn.clever-cloud.com/uploads/2021/12/addon.png" alt="" class="wp-image-4863"/><figcaption class="wp-element-caption">Grafana add-on dashboard</figcaption></figure>
<!-- /wp:image -->

<!-- wp:heading -->
<h2 class="wp-block-heading" id="customize-your-grafana-organisation">Customize Your Grafana Organisation</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>You have full right to <strong>edit</strong> all dashboard saved in your Grafana organisation. This means you can edit our templates. However we will update them every once in a while. As a result all your dashboards will always be up to date. </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>We store all our templates on the <code>Clever Cloud</code> folder. However, you can create custom dashboards <strong>anywhere else</strong>, we will never update them! </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>The Grafana <code>manage view</code> lists all folders and files. Besides, this view is helpful to <strong>organise</strong> and to <strong>create</strong> new folders!</p>
<!-- /wp:paragraph -->

<!-- wp:image {"id":3832,"sizeSlug":"full","linkDestination":"none"} -->
<figure class="wp-block-image size-full"><img src="https://cdn.clever-cloud.com/uploads/2021/10/Manage_Grafana.png" alt="Grafana manage view" class="wp-image-3832"/><figcaption class="wp-element-caption">Grafana manage view</figcaption></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>At any time you can <strong>reset</strong> our templates. For example in case you made unwanted changes. In that case, you can reach the Grafana page of your Clever Cloud organisation. Then click on <code>reset all dashboards</code>. Finally, all <code>Clever Cloud</code> ones will be back to their initial states.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2 class="wp-block-heading" id="share-your-experience">Share Your Experience</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Thank you for <strong>reading</strong> this post, we will be more than happy to get some feedback! How do you use our available data? Is there something missing for your use case on what we have provided? I hope you will enjoy this new data ride!</p>
<!-- /wp:paragraph -->]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Enabling PromQL queries with Erlenmeyer</title>
		<link>https://www.clever.cloud/blog/engineering/2021/10/12/enabling-promql-queries-with-erlenmeyer/</link>
		
		<dc:creator><![CDATA[Aurélien Hebert]]></dc:creator>
		<pubDate>Tue, 12 Oct 2021 07:28:09 +0000</pubDate>
				<category><![CDATA[Engineering]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[metrics]]></category>
		<category><![CDATA[observability]]></category>
		<category><![CDATA[prometheus]]></category>
		<category><![CDATA[warp10]]></category>
		<guid isPermaLink="false">https://www2.cleverapps.io/wp/?p=3031</guid>

					<description><![CDATA[<p><img width="1400" height="540" src="https://cdn.clever-cloud.com/uploads/2021/10/erlenmeyer-promql-1.jpg" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="erlenmeyer promql 1" decoding="async" loading="lazy" srcset="https://cdn.clever-cloud.com/uploads/2021/10/erlenmeyer-promql-1.jpg 1400w, https://cdn.clever-cloud.com/uploads/2021/10/erlenmeyer-promql-1-300x116.jpg 300w, https://cdn.clever-cloud.com/uploads/2021/10/erlenmeyer-promql-1-1024x395.jpg 1024w, https://cdn.clever-cloud.com/uploads/2021/10/erlenmeyer-promql-1-768x296.jpg 768w, https://cdn.clever-cloud.com/uploads/2021/10/erlenmeyer-promql-1-1368x528.jpg 1368w" sizes="auto, (max-width: 1400px) 100vw, 1400px" /></p><div>You are using Clever Cloud to deploy <strong>applications runtimes</strong> or <strong>add-ons</strong>. But do you know that all Clever Cloud services are producing <strong>metrics?</strong> And that <a href="https://www.clever.cloud/developers/administrate/metrics/overview/">you already have&nbsp;<strong>access</strong> to all of them</a>? Indeed, we register an <strong>agent</strong> on our side, whose job is to collect all local data.<span id="more-3031"></span>Once it's done, they are stored in a Time Series database called <strong><a href="https://www.warp10.io/">Warp10</a></strong>.</div>
<div><img class="alignleft wp-image-3049 size-full" src="https://cdn.clever-cloud.com/uploads/2021/08/erlenmeyer_logo.png" alt="Erlenmeyer logo" width="643" height="205">
<div>
<div>To simplify the adoption of Warp10, the OVHcloud Metrics team built the <strong><a href="https://github.com/ovh/erlenmeyer">Erlenmeyer</a></strong> tool. In the first place, this tool enables the use of <strong>several open source protocols</strong> as PromQL, OpenTSDB, InfluxQL or Graphite to query Warp10 stored metrics.</div>
<div>Secondly, Erlenmeyer works as a proxy in front of a Warp10 cluster. Then we deployed a couple of&nbsp;Erlenmeyer instances in front of our Warp10 infrastructure, naturally providing new ways to query your application metrics.</div>
</div>
<blockquote>In this post, we will review what Erlenmeyer brings and how to handle Clever Cloud services metrics with <strong>PromQL</strong>.</blockquote>
</div>
<div>
<h2>Erlenmeyer protocols</h2>
<div>
<div>Erlenmeyer almost entirely enables <a href="https://www.ovh.com/blog/erlenmeyer-and-promql-compatibility/">PromQL queries</a>, OpenTSDB, InfluxQL and some of the Graphite functions. Moreover, you can retrieve the documentation about each protocol implementation and usage on Erlenmeyer's GitHub:</div>
<ul>
 	<li><a href="https://github.com/ovh/erlenmeyer/blob/master/doc/promql.md">PromQL</a></li>
 	<li><a href="https://github.com/ovh/erlenmeyer/blob/master/doc/openTSDB.md">OpenTSDB</a></li>
 	<li><a href="https://github.com/ovh/erlenmeyer/blob/master/doc/influxql.md">InfluxQL</a></li>
 	<li><a href="https://github.com/ovh/erlenmeyer/blob/master/doc/graphite.md">Graphite</a></li>
</ul>
On Clever Cloud, we deployed an <code>Erlenmeyer</code> in front of our Warp10 backend. This means <strong>all</strong> these <strong>open source protocols</strong> can be used to query our application Metrics. The <strong>host</strong> is <code>https://PROTO-c1-warp10-clevercloud-customers.services.clever-cloud.com/PROTO</code> with <code>PROTO</code> being:

</div>
<div>
<div>
<ul>
 	<li>for PromQL: <code>prometheus</code>,</li>
 	<li>for OpenTSDB: <code>opentsdb</code>,</li>
 	<li>for InfluxQL: <code>influxql</code>,</li>
 	<li>for Graphite: <code>graphite</code>.</li>
</ul>
<div>To authenticate your request, you need to use the Warp10 READ TOKEN as the password of the basic authentication. You can find it in the metrics panel of any Clever Cloud application:</div>
<div></div>
<div></div>
<div>
<div><img class="aligncenter wp-image-3059 size-full" src="https://cdn.clever-cloud.com/uploads/2021/09/Token.png" alt="Metrics token in the console" width="858" height="359"></div>
<div></div>
</div>
</div>
</div>
<div></div>
<div>
<div>
<div>
<div>
<h2>Retrieve the memory data with PromQL</h2>
<div>As a first step, let's store the Warp10 <code>READ TOKEN</code> and an <code>APP_ID</code> as an <strong>environment variable</strong>:</div>
</div>
<div></div>
</div>
<div>
<div>
<pre><code class="language-shell">export TOKEN=MY_AWESOME_TOKEN # Replace the value by your Clever Cloud Warp10 token
export APP_ID=app_test # Replace the value by one of your own Clever Cloud application
</code></pre>
</div>
</div>
</div>
<div>
<h3>Get raw data</h3>
</div>
<div>
<div>
<div>
<div>To retrieve the <code>mem.used_percent</code> in <strong>PromQL</strong>, we need to send an <code>HTTP GET</code> request to Erlenmeyer, with the TOKEN as basic AUTH. In that case, the PromQL <code>GET</code> request requires four parameters: query, start, end and step. Similarly, to learn more about the PromQL language, you can read the <a href="https://prometheus.io/docs/prometheus/latest/querying/basics/">Prometheus documentation</a>. In our case we will create a simple query to get the raw data:</div>
</div>
</div>
</div>
<div>
<div>
<div>
<pre><code class="language-shell">api/v1/query_range?
query=mem.used_percent{app_id="$APP_ID"}&amp;
start=1623289800&amp;
end=1623311400&amp;
step=120s</code></pre>
</div>
<div>
<div>The <code>query</code> parameter is used for the PromQL queries: <code>start</code> and <code>end</code> are milliseconds timestamps corresponding to the time limit to get data. And the <code>step</code> one is the <strong>sampling</strong> parameter.</div>
<div>As data are collected around every minute, let's set at least twice the duration:&nbsp;<code>120s</code>.</div>
<div></div>
<div>Now, to get the result, execute the following <code>cURL</code> <strong>url encoded</strong>:</div>
<div></div>
</div>
<pre><code class="language-shell">curl --request GET --url "https://u:${TOKEN}@prometheus-c1-warp10-clevercloud-customers.services.clever-cloud.com/prometheus/api/v1/query_range?query=mem.used_percent%7Bapp_id%3D%22${APP_ID}%22%7D&amp;start=1623289800&amp;end=1623311400&amp;step=120s" --header 'Content-Type: application/json'
</code></pre>
<div>
<div>
<h3>Group by example</h3>
A group by query can be useful in the Clever Cloud case to merge some series (multiple deployments or instances). Thus we will <strong>group</strong> data based on the <code>app_id</code> labels in the following example.
<div>We will re-use the stored variable <code>READ_TOKEN</code>&nbsp; and <code>APP_ID</code>. To compute a group by in our case we apply the <code>max</code> PromQL <strong>function</strong> grouped by the series <code>app_id</code> label:</div>
<div></div>
</div>
<pre><code class="language-shell">api/v1/query_range?
query=max(mem.used_percent{app_id="$APP_ID"}) by (app_id)&amp;
start=1623289800&amp;
end=1623311400&amp;
step=120s
</code></pre>
<div>
<div>Finally to get the result, execute the following <code>cURL</code> <strong>url encoded</strong>:</div>
<div></div>
<pre><code class="language-shell">curl --request GET --url "https://u:${TOKEN}@prometheus-c1-warp10-clevercloud-customers.services.clever-cloud.com/prometheus/api/v1/query_range?query=max(mem.used_percent%7Bapp_id%3D%22${APP_ID}%22%7D)%20by%20(app_id)&amp;start=1623289800&amp;end=1623311400&amp;step=120s" --header 'Content-Type: application/json'
</code></pre>
</div>
</div>
<div>
<div>
<h2>Grafana PromQL data source</h2>
You may use <a href="https://grafana.com/">Grafana</a> to create you own dashboards, which is an open source interactive visualisation web application (to deploy a Grafana as a Clever Cloud application, we provide a <a href="https://github.com/CleverCloud/grafana-example">github example</a> and you can also follow this <a href="https://blog.kbdev.io/dev/2021/08/24/grafana-clevercloud.html">French blog post</a>). Of course you can configure a <strong>PromQL</strong> <strong>data source</strong> to get Clever Cloud applications metrics:

</div>
<ul>
 	<li>create a <strong>Prometheus</strong> source,</li>
 	<li>then set Prometheus source <strong>host</strong> to <code>https://prometheus-c1-warp10-clevercloud-customers.services.clever-cloud.com/prometheus</code>,</li>
 	<li>in addition activate the<strong> basic authentication</strong> with a <strong>user</strong> set to <code>metrics</code> and a <strong>password</strong> containing your <code>read Warp10 token</code>,</li>
 	<li>to conclude, click on <code>Save and Test</code>, your Prometheus data source should now be working!</li>
</ul>
</div>
</div>
<div>
<div>
<div>
<div>
<div><img class="aligncenter wp-image-3076 size-full" src="https://cdn.clever-cloud.com/uploads/2021/09/PromQL_source_grafana.png" alt="PromQL Grafana data source configuration" width="773" height="781"></div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<h2>Prometheus UI with remote_read endpoint</h2>
Like with Grafana, you can use <a href="https://prometheus.io/docs/introduction/overview/">Prometheus</a> and plot Clever Cloud metrics in the <strong>Web UI</strong>. And as a matter of fact, simply fill your Prometheus <strong>configuration</strong> with a <strong>remote_read</strong> source:
<pre><code class="language-yaml">api/v1/query_range?
remote_read:
  - url: "https://prometheus-c1-warp10-clevercloud-customers.services.clever-cloud.com/prometheus/remote_read/"
  basic_auth:
    username: "metrics"
    password: "TOKEN"
</code></pre>
<div></div>
<div>Restart Prometheus, then simply execute a Prometheus query in the UI as below:</div>
<pre><code class="language-shell">{ __name__= "mem.used_percent", app_id="$APP_ID" }
</code></pre>
<div>Our backend is able to correctly resolve <code>.</code>&nbsp; which are invalid prometheus characters. Nonetheless the backend response will always translate those <code>.</code> values in series data (name or labels) into valid <code>_</code>.</div>
</div>
<h2>To Sum Up</h2>
As you can see with this post, you can get metrics of Clever Cloud applications and add-ons. Presently you now have <strong>one more way</strong> to query them, as Erlenmeyer allows the use of <code>PromQL</code>. However the drawback is that you will have to <strong>update regularly your token</strong>, as they expire in a few days. We are working on a solution to improve the user experience. First, we will soon provide our customers with access to a <strong>Grafana</strong> with <strong>configured data source and already pre-filled dashboards</strong>. The <strong>token</strong> will be handled on our side and you will then be able to build your own graphs with <code>PromQL</code> or <code>WarpScript</code> queries.

</div>
</div>
</div>]]></description>
										<content:encoded><![CDATA[<p><img width="1400" height="540" src="https://cdn.clever-cloud.com/uploads/2021/10/erlenmeyer-promql-1.jpg" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="erlenmeyer promql 1" decoding="async" loading="lazy" srcset="https://cdn.clever-cloud.com/uploads/2021/10/erlenmeyer-promql-1.jpg 1400w, https://cdn.clever-cloud.com/uploads/2021/10/erlenmeyer-promql-1-300x116.jpg 300w, https://cdn.clever-cloud.com/uploads/2021/10/erlenmeyer-promql-1-1024x395.jpg 1024w, https://cdn.clever-cloud.com/uploads/2021/10/erlenmeyer-promql-1-768x296.jpg 768w, https://cdn.clever-cloud.com/uploads/2021/10/erlenmeyer-promql-1-1368x528.jpg 1368w" sizes="auto, (max-width: 1400px) 100vw, 1400px" /></p><div>You are using Clever Cloud to deploy <strong>applications runtimes</strong> or <strong>add-ons</strong>. But do you know that all Clever Cloud services are producing <strong>metrics?</strong> And that <a href="https://www.clever.cloud/developers/administrate/metrics/overview/">you already have&nbsp;<strong>access</strong> to all of them</a>? Indeed, we register an <strong>agent</strong> on our side, whose job is to collect all local data.<span id="more-3031"></span>Once it's done, they are stored in a Time Series database called <strong><a href="https://www.warp10.io/">Warp10</a></strong>.</div>
<div><img class="alignleft wp-image-3049 size-full" src="https://cdn.clever-cloud.com/uploads/2021/08/erlenmeyer_logo.png" alt="Erlenmeyer logo" width="643" height="205">
<div>
<div>To simplify the adoption of Warp10, the OVHcloud Metrics team built the <strong><a href="https://github.com/ovh/erlenmeyer">Erlenmeyer</a></strong> tool. In the first place, this tool enables the use of <strong>several open source protocols</strong> as PromQL, OpenTSDB, InfluxQL or Graphite to query Warp10 stored metrics.</div>
<div>Secondly, Erlenmeyer works as a proxy in front of a Warp10 cluster. Then we deployed a couple of&nbsp;Erlenmeyer instances in front of our Warp10 infrastructure, naturally providing new ways to query your application metrics.</div>
</div>
<blockquote>In this post, we will review what Erlenmeyer brings and how to handle Clever Cloud services metrics with <strong>PromQL</strong>.</blockquote>
</div>
<div>
<h2>Erlenmeyer protocols</h2>
<div>
<div>Erlenmeyer almost entirely enables <a href="https://www.ovh.com/blog/erlenmeyer-and-promql-compatibility/">PromQL queries</a>, OpenTSDB, InfluxQL and some of the Graphite functions. Moreover, you can retrieve the documentation about each protocol implementation and usage on Erlenmeyer's GitHub:</div>
<ul>
 	<li><a href="https://github.com/ovh/erlenmeyer/blob/master/doc/promql.md">PromQL</a></li>
 	<li><a href="https://github.com/ovh/erlenmeyer/blob/master/doc/openTSDB.md">OpenTSDB</a></li>
 	<li><a href="https://github.com/ovh/erlenmeyer/blob/master/doc/influxql.md">InfluxQL</a></li>
 	<li><a href="https://github.com/ovh/erlenmeyer/blob/master/doc/graphite.md">Graphite</a></li>
</ul>
On Clever Cloud, we deployed an <code>Erlenmeyer</code> in front of our Warp10 backend. This means <strong>all</strong> these <strong>open source protocols</strong> can be used to query our application Metrics. The <strong>host</strong> is <code>https://PROTO-c1-warp10-clevercloud-customers.services.clever-cloud.com/PROTO</code> with <code>PROTO</code> being:

</div>
<div>
<div>
<ul>
 	<li>for PromQL: <code>prometheus</code>,</li>
 	<li>for OpenTSDB: <code>opentsdb</code>,</li>
 	<li>for InfluxQL: <code>influxql</code>,</li>
 	<li>for Graphite: <code>graphite</code>.</li>
</ul>
<div>To authenticate your request, you need to use the Warp10 READ TOKEN as the password of the basic authentication. You can find it in the metrics panel of any Clever Cloud application:</div>
<div></div>
<div></div>
<div>
<div><img class="aligncenter wp-image-3059 size-full" src="https://cdn.clever-cloud.com/uploads/2021/09/Token.png" alt="Metrics token in the console" width="858" height="359"></div>
<div></div>
</div>
</div>
</div>
<div></div>
<div>
<div>
<div>
<div>
<h2>Retrieve the memory data with PromQL</h2>
<div>As a first step, let's store the Warp10 <code>READ TOKEN</code> and an <code>APP_ID</code> as an <strong>environment variable</strong>:</div>
</div>
<div></div>
</div>
<div>
<div>
<pre><code class="language-shell">export TOKEN=MY_AWESOME_TOKEN # Replace the value by your Clever Cloud Warp10 token
export APP_ID=app_test # Replace the value by one of your own Clever Cloud application
</code></pre>
</div>
</div>
</div>
<div>
<h3>Get raw data</h3>
</div>
<div>
<div>
<div>
<div>To retrieve the <code>mem.used_percent</code> in <strong>PromQL</strong>, we need to send an <code>HTTP GET</code> request to Erlenmeyer, with the TOKEN as basic AUTH. In that case, the PromQL <code>GET</code> request requires four parameters: query, start, end and step. Similarly, to learn more about the PromQL language, you can read the <a href="https://prometheus.io/docs/prometheus/latest/querying/basics/">Prometheus documentation</a>. In our case we will create a simple query to get the raw data:</div>
</div>
</div>
</div>
<div>
<div>
<div>
<pre><code class="language-shell">api/v1/query_range?
query=mem.used_percent{app_id="$APP_ID"}&amp;
start=1623289800&amp;
end=1623311400&amp;
step=120s</code></pre>
</div>
<div>
<div>The <code>query</code> parameter is used for the PromQL queries: <code>start</code> and <code>end</code> are milliseconds timestamps corresponding to the time limit to get data. And the <code>step</code> one is the <strong>sampling</strong> parameter.</div>
<div>As data are collected around every minute, let's set at least twice the duration:&nbsp;<code>120s</code>.</div>
<div></div>
<div>Now, to get the result, execute the following <code>cURL</code> <strong>url encoded</strong>:</div>
<div></div>
</div>
<pre><code class="language-shell">curl --request GET --url "https://u:${TOKEN}@prometheus-c1-warp10-clevercloud-customers.services.clever-cloud.com/prometheus/api/v1/query_range?query=mem.used_percent%7Bapp_id%3D%22${APP_ID}%22%7D&amp;start=1623289800&amp;end=1623311400&amp;step=120s" --header 'Content-Type: application/json'
</code></pre>
<div>
<div>
<h3>Group by example</h3>
A group by query can be useful in the Clever Cloud case to merge some series (multiple deployments or instances). Thus we will <strong>group</strong> data based on the <code>app_id</code> labels in the following example.
<div>We will re-use the stored variable <code>READ_TOKEN</code>&nbsp; and <code>APP_ID</code>. To compute a group by in our case we apply the <code>max</code> PromQL <strong>function</strong> grouped by the series <code>app_id</code> label:</div>
<div></div>
</div>
<pre><code class="language-shell">api/v1/query_range?
query=max(mem.used_percent{app_id="$APP_ID"}) by (app_id)&amp;
start=1623289800&amp;
end=1623311400&amp;
step=120s
</code></pre>
<div>
<div>Finally to get the result, execute the following <code>cURL</code> <strong>url encoded</strong>:</div>
<div></div>
<pre><code class="language-shell">curl --request GET --url "https://u:${TOKEN}@prometheus-c1-warp10-clevercloud-customers.services.clever-cloud.com/prometheus/api/v1/query_range?query=max(mem.used_percent%7Bapp_id%3D%22${APP_ID}%22%7D)%20by%20(app_id)&amp;start=1623289800&amp;end=1623311400&amp;step=120s" --header 'Content-Type: application/json'
</code></pre>
</div>
</div>
<div>
<div>
<h2>Grafana PromQL data source</h2>
You may use <a href="https://grafana.com/">Grafana</a> to create you own dashboards, which is an open source interactive visualisation web application (to deploy a Grafana as a Clever Cloud application, we provide a <a href="https://github.com/CleverCloud/grafana-example">github example</a> and you can also follow this <a href="https://blog.kbdev.io/dev/2021/08/24/grafana-clevercloud.html">French blog post</a>). Of course you can configure a <strong>PromQL</strong> <strong>data source</strong> to get Clever Cloud applications metrics:

</div>
<ul>
 	<li>create a <strong>Prometheus</strong> source,</li>
 	<li>then set Prometheus source <strong>host</strong> to <code>https://prometheus-c1-warp10-clevercloud-customers.services.clever-cloud.com/prometheus</code>,</li>
 	<li>in addition activate the<strong> basic authentication</strong> with a <strong>user</strong> set to <code>metrics</code> and a <strong>password</strong> containing your <code>read Warp10 token</code>,</li>
 	<li>to conclude, click on <code>Save and Test</code>, your Prometheus data source should now be working!</li>
</ul>
</div>
</div>
<div>
<div>
<div>
<div>
<div><img class="aligncenter wp-image-3076 size-full" src="https://cdn.clever-cloud.com/uploads/2021/09/PromQL_source_grafana.png" alt="PromQL Grafana data source configuration" width="773" height="781"></div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<h2>Prometheus UI with remote_read endpoint</h2>
Like with Grafana, you can use <a href="https://prometheus.io/docs/introduction/overview/">Prometheus</a> and plot Clever Cloud metrics in the <strong>Web UI</strong>. And as a matter of fact, simply fill your Prometheus <strong>configuration</strong> with a <strong>remote_read</strong> source:
<pre><code class="language-yaml">api/v1/query_range?
remote_read:
  - url: "https://prometheus-c1-warp10-clevercloud-customers.services.clever-cloud.com/prometheus/remote_read/"
  basic_auth:
    username: "metrics"
    password: "TOKEN"
</code></pre>
<div></div>
<div>Restart Prometheus, then simply execute a Prometheus query in the UI as below:</div>
<pre><code class="language-shell">{ __name__= "mem.used_percent", app_id="$APP_ID" }
</code></pre>
<div>Our backend is able to correctly resolve <code>.</code>&nbsp; which are invalid prometheus characters. Nonetheless the backend response will always translate those <code>.</code> values in series data (name or labels) into valid <code>_</code>.</div>
</div>
<h2>To Sum Up</h2>
As you can see with this post, you can get metrics of Clever Cloud applications and add-ons. Presently you now have <strong>one more way</strong> to query them, as Erlenmeyer allows the use of <code>PromQL</code>. However the drawback is that you will have to <strong>update regularly your token</strong>, as they expire in a few days. We are working on a solution to improve the user experience. First, we will soon provide our customers with access to a <strong>Grafana</strong> with <strong>configured data source and already pre-filled dashboards</strong>. The <strong>token</strong> will be handled on our side and you will then be able to build your own graphs with <code>PromQL</code> or <code>WarpScript</code> queries.

</div>
</div>
</div>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Real-Time Applications Metrics now Available</title>
		<link>https://www.clever.cloud/blog/features/2018/01/16/realtime-metrics/</link>
		
		<dc:creator><![CDATA[Laurent Doguin]]></dc:creator>
		<pubDate>Tue, 16 Jan 2018 09:55:00 +0000</pubDate>
				<category><![CDATA[Features]]></category>
		<category><![CDATA[metrics]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[product]]></category>
		<guid isPermaLink="false">https://www2.cleverapps.io/wp/blog/technology/2018/01/16/realtime-metrics/</guid>

					<description><![CDATA[<p><img width="1400" height="540" src="https://cdn.clever-cloud.com/uploads/2021/08/metrics-1.jpg" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="metrics 1" decoding="async" loading="lazy" srcset="https://cdn.clever-cloud.com/uploads/2021/08/metrics-1.jpg 1400w, https://cdn.clever-cloud.com/uploads/2021/08/metrics-1-300x116.jpg 300w, https://cdn.clever-cloud.com/uploads/2021/08/metrics-1-1024x395.jpg 1024w, https://cdn.clever-cloud.com/uploads/2021/08/metrics-1-768x296.jpg 768w, https://cdn.clever-cloud.com/uploads/2021/08/metrics-1-1368x528.jpg 1368w" sizes="auto, (max-width: 1400px) 100vw, 1400px" /></p><p>Glorious day, we are bringing real-time application metrics to all our users.</p>
<span id="more-2925"></span>

<p>Some of you were already Beta testers of our new Metrics solution so a big thank you is in order. Thanks to you and our amazing team, we are officialy rolling out Metrics for all our users today.</p>
<h2 id="current-state">Current State</h2>
<p>Right now if you want to get an idea of the metrics of your application, you have limited choices. You can use a third party tool and manage it yourself. We have several users happily doing that with New Relic. Or you can SSH to your application instance and use local tools like HTOP. It&#39;s not a satisfying situation and we knew we needed to fix it.</p>
<p>Our internal monitoring system (you know that thing that allows your application to restart automatically among other things) was also slowly coming to its limit. So we had to find a new solution.</p>
<h2 id="enter-clever-cloud-metrics">Enter Clever Cloud Metrics</h2>
<p>An original name for an original use case.</p>
<p>Clever Cloud Metrics is the name of our new monitoring solution. It is based on the <a href="http://www.warp10.io/">GeoSpatial Timeseries Database Warp10</a>, Warp10 itself being based on Hadoop and Kafka. This is now what we use on a global scale to monitor all our infrastructure and your applications; to store all the hardware metrics we could get from your VMs. If you are wondering why we made this choice, it&#39;s based on mostly two things.</p>
<p>We had scale issues with most known solutions. Without calling them out, all the new ones try to reimplement their own clustering logic. Warp10 clustering is managed by ZooKeeper (remember it&#39;s Hadoop and Kafka), a proven solution that has been in production for years. Granted, it&#39;s not easy to manage. Good news is it&#39;s our job and that&#39;s why you chose us.</p>
<p>The other appealing reason to us was the Timeseries specialization. It&#39;s perfect for monitoring. When you use a regular datastore, with its regular queryability, it can be hard to do proper time series analysis. To put it simply, SQL does not cut it. <em>Warpscript</em> does:</p>
<blockquote>
WarpScript is an extensible stack oriented programming language which offers more than 600 functions and several high level frameworks to ease and speed your data analysis. Simply create scripts containing your data analysis code and submit them to the platform, they will execute close to where the data resides and you will get the result of that analysis as a JSON object that you can integrate into your application.
</blockquote>

<p>This happens to be exactly what we need. And they made it super easy to use thanks to <a href="http://www.warp10.io/tools/quantum/">Quantum</a>, their query interface based on Polymer (Which means it&#39;s also dead easy to integrate in existing webapps). You will be able to use something similar from the Clever Cloud console to query the metrics of your applications. If you are interested, know that the console&#39;s dashboard is made with <a href="https://www.metricsgraphicsjs.org/">MetricsGraphics.js</a>.</p>
<h2 id="how-it-works">How it Works</h2>
<p>From now on you have a new tab in the console called <strong>Metrics</strong>. It will show you real time graphs of your scalers&#39; hardware resources:</p>
<img src="https://www2.cleverapps.io/app/uploads/2021/08/MetricsDefaultOneInstance.png">

<p>If you don&#39;t see anything it&#39;s probably because you have not enabled Metrics for your application. To do so you need to add the environment variable <code>ENABLE_METRICS=true</code>.</p>
<p>So what exactly do you have access to?</p>
<h2 id="hardware-metrics">Hardware Metrics</h2>
<p>Our default configuration gives you access to a variety of hardware metrics like CPU, RAM, disk IO, network IO. This is of course available for all the scalers of your application.</p>
<img src="https://www2.cleverapps.io/app/uploads/2021/08/MetricsThreeInstances.png">

<h2 id="additional-metrics">Additional Metrics</h2>
<p>Depending on the language and runtime you are using, you also get access to specific metrics. For instance if you are running on top of the JVM and have activated JMX (the classic protocol for everything metrics in the JVM) you will see all of the metrics exposed by JMX. This also works for Haskell&#39;s EKG. If your favorite is missing, please let us know so we can add its support.</p>
<p>Here is an example of a PHP application that gives you by default the number of idle and active workers as well as the number of requests per second.</p>
<img src="https://www2.cleverapps.io/app/uploads/2021/08/PhpMetrics.png">

<p>All these metrics are collected with Statsd. Which means you can also send your own metrics. It&#39;s particularly useful to measure business events. A simple example can be a counter incremented each time a specific API is called. </p>
<pre><code class="language-php">$statsd = new League\StatsD\Client();
$statsd-&gt;configure(array(
    &#39;host&#39; =&gt; &#39;127.0.0.1&#39;,
    &#39;port&#39; =&gt; 8125,
));
$statsd-&gt;increment(&#39;myApi.pageview&#39;);
</code></pre>
<p>To send StatsD data, you need a StatsD client configured for &#39;127.0.0.1&#39; as host and &#39;8125&#39; as port. Here I am using one that is nicely integrated to Lumen from the <a href="https://github.com/thephpleague/statsd">PHP League</a>. Every metric you record yourself are accessible with the <em>statsd</em> prefix. To see it, simply click on Advanced on the top-right corner of the screen, you will be presented with a dropdown:</p>
<video width="100%" autoplay loop >
  <source src="//assets.clever-cloud.com/website/blog/metrics/metrics.mp4" type="video/mp4" />
  <source src="//assets.clever-cloud.com/website/blog/metrics/metrics.webm" type="video/ogg" />
</video>

<h2 id="advanced-usage">Advanced Usage</h2>
<p>Sometimes you want to go the extra step. If you select <em>Custom View</em> in the drop down you will be redirected to the following screen:</p>
<img src="https://www2.cleverapps.io/app/uploads/2021/08/customWarpscript.png">

<p>Click on the Quantum perma link and you will be redirected to our Quantum instance, ready to execute custom queries. From there you can do pretty much whatever you want. Before trying anything if you are not familiar with Stack-based languages and Warpscript please visit <a href="http://www.warp10.io/reference/">their documentation</a>.</p>
<img src="https://www2.cleverapps.io/app/uploads/2021/08/quantum.png">

<h2 id="whats-to-come">What&#39;s to come</h2>
<p>We plan to give you more metrics of course. Wether it comes from our reverse proxy to give you insights on all the requests that go through it or from other runtime frameworks of the like of JMX and EKG. For this we welcome suggestions. Anything you think should be a part of a default monitoring dashboard for this very language or framework, please let us know.</p>
<p>We plan to support the &#39;/_metrics&#39; used by Prometheus. The idea is for our monitoring to regularly poll this endpoint that should send back a JSON containing metrics.</p>
<p>While you can already access the metrics API, in the future you will be able to directly write your own metrics as well.</p>
<p>Please keep in mind that nothing is written in stone for roadmap and things might change :)</p>
<p>We really hope you like this new feature and would love to get your feedback. Please tell us what you think :)</p>
<h2 id="some-resources-to-get-you-started">Some resources to get you started</h2>
<p>We plan to add more of these but here are sample projects that write to a local StatsD intance. There are many others available on Github:</p>
<ul>
<li><a href="https://github.com/CleverCloud/demo-hapi-statsd">NodeJS with Hapi and statsd-client</a></li>
<li><a href="https://github.com/CleverCloud/demo-lumen-statsd">PHP with Lumen</a></li>
<li><a href="https://github.com/CleverCloud/demo-spring-boot-kotlin-statsd/commit/f2c146a2b309d0f0fac40f2b557a796c674e81ac">Kotlin, Spring Boot 2 with micrometrics</a></li>
<li><a href="https://github.com/CleverCloud/demo-go-goji-statsd">Go with Goji</a></li>
<li><a href="https://github.com/CleverCloud/demo-ruby-rack-statsd">Ruby with Rack</a></li>
<li><a href="https://github.com/CleverCloud/demo-python-falcon-statsd">Python with Falcon</a></li>
</ul>
]]></description>
										<content:encoded><![CDATA[<p><img width="1400" height="540" src="https://cdn.clever-cloud.com/uploads/2021/08/metrics-1.jpg" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="metrics 1" decoding="async" loading="lazy" srcset="https://cdn.clever-cloud.com/uploads/2021/08/metrics-1.jpg 1400w, https://cdn.clever-cloud.com/uploads/2021/08/metrics-1-300x116.jpg 300w, https://cdn.clever-cloud.com/uploads/2021/08/metrics-1-1024x395.jpg 1024w, https://cdn.clever-cloud.com/uploads/2021/08/metrics-1-768x296.jpg 768w, https://cdn.clever-cloud.com/uploads/2021/08/metrics-1-1368x528.jpg 1368w" sizes="auto, (max-width: 1400px) 100vw, 1400px" /></p><p>Glorious day, we are bringing real-time application metrics to all our users.</p>
<span id="more-2925"></span>

<p>Some of you were already Beta testers of our new Metrics solution so a big thank you is in order. Thanks to you and our amazing team, we are officialy rolling out Metrics for all our users today.</p>
<h2 id="current-state">Current State</h2>
<p>Right now if you want to get an idea of the metrics of your application, you have limited choices. You can use a third party tool and manage it yourself. We have several users happily doing that with New Relic. Or you can SSH to your application instance and use local tools like HTOP. It&#39;s not a satisfying situation and we knew we needed to fix it.</p>
<p>Our internal monitoring system (you know that thing that allows your application to restart automatically among other things) was also slowly coming to its limit. So we had to find a new solution.</p>
<h2 id="enter-clever-cloud-metrics">Enter Clever Cloud Metrics</h2>
<p>An original name for an original use case.</p>
<p>Clever Cloud Metrics is the name of our new monitoring solution. It is based on the <a href="http://www.warp10.io/">GeoSpatial Timeseries Database Warp10</a>, Warp10 itself being based on Hadoop and Kafka. This is now what we use on a global scale to monitor all our infrastructure and your applications; to store all the hardware metrics we could get from your VMs. If you are wondering why we made this choice, it&#39;s based on mostly two things.</p>
<p>We had scale issues with most known solutions. Without calling them out, all the new ones try to reimplement their own clustering logic. Warp10 clustering is managed by ZooKeeper (remember it&#39;s Hadoop and Kafka), a proven solution that has been in production for years. Granted, it&#39;s not easy to manage. Good news is it&#39;s our job and that&#39;s why you chose us.</p>
<p>The other appealing reason to us was the Timeseries specialization. It&#39;s perfect for monitoring. When you use a regular datastore, with its regular queryability, it can be hard to do proper time series analysis. To put it simply, SQL does not cut it. <em>Warpscript</em> does:</p>
<blockquote>
WarpScript is an extensible stack oriented programming language which offers more than 600 functions and several high level frameworks to ease and speed your data analysis. Simply create scripts containing your data analysis code and submit them to the platform, they will execute close to where the data resides and you will get the result of that analysis as a JSON object that you can integrate into your application.
</blockquote>

<p>This happens to be exactly what we need. And they made it super easy to use thanks to <a href="http://www.warp10.io/tools/quantum/">Quantum</a>, their query interface based on Polymer (Which means it&#39;s also dead easy to integrate in existing webapps). You will be able to use something similar from the Clever Cloud console to query the metrics of your applications. If you are interested, know that the console&#39;s dashboard is made with <a href="https://www.metricsgraphicsjs.org/">MetricsGraphics.js</a>.</p>
<h2 id="how-it-works">How it Works</h2>
<p>From now on you have a new tab in the console called <strong>Metrics</strong>. It will show you real time graphs of your scalers&#39; hardware resources:</p>
<img src="https://www2.cleverapps.io/app/uploads/2021/08/MetricsDefaultOneInstance.png">

<p>If you don&#39;t see anything it&#39;s probably because you have not enabled Metrics for your application. To do so you need to add the environment variable <code>ENABLE_METRICS=true</code>.</p>
<p>So what exactly do you have access to?</p>
<h2 id="hardware-metrics">Hardware Metrics</h2>
<p>Our default configuration gives you access to a variety of hardware metrics like CPU, RAM, disk IO, network IO. This is of course available for all the scalers of your application.</p>
<img src="https://www2.cleverapps.io/app/uploads/2021/08/MetricsThreeInstances.png">

<h2 id="additional-metrics">Additional Metrics</h2>
<p>Depending on the language and runtime you are using, you also get access to specific metrics. For instance if you are running on top of the JVM and have activated JMX (the classic protocol for everything metrics in the JVM) you will see all of the metrics exposed by JMX. This also works for Haskell&#39;s EKG. If your favorite is missing, please let us know so we can add its support.</p>
<p>Here is an example of a PHP application that gives you by default the number of idle and active workers as well as the number of requests per second.</p>
<img src="https://www2.cleverapps.io/app/uploads/2021/08/PhpMetrics.png">

<p>All these metrics are collected with Statsd. Which means you can also send your own metrics. It&#39;s particularly useful to measure business events. A simple example can be a counter incremented each time a specific API is called. </p>
<pre><code class="language-php">$statsd = new League\StatsD\Client();
$statsd-&gt;configure(array(
    &#39;host&#39; =&gt; &#39;127.0.0.1&#39;,
    &#39;port&#39; =&gt; 8125,
));
$statsd-&gt;increment(&#39;myApi.pageview&#39;);
</code></pre>
<p>To send StatsD data, you need a StatsD client configured for &#39;127.0.0.1&#39; as host and &#39;8125&#39; as port. Here I am using one that is nicely integrated to Lumen from the <a href="https://github.com/thephpleague/statsd">PHP League</a>. Every metric you record yourself are accessible with the <em>statsd</em> prefix. To see it, simply click on Advanced on the top-right corner of the screen, you will be presented with a dropdown:</p>
<video width="100%" autoplay loop >
  <source src="//assets.clever-cloud.com/website/blog/metrics/metrics.mp4" type="video/mp4" />
  <source src="//assets.clever-cloud.com/website/blog/metrics/metrics.webm" type="video/ogg" />
</video>

<h2 id="advanced-usage">Advanced Usage</h2>
<p>Sometimes you want to go the extra step. If you select <em>Custom View</em> in the drop down you will be redirected to the following screen:</p>
<img src="https://www2.cleverapps.io/app/uploads/2021/08/customWarpscript.png">

<p>Click on the Quantum perma link and you will be redirected to our Quantum instance, ready to execute custom queries. From there you can do pretty much whatever you want. Before trying anything if you are not familiar with Stack-based languages and Warpscript please visit <a href="http://www.warp10.io/reference/">their documentation</a>.</p>
<img src="https://www2.cleverapps.io/app/uploads/2021/08/quantum.png">

<h2 id="whats-to-come">What&#39;s to come</h2>
<p>We plan to give you more metrics of course. Wether it comes from our reverse proxy to give you insights on all the requests that go through it or from other runtime frameworks of the like of JMX and EKG. For this we welcome suggestions. Anything you think should be a part of a default monitoring dashboard for this very language or framework, please let us know.</p>
<p>We plan to support the &#39;/_metrics&#39; used by Prometheus. The idea is for our monitoring to regularly poll this endpoint that should send back a JSON containing metrics.</p>
<p>While you can already access the metrics API, in the future you will be able to directly write your own metrics as well.</p>
<p>Please keep in mind that nothing is written in stone for roadmap and things might change :)</p>
<p>We really hope you like this new feature and would love to get your feedback. Please tell us what you think :)</p>
<h2 id="some-resources-to-get-you-started">Some resources to get you started</h2>
<p>We plan to add more of these but here are sample projects that write to a local StatsD intance. There are many others available on Github:</p>
<ul>
<li><a href="https://github.com/CleverCloud/demo-hapi-statsd">NodeJS with Hapi and statsd-client</a></li>
<li><a href="https://github.com/CleverCloud/demo-lumen-statsd">PHP with Lumen</a></li>
<li><a href="https://github.com/CleverCloud/demo-spring-boot-kotlin-statsd/commit/f2c146a2b309d0f0fac40f2b557a796c674e81ac">Kotlin, Spring Boot 2 with micrometrics</a></li>
<li><a href="https://github.com/CleverCloud/demo-go-goji-statsd">Go with Goji</a></li>
<li><a href="https://github.com/CleverCloud/demo-ruby-rack-statsd">Ruby with Rack</a></li>
<li><a href="https://github.com/CleverCloud/demo-python-falcon-statsd">Python with Falcon</a></li>
</ul>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
