<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>database_observability on Grafana Labs</title><link>https://grafana.com/docs/alloy/v1.22/reference/components/database_observability/</link><description>Recent content in database_observability on Grafana Labs</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="/docs/alloy/v1.22/reference/components/database_observability/index.xml" rel="self" type="application/rss+xml"/><item><title>database_observability.mysql</title><link>https://grafana.com/docs/alloy/v1.22/reference/components/database_observability/database_observability.mysql/</link><pubDate>Fri, 13 Nov 2026 04:21:39 +0000</pubDate><guid>https://grafana.com/docs/alloy/v1.22/reference/components/database_observability/database_observability.mysql/</guid><content><![CDATA[&lt;h1 id=&#34;database_observabilitymysql&#34;&gt;&lt;code&gt;database_observability.mysql&lt;/code&gt;&lt;/h1&gt;
&lt;p&gt;&lt;code&gt;database_observability.mysql&lt;/code&gt; connects to a MySQL database and collects observability data from the &lt;code&gt;performance_schema&lt;/code&gt; and &lt;code&gt;information_schema&lt;/code&gt;.
The component collects query details, schema information, explain plans, query samples, and lock information.
It forwards this data as log entries to Loki receivers and exports targets for Prometheus scraping.&lt;/p&gt;
&lt;h2 id=&#34;usage&#34;&gt;Usage&lt;/h2&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Alloy&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-alloy&#34;&gt;database_observability.mysql &amp;#34;&amp;lt;LABEL&amp;gt;&amp;#34; {
  data_source_name = &amp;lt;DATA_SOURCE_NAME&amp;gt;
  forward_to       = [&amp;lt;LOKI_RECEIVERS&amp;gt;]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;p&gt;You can use the following arguments with &lt;code&gt;database_observability.mysql&lt;/code&gt;:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;data_source_name&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;secret&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;a href=&#34;https://github.com/go-sql-driver/mysql#dsn-data-source-name&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Data Source Name&lt;/a&gt; for the MySQL server to connect to. Required when no &lt;code&gt;database_instance&lt;/code&gt; blocks are defined.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;forward_to&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;list(LogsReceiver)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Where to forward log entries after processing.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;targets&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;list(map(string))&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;List of external targets to scrape.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;disable_collectors&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;list(string)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;A list of collectors to disable from the default set.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;enable_collectors&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;list(string)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;A list of collectors to enable on top of the default set.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;exclude_schemas&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;list(string)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;A list of schemas to exclude from monitoring on top of the default exclusions.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;[&amp;quot;alloydbadmin&amp;quot;, &amp;quot;alloydbmetadata&amp;quot;, &amp;quot;azure_maintenance&amp;quot;, &amp;quot;azure_sys&amp;quot;, &amp;quot;cloudsqladmin&amp;quot;, &amp;quot;rdsadmin&amp;quot;]&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;include_schemas&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;list(string)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;A list of schemas to monitor. When empty, all non-excluded schemas are monitored. Items in &lt;code&gt;include_schemas&lt;/code&gt; override the default exclusions, but cannot overlap with &lt;code&gt;exclude_schemas&lt;/code&gt; or system schemas (&lt;code&gt;mysql&lt;/code&gt;, &lt;code&gt;performance_schema&lt;/code&gt;, &lt;code&gt;sys&lt;/code&gt;, &lt;code&gt;information_schema&lt;/code&gt;).&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;[]&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;allow_update_performance_schema_settings&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;boolean&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Whether to allow updates to &lt;code&gt;performance_schema&lt;/code&gt; settings in any collector. Enable this in conjunction with other collector-specific settings where required.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;false&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;The following collectors are configurable:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Enabled by default&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;query_details&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Collect queries information.&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;schema_details&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Collect schemas and tables from &lt;code&gt;information_schema&lt;/code&gt;.&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;query_samples&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Collect query samples.&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;setup_consumers&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Collect enabled &lt;code&gt;performance_schema.setup_consumers&lt;/code&gt;.&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;setup_actors&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Check and update &lt;code&gt;performance_schema.setup_actors&lt;/code&gt; settings.&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;locks&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Collect queries that are waiting/blocking other queries.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;explain_plans&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Collect explain plans information.&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;blocks&#34;&gt;Blocks&lt;/h2&gt;
&lt;p&gt;You can use the following blocks with &lt;code&gt;database_observability.mysql&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;config-app&#34; style=&#34;--config-tree-row-count: 17;&#34; x3-data=&#34;configVisualizer(&amp;#34;\u003csection class=\&amp;#34;expand-table-wrapper\&amp;#34;\u003e\u003cdiv class=\&amp;#34;button-div\&amp;#34;\u003e\n      \u003cbutton class=\&amp;#34;expand-table-btn\&amp;#34;\u003eExpand table\u003c/button\u003e\n    \u003c/div\u003e\u003cdiv class=\&amp;#34;responsive-table-wrapper\&amp;#34;\u003e\n    \u003ctable\u003e\n      \u003cthead\u003e\n          \u003ctr\u003e\n              \u003cth\u003eBlock\u003c/th\u003e\n              \u003cth\u003eDescription\u003c/th\u003e\n              \u003cth\u003eRequired\u003c/th\u003e\n          \u003c/tr\u003e\n      \u003c/thead\u003e\n      \u003ctbody\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#cloud_provider\&amp;#34;\u003e\u003ccode\u003ecloud_provider\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eProvide Cloud Provider information.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ccode\u003ecloud_provider\u003c/code\u003e \u0026gt; \u003ca href=\&amp;#34;#aws\&amp;#34;\u003e\u003ccode\u003eaws\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eProvide AWS database host information.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ccode\u003ecloud_provider\u003c/code\u003e \u0026gt; \u003ca href=\&amp;#34;#azure\&amp;#34;\u003e\u003ccode\u003eazure\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eProvide Azure database host information.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ccode\u003ecloud_provider\u003c/code\u003e \u0026gt; \u003ca href=\&amp;#34;#gcp\&amp;#34;\u003e\u003ccode\u003egcp\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eProvide GCP database host information.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#database_instance\&amp;#34;\u003e\u003ccode\u003edatabase_instance\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eDefine one database to monitor. Repeat the block to monitor several databases.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ccode\u003edatabase_instance\u003c/code\u003e \u0026gt; \u003ca href=\&amp;#34;#cloud_provider\&amp;#34;\u003e\u003ccode\u003ecloud_provider\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eProvide Cloud Provider information for one database.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ccode\u003edatabase_instance\u003c/code\u003e \u0026gt; \u003ca href=\&amp;#34;#rule\&amp;#34;\u003e\u003ccode\u003erule\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eRelabel the metrics and logs of one database.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#clustering\&amp;#34;\u003e\u003ccode\u003eclustering\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eConfigure the component for when Alloy is running in clustered mode.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#setup_consumers\&amp;#34;\u003e\u003ccode\u003esetup_consumers\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eConfigure the \u003ccode\u003esetup_consumers\u003c/code\u003e collector.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#setup_actors\&amp;#34;\u003e\u003ccode\u003esetup_actors\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eConfigure the \u003ccode\u003esetup_actors\u003c/code\u003e collector.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#query_details\&amp;#34;\u003e\u003ccode\u003equery_details\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eConfigure the queries collector.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#schema_details\&amp;#34;\u003e\u003ccode\u003eschema_details\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eConfigure the schema and table details collector.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#explain_plans\&amp;#34;\u003e\u003ccode\u003eexplain_plans\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eConfigure the explain plans collector.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#locks\&amp;#34;\u003e\u003ccode\u003elocks\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eConfigure the locks collector.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#query_samples\&amp;#34;\u003e\u003ccode\u003equery_samples\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eConfigure the query samples collector.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#health_check\&amp;#34;\u003e\u003ccode\u003ehealth_check\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eConfigure the health check collector.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#prometheus_exporter\&amp;#34;\u003e\u003ccode\u003eprometheus_exporter\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eConfigure the embedded mysqld_exporter.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n      \u003c/tbody\u003e\n    \u003c/table\u003e\n  \u003c/div\u003e\n\u003c/section\u003e&amp;#34;)&#34;&gt;
  &lt;noscript&gt;
    &lt;div class=&#34;config-app__noscript&#34;&gt;&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Block&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#cloud_provider&#34;&gt;&lt;code&gt;cloud_provider&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Provide Cloud Provider information.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;cloud_provider&lt;/code&gt; &amp;gt; &lt;a href=&#34;#aws&#34;&gt;&lt;code&gt;aws&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Provide AWS database host information.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;cloud_provider&lt;/code&gt; &amp;gt; &lt;a href=&#34;#azure&#34;&gt;&lt;code&gt;azure&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Provide Azure database host information.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;cloud_provider&lt;/code&gt; &amp;gt; &lt;a href=&#34;#gcp&#34;&gt;&lt;code&gt;gcp&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Provide GCP database host information.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#database_instance&#34;&gt;&lt;code&gt;database_instance&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Define one database to monitor. Repeat the block to monitor several databases.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_instance&lt;/code&gt; &amp;gt; &lt;a href=&#34;#cloud_provider&#34;&gt;&lt;code&gt;cloud_provider&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Provide Cloud Provider information for one database.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_instance&lt;/code&gt; &amp;gt; &lt;a href=&#34;#rule&#34;&gt;&lt;code&gt;rule&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Relabel the metrics and logs of one database.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#clustering&#34;&gt;&lt;code&gt;clustering&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Configure the component for when Alloy is running in clustered mode.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#setup_consumers&#34;&gt;&lt;code&gt;setup_consumers&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Configure the &lt;code&gt;setup_consumers&lt;/code&gt; collector.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#setup_actors&#34;&gt;&lt;code&gt;setup_actors&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Configure the &lt;code&gt;setup_actors&lt;/code&gt; collector.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#query_details&#34;&gt;&lt;code&gt;query_details&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Configure the queries collector.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#schema_details&#34;&gt;&lt;code&gt;schema_details&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Configure the schema and table details collector.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#explain_plans&#34;&gt;&lt;code&gt;explain_plans&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Configure the explain plans collector.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#locks&#34;&gt;&lt;code&gt;locks&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Configure the locks collector.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#query_samples&#34;&gt;&lt;code&gt;query_samples&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Configure the query samples collector.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#health_check&#34;&gt;&lt;code&gt;health_check&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Configure the health check collector.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#prometheus_exporter&#34;&gt;&lt;code&gt;prometheus_exporter&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Configure the embedded mysqld_exporter.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;/div&gt;
  &lt;/noscript&gt;
  &lt;main class=&#34;config-app__main&#34;&gt;
    &lt;template x3-if=&#34;flatBlocks.length === 0&#34;&gt;
      &lt;div class=&#34;empty-state&#34;&gt;
        &lt;div class=&#34;empty-state__icon&#34; x3-html=&#34;icons.AlertCircle&#34;&gt;&lt;/div&gt;
        &lt;p&gt;No valid configuration blocks found.&lt;/p&gt;
      &lt;/div&gt;
    &lt;/template&gt;

    &lt;template x3-if=&#34;flatBlocks.length &gt; 0&#34;&gt;
      &lt;div class=&#34;config-tree&#34;&gt;
        &lt;div class=&#34;config-tree__toolbar&#34;&gt;
          &lt;div class=&#34;config-tree__title&#34;&gt;&lt;/div&gt;
          &lt;button
            class=&#34;tree-explorer__button w-130 text-right&#34;
            x3-on:click=&#34;toggleExpandAll&#34;
            x3-bind:title=&#34;allExpanded ? &#39;Collapse all&#39; : &#39;Expand all&#39;&#34;
          &gt;
            &lt;span x3-text=&#34;allExpanded ? &#39;Collapse all&#39; : &#39;Expand all&#39;&#34;&gt;&lt;/span&gt;
            &lt;svg class=&#34;api-icon&#34; viewBox=&#34;0 0 24 24&#34;&gt;
              &lt;path x3-show=&#34;!allExpanded&#34; d=&#34;m6 9 6 6 6-6&#34; /&gt;
              &lt;path x3-show=&#34;allExpanded&#34; d=&#34;m18 15-6-6-6 6&#34; /&gt;
            &lt;/svg&gt;
          &lt;/button&gt;
        &lt;/div&gt;

        &lt;div class=&#34;nodes-container&#34;&gt;
          &lt;template x3-for=&#34;block in flatBlocks&#34; x3-bind:key=&#34;block.id&#34;&gt;
            &lt;div class=&#34;node&#34; x3-bind:class=&#34;isNodeVisible(block) ? &#39;node--visible&#39; : &#39;node--hidden&#39;&#34;&gt;
              &lt;div
                class=&#34;node__row&#34;
                x3-bind:class=&#34;getRowClass(block)&#34;
                x3-bind:style=&#34;`padding-left: ${block.level * 24 &#43; 16}px`&#34;
                x3-on:click=&#34;toggleNode(block.id)&#34;
              &gt;
                &lt;div class=&#34;node__left&#34;&gt;
                  &lt;div class=&#34;node__indicator&#34;&gt;
                    &lt;template x3-if=&#34;block.hasChildren&#34;&gt;
                      &lt;button type=&#34;button&#34; class=&#34;node__toggle&#34; x3-on:click.stop=&#34;toggleNode(block.id)&#34;&gt;
                        &lt;div
                          class=&#34;node__toggle-icon&#34;
                          x3-bind:class=&#34;block.expanded ? &#39;node__toggle-icon--expanded&#39; : &#39;&#39;&#34;
                          x3-html=&#34;icons.ChevronDown&#34;
                        &gt;&lt;/div&gt;
                      &lt;/button&gt;
                    &lt;/template&gt;
                    &lt;template x3-if=&#34;!block.hasChildren&#34;&gt;
                      &lt;div class=&#34;node__toggle-spacer&#34;&gt;&lt;/div&gt;
                    &lt;/template&gt;
                  &lt;/div&gt;

                  &lt;div class=&#34;node__content&#34;&gt;
                    &lt;div
                      class=&#34;node__title prose&#34;
                      x3-bind:class=&#34;block.level === 0 ? &#39;node__title--root&#39; : &#39;node__title--nested&#39;&#34;
                      x3-html=&#34;block.displayName&#34;
                    &gt;&lt;/div&gt;
                    &lt;div class=&#34;node__description body-xsmall&#34; x3-html=&#34;block.description&#34;&gt;&lt;/div&gt;
                  &lt;/div&gt;
                &lt;/div&gt;

                &lt;div class=&#34;node__meta&#34;&gt;
                  &lt;span
                    class=&#34;badge&#34;
                    x3-bind:class=&#34;block.required ? &#39;badge--required&#39; : &#39;badge--optional&#39;&#34;
                    x3-text=&#34;block.required ? &#39;Required&#39; : &#39;Optional&#39;&#34;
                  &gt;&lt;/span&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;
          &lt;/template&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/template&gt;
  &lt;/main&gt;
&lt;/div&gt;

&lt;h3 id=&#34;cloud_provider&#34;&gt;&lt;code&gt;cloud_provider&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;cloud_provider&lt;/code&gt; block has no attributes.
It contains zero or one of the &lt;a href=&#34;#aws&#34;&gt;&lt;code&gt;aws&lt;/code&gt;&lt;/a&gt;, &lt;a href=&#34;#azure&#34;&gt;&lt;code&gt;azure&lt;/code&gt;&lt;/a&gt;, or &lt;a href=&#34;#gcp&#34;&gt;&lt;code&gt;gcp&lt;/code&gt;&lt;/a&gt; blocks.
You use the &lt;code&gt;cloud_provider&lt;/code&gt; block to provide information related to the cloud provider that hosts the database under observation.
This information is appended as labels to the collected metrics.
The labels make it easier for you to filter and group your metrics.&lt;/p&gt;
&lt;h3 id=&#34;aws&#34;&gt;&lt;code&gt;aws&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;aws&lt;/code&gt; block supplies the &lt;a href=&#34;https://docs.aws.amazon.com/IAM/latest/UserGuide/reference-arns.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;ARN&lt;/a&gt; identifier for the database being monitored.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;arn&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The ARN associated with the database under observation.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;azure&#34;&gt;&lt;code&gt;azure&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;azure&lt;/code&gt; block supplies the identifying information for the database being monitored.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;subscription_id&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The Subscription ID for your Azure account.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;resource_group&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The Resource Group that holds the database resource.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;server_name&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The database server name, for example &lt;code&gt;orders-db&lt;/code&gt; for the host &lt;code&gt;orders-db.mysql.database.azure.com&lt;/code&gt;.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;gcp&#34;&gt;&lt;code&gt;gcp&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;gcp&lt;/code&gt; block supplies the identifying information for the GCP Cloud SQL database being monitored.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;connection_name&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The Cloud SQL instance connection name in the format &lt;code&gt;project:region:instance&lt;/code&gt;, for example &lt;code&gt;my-project:us-central1:my-db&lt;/code&gt;.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;database_instance&#34;&gt;&lt;code&gt;database_instance&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;database_instance&lt;/code&gt; block defines one database server to monitor.
Repeat the block to monitor several databases with a single component.
The block label must be unique across &lt;code&gt;database_instance&lt;/code&gt; blocks and identifies the database in the component&amp;rsquo;s metrics endpoint path.
Each &lt;code&gt;database_instance&lt;/code&gt; block must also point to a distinct server: two blocks that resolve to the same host, port, and database name are rejected.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;data_source_name&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;secret&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;a href=&#34;https://github.com/go-sql-driver/mysql#dsn-data-source-name&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Data Source Name&lt;/a&gt; for the MySQL server to connect to.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;Each &lt;code&gt;database_instance&lt;/code&gt; block can also contain a [&lt;code&gt;cloud_provider&lt;/code&gt;][cloud_provider] block that applies to that database only, and [&lt;code&gt;rule&lt;/code&gt;][rule] blocks that relabel the metrics and logs of that database only.&lt;/p&gt;
&lt;p&gt;The component always embeds a &lt;code&gt;mysqld_exporter&lt;/code&gt; for each &lt;code&gt;database_instance&lt;/code&gt; block and serves its metrics on the block&amp;rsquo;s metrics path.
Use the [&lt;code&gt;prometheus_exporter&lt;/code&gt;][prometheus_exporter] block to configure it.
External exporter targets are only supported in the top-level single-DSN form.&lt;/p&gt;
&lt;p&gt;When you define &lt;code&gt;database_instance&lt;/code&gt; blocks, don&amp;rsquo;t set the top-level &lt;code&gt;data_source_name&lt;/code&gt;, &lt;code&gt;targets&lt;/code&gt;, and &lt;code&gt;cloud_provider&lt;/code&gt; arguments.
They&amp;rsquo;re mutually exclusive with &lt;code&gt;database_instance&lt;/code&gt; blocks.
All other arguments and blocks, such as collector settings and &lt;code&gt;prometheus_exporter&lt;/code&gt;, apply to every configured database.&lt;/p&gt;
&lt;p&gt;The metrics for each database are served on a separate &lt;code&gt;/db/&amp;lt;LABEL&amp;gt;/metrics&lt;/code&gt; path under the component&amp;rsquo;s HTTP endpoint, and the exported targets point to the corresponding path.
When you don&amp;rsquo;t define &lt;code&gt;database_instance&lt;/code&gt; blocks, the component serves metrics on its historical &lt;code&gt;/metrics&lt;/code&gt; path.
The metrics endpoints are served exactly at those paths: requests to any other path under the component&amp;rsquo;s HTTP endpoint return HTTP 404.&lt;/p&gt;
&lt;p&gt;For example:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Alloy&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-alloy&#34;&gt;database_observability.mysql &amp;#34;pool&amp;#34; {
  forward_to = [loki.write.logs_service.receiver]

  database_instance &amp;#34;orders&amp;#34; {
    data_source_name = sys.env(&amp;#34;ORDERS_DSN&amp;#34;)

    cloud_provider {
      aws {
        arn = &amp;#34;orders-rds-db-arn&amp;#34;
      }
    }

    rule {
      target_label = &amp;#34;environment&amp;#34;
      replacement  = &amp;#34;production&amp;#34;
    }
  }

  database_instance &amp;#34;billing&amp;#34; {
    data_source_name = sys.env(&amp;#34;BILLING_DSN&amp;#34;)

    rule {
      target_label = &amp;#34;environment&amp;#34;
      replacement  = &amp;#34;staging&amp;#34;
    }
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;In this example, the metrics and logs of the &lt;code&gt;orders&lt;/code&gt; database carry &lt;code&gt;environment=&amp;quot;production&amp;quot;&lt;/code&gt;, and those of the &lt;code&gt;billing&lt;/code&gt; database carry &lt;code&gt;environment=&amp;quot;staging&amp;quot;&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;rule&#34;&gt;&lt;code&gt;rule&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;rule&lt;/code&gt; block relabels the metrics and the logs of the &lt;code&gt;database_instance&lt;/code&gt; block that contains it.
Use it to tell the data of each monitored database apart, for example by environment, team, or tier.&lt;/p&gt;


&lt;div data-shared=&#34;reference/components/rule-block-database-observability.md&#34;&gt;
            &lt;p&gt;The &lt;code&gt;rule&lt;/code&gt; block defines a relabeling rule applied to the metrics and the logs of a single monitored database.
If you define more than one &lt;code&gt;rule&lt;/code&gt; block, the rules are applied in top-down order, after the labels the component sets itself, so a rule can read those labels with &lt;code&gt;source_labels&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;It takes the same arguments as the 
    &lt;a href=&#34;/docs/alloy/v1.22/reference/components/prometheus/prometheus.relabel/#rule&#34;&gt;&lt;code&gt;rule&lt;/code&gt; block&lt;/a&gt; used elsewhere in Alloy, in a restricted form: because one rule set applies to two signal paths, it supports the labelling actions only, and it can&amp;rsquo;t overwrite most of the labels the component sets.
Alloy refuses to load a configuration containing a rule that breaks either restriction, so such a rule is never silently ignored.&lt;/p&gt;
&lt;p&gt;Two further constraints are specific to a &lt;code&gt;database_instance&lt;/code&gt; block:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;target_label&lt;/code&gt; must be a literal label name&lt;/strong&gt;: Alloy checks it against the reserved labels when it loads the configuration, so it can&amp;rsquo;t contain a capture group reference.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;hashmod&lt;/code&gt; requires &lt;code&gt;source_labels&lt;/code&gt;, and can&amp;rsquo;t target &lt;code&gt;instance&lt;/code&gt;&lt;/strong&gt;: hashing the empty value gives every database the same result, and hashing into &lt;code&gt;instance&lt;/code&gt; buckets several databases onto one value even when the source is present.&lt;/li&gt;
&lt;/ul&gt;


&lt;div class=&#34;admonition admonition-caution&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Caution&lt;/p&gt;&lt;p&gt;A relabeling rule that computes an empty value &lt;em&gt;removes&lt;/em&gt; its target label instead of setting it, and the default &lt;code&gt;replacement&lt;/code&gt; of &lt;code&gt;&amp;quot;$1&amp;quot;&lt;/code&gt; computes an empty value when a rule has no &lt;code&gt;source_labels&lt;/code&gt;.
So &lt;code&gt;rule { target_label = &amp;quot;environment&amp;quot; }&lt;/code&gt; removes &lt;code&gt;environment&lt;/code&gt; rather than setting it, and Alloy rejects it.
Always set &lt;code&gt;replacement&lt;/code&gt; alongside a &lt;code&gt;target_label&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Alloy can only reject such a rule where the outcome is certain.
A rule that reads &lt;code&gt;source_labels&lt;/code&gt; depends on the labels present at runtime, so a missing or misspelled source label still removes the target label, except for the reserved labels and &lt;code&gt;instance&lt;/code&gt;, which keep their previous value.
Only removal is prevented: a rule that computes a &lt;em&gt;non-empty&lt;/em&gt; value still overwrites those labels, which is why &lt;code&gt;hashmod&lt;/code&gt; can&amp;rsquo;t target &lt;code&gt;instance&lt;/code&gt; at all.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;You can use the &lt;code&gt;hashmod&lt;/code&gt;, &lt;code&gt;labeldrop&lt;/code&gt;, &lt;code&gt;lowercase&lt;/code&gt;, &lt;code&gt;replace&lt;/code&gt;, and &lt;code&gt;uppercase&lt;/code&gt; actions.
The rest aren&amp;rsquo;t supported:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;drop&lt;/code&gt;, &lt;code&gt;dropequal&lt;/code&gt;, &lt;code&gt;keep&lt;/code&gt;, and &lt;code&gt;keepequal&lt;/code&gt; filter rather than label, and filtering means two different things on the two signal paths. Dropping a metrics target stops the database exporting metrics entirely, whereas dropping a log entry discards one line. To filter one database&amp;rsquo;s logs, use a 
    &lt;a href=&#34;/docs/alloy/v1.22/reference/components/loki/loki.relabel/&#34;&gt;&lt;code&gt;loki.relabel&lt;/code&gt;&lt;/a&gt; component on the receiver named in &lt;code&gt;forward_to&lt;/code&gt;, with a &lt;code&gt;drop&lt;/code&gt; rule that matches that database&amp;rsquo;s &lt;code&gt;instance&lt;/code&gt; or &lt;code&gt;server_id&lt;/code&gt;. Every database the component monitors forwards to the same receivers, so the rule has to identify the one it applies to. To filter one database&amp;rsquo;s metrics, use a 
    &lt;a href=&#34;/docs/alloy/v1.22/reference/components/discovery/discovery.relabel/&#34;&gt;&lt;code&gt;discovery.relabel&lt;/code&gt;&lt;/a&gt; component on the component&amp;rsquo;s exported targets.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;labelmap&lt;/code&gt; builds label names from &lt;code&gt;replacement&lt;/code&gt; at runtime, so Alloy can&amp;rsquo;t check them against the reserved labels when it loads the configuration.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;labelkeep&lt;/code&gt; removes every label its &lt;code&gt;regex&lt;/code&gt; doesn&amp;rsquo;t match, so a rule that preserves the reserved labels would have to match all of them. Use &lt;code&gt;labeldrop&lt;/code&gt; to remove specific labels instead.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Because the rules run after the component&amp;rsquo;s own labels, and those are protected, a &lt;code&gt;labeldrop&lt;/code&gt; rule can only remove a label that an earlier rule in the same block created.&lt;/p&gt;
&lt;h4 id=&#34;reserved-labels&#34;&gt;Reserved labels&lt;/h4&gt;
&lt;p&gt;A rule can&amp;rsquo;t write to the following labels, and a &lt;code&gt;labeldrop&lt;/code&gt; regular expression can&amp;rsquo;t match them:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Both metrics and logs&lt;/strong&gt;: &lt;code&gt;job&lt;/code&gt; and &lt;code&gt;server_id&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Logs only&lt;/strong&gt;: &lt;code&gt;engine&lt;/code&gt; and &lt;code&gt;op&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Metrics only&lt;/strong&gt;: &lt;code&gt;provider_name&lt;/code&gt;, &lt;code&gt;provider_region&lt;/code&gt;, &lt;code&gt;provider_account&lt;/code&gt;, &lt;code&gt;__address__&lt;/code&gt;, &lt;code&gt;__scheme__&lt;/code&gt;, and &lt;code&gt;__metrics_path__&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This applies to &lt;code&gt;rule&lt;/code&gt; blocks only.
A downstream &lt;code&gt;discovery.relabel&lt;/code&gt; or &lt;code&gt;loki.relabel&lt;/code&gt; component can still overwrite any of them, but it applies to every database the component monitors rather than one.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;instance&lt;/code&gt; label is a special case: a rule can rewrite its value, which is a common reason to use a &lt;code&gt;rule&lt;/code&gt; block, because a friendly name such as &lt;code&gt;orders_db&lt;/code&gt; then applies to that database&amp;rsquo;s metrics and logs together.
A rule can&amp;rsquo;t remove it, because metrics and logs are correlated on it, and because an empty &lt;code&gt;instance&lt;/code&gt; on a metrics target makes Prometheus fill it in from &lt;code&gt;__address__&lt;/code&gt;, which every database in one component shares, collapsing them all onto one series.&lt;/p&gt;
&lt;p&gt;For the same reason, two &lt;code&gt;database_instance&lt;/code&gt; blocks can&amp;rsquo;t rewrite &lt;code&gt;instance&lt;/code&gt; to the same value.
Alloy rejects that when both values are fixed in the configuration, but it can&amp;rsquo;t when the value comes from a label the databases share: &lt;code&gt;source_labels = [&amp;quot;job&amp;quot;]&lt;/code&gt; gives every database the same &lt;code&gt;instance&lt;/code&gt;, since they all carry the same &lt;code&gt;job&lt;/code&gt;.
Derive &lt;code&gt;instance&lt;/code&gt; from something that differs per database, or set a literal value in each block.&lt;/p&gt;
&lt;h4 id=&#34;labels-set-on-only-one-signal-path&#34;&gt;Labels set on only one signal path&lt;/h4&gt;
&lt;p&gt;Some of the labels above exist on one signal path and not the other, and a rule that reads one with &lt;code&gt;source_labels&lt;/code&gt; behaves differently on each path: where the label is absent the rule computes an empty value, which &lt;em&gt;removes&lt;/em&gt; its &lt;code&gt;target_label&lt;/code&gt; rather than setting it to an empty string.&lt;/p&gt;
&lt;p&gt;A rule reading &lt;code&gt;provider_region&lt;/code&gt;, which a database with a &lt;a href=&#34;#cloud_provider&#34;&gt;&lt;code&gt;cloud_provider&lt;/code&gt;&lt;/a&gt; block carries on its metrics targets but not on its log entries, sets &lt;code&gt;region&lt;/code&gt; on that database&amp;rsquo;s metrics and removes &lt;code&gt;region&lt;/code&gt; from its logs.
Reading a logs-only label such as &lt;code&gt;op&lt;/code&gt; does the same in reverse.
Only &lt;code&gt;job&lt;/code&gt;, &lt;code&gt;server_id&lt;/code&gt;, and &lt;code&gt;instance&lt;/code&gt; are set on both paths, so prefer those as &lt;code&gt;source_labels&lt;/code&gt;, or a label an earlier rule in the same block created.&lt;/p&gt;
&lt;/div&gt;

        
&lt;h3 id=&#34;clustering&#34;&gt;&lt;code&gt;clustering&lt;/code&gt;&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;enabled&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;bool&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Enables distributing databases with other cluster nodes.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;false&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;When Alloy is &lt;a href=&#34;../../../../get-started/clustering/&#34;&gt;using clustering&lt;/a&gt;, and &lt;code&gt;enabled&lt;/code&gt; is set to true, then this &lt;code&gt;database_observability.mysql&lt;/code&gt; component instance opts-in to distributing its configured databases between all cluster nodes.&lt;/p&gt;
&lt;p&gt;Clustering assumes that all cluster nodes are running with the same configuration file.
All component instances opting in to clustering use the instance key of each configured database, &lt;code&gt;&amp;lt;network&amp;gt;(&amp;lt;host&amp;gt;:&amp;lt;port&amp;gt;)/&amp;lt;dbname&amp;gt;&lt;/code&gt;, and a consistent hashing algorithm to determine ownership of each database between the cluster peers.
Each peer then only collects from the subset of databases it&amp;rsquo;s responsible for, and only exports the targets of those databases, so &lt;code&gt;prometheus.scrape&lt;/code&gt; components on the same node scrape exactly the databases the node owns.
When a node joins or leaves the cluster, every peer recalculates ownership: expect a short gap or a brief duplicate collection for a database while its ownership moves.
This includes the collectors that update &lt;code&gt;performance_schema&lt;/code&gt; settings, such as &lt;code&gt;setup_actors&lt;/code&gt; and &lt;code&gt;setup_consumers&lt;/code&gt;, which can briefly run from two nodes during the move: their updates are idempotent.
While the cluster isn&amp;rsquo;t yet ready to admit traffic, for example while it&amp;rsquo;s still forming and waiting for the minimum cluster size, the component doesn&amp;rsquo;t collect from any database.&lt;/p&gt;
&lt;p&gt;Clustering is also useful with a single database: when several cluster nodes run an identical configuration, exactly one node collects from the database at a time, which gives you a highly available setup without duplicate collection.&lt;/p&gt;
&lt;p&gt;If Alloy is &lt;em&gt;not&lt;/em&gt; running in clustered mode, then the block is a no-op and &lt;code&gt;database_observability.mysql&lt;/code&gt; collects from every configured database.&lt;/p&gt;
&lt;h3 id=&#34;setup_consumers&#34;&gt;&lt;code&gt;setup_consumers&lt;/code&gt;&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;collect_interval&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;duration&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;How frequently to collect &lt;code&gt;performance_schema.setup_consumers&lt;/code&gt; information from the database.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;&amp;quot;1h&amp;quot;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;query_details&#34;&gt;&lt;code&gt;query_details&lt;/code&gt;&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;collect_interval&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;duration&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;How frequently to collect information from database.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;&amp;quot;1m&amp;quot;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;statements_limit&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;integer&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Max number of recent queries to collect details for.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;100&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;schema_details&#34;&gt;&lt;code&gt;schema_details&lt;/code&gt;&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;collect_interval&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;duration&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;How frequently to collect information from database.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;&amp;quot;1m&amp;quot;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;cache_enabled&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;boolean&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Deprecated. Whether to enable caching of table definitions.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;true&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;cache_size&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;integer&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Deprecated. Cache size.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;256&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;cache_ttl&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;duration&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Deprecated. Cache TTL.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;&amp;quot;10m&amp;quot;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;The &lt;code&gt;cache_enabled&lt;/code&gt;, &lt;code&gt;cache_size&lt;/code&gt;, and &lt;code&gt;cache_ttl&lt;/code&gt; settings are deprecated: they are accepted for backward compatibility, but ignored.&lt;/p&gt;
&lt;h3 id=&#34;explain_plans&#34;&gt;&lt;code&gt;explain_plans&lt;/code&gt;&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;collect_interval&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;duration&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;How frequently to collect information from database.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;&amp;quot;1m&amp;quot;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;initial_lookback&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;duration&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;How far back to look for explain plan queries on the first collection interval.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;&amp;quot;24h&amp;quot;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;per_collect_ratio&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;float&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Ratio of explain plan queries to collect per collect interval.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;1.0&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;locks&#34;&gt;&lt;code&gt;locks&lt;/code&gt;&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;collect_interval&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;duration&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;How frequently to collect information from database.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;&amp;quot;30s&amp;quot;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;threshold&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;duration&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Threshold for locks to be considered slow. Locks that exceed this duration are logged.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;&amp;quot;1s&amp;quot;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;query_samples&#34;&gt;&lt;code&gt;query_samples&lt;/code&gt;&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;collect_interval&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;duration&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;How frequently to collect information from database.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;&amp;quot;10s&amp;quot;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;disable_query_redaction&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;bool&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Collect unredacted SQL query text (including query parameters) and query error messages.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;false&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;auto_enable_setup_consumers&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;boolean&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Enables specific &lt;code&gt;performance_schema.setup_consumers&lt;/code&gt; options. You must also enable &lt;code&gt;allow_update_performance_schema_settings&lt;/code&gt;.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;false&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;setup_consumers_check_interval&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;duration&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;How frequently to check if &lt;code&gt;setup_consumers&lt;/code&gt; are correctly enabled.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;&amp;quot;1h&amp;quot;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;sample_min_duration&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;duration&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Minimum duration for query samples to be collected. Set to &amp;ldquo;0s&amp;rdquo; to disable filtering and collect all samples regardless of their duration.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;&amp;quot;0s&amp;quot;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;wait_event_min_duration&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;duration&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Minimum duration for a wait event to be collected. Set to &amp;ldquo;0s&amp;rdquo; to disable filtering and collect all wait events regardless of their duration.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;&amp;quot;1us&amp;quot;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;enable_pre_classified_wait_events&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;boolean&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;When &lt;code&gt;true&lt;/code&gt;, emits telemetry data with pre-classified wait event information.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;true&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;setup_actors&#34;&gt;&lt;code&gt;setup_actors&lt;/code&gt;&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;auto_update_setup_actors&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;boolean&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Enables updates to &lt;code&gt;performance_schema.setup_actors&lt;/code&gt; settings. You must also enable &lt;code&gt;allow_update_performance_schema_settings&lt;/code&gt;.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;false&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;collect_interval&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;duration&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;How frequently to check if &lt;code&gt;setup_actors&lt;/code&gt; are configured correctly.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;&amp;quot;1h&amp;quot;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;health_check&#34;&gt;&lt;code&gt;health_check&lt;/code&gt;&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;collect_interval&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;duration&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;How frequently to run health checks.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;&amp;quot;1h&amp;quot;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;prometheus_exporter&#34;&gt;&lt;code&gt;prometheus_exporter&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;prometheus_exporter&lt;/code&gt; block configures the embedded &lt;code&gt;mysqld_exporter&lt;/code&gt; scrapers.
The &lt;code&gt;data_source_name&lt;/code&gt; is inherited from the parent block.
By default, the embedded exporter enables only the collectors that Database Observability reads: &lt;code&gt;perf_schema.eventsstatements&lt;/code&gt;, &lt;code&gt;global_status&lt;/code&gt;, &lt;code&gt;global_variables&lt;/code&gt;, and &lt;code&gt;slave_status&lt;/code&gt;.
The &lt;code&gt;limit&lt;/code&gt; of the &lt;code&gt;perf_schema.eventsstatements&lt;/code&gt; collector defaults to &lt;code&gt;100&lt;/code&gt;.
Use &lt;code&gt;enable_collectors&lt;/code&gt; and &lt;code&gt;disable_collectors&lt;/code&gt; to adjust this set, or &lt;code&gt;set_collectors&lt;/code&gt; to replace it.
The embedded &lt;code&gt;perf_schema.eventsstatements&lt;/code&gt; collector inherits the top-level &lt;code&gt;exclude_schemas&lt;/code&gt; list. Setting &lt;code&gt;prometheus_exporter &amp;gt; perf_schema.eventsstatements &amp;gt; exclude_schemas&lt;/code&gt; is discouraged because it can cause the embedded exporter and the component&amp;rsquo;s collectors to monitor different schemas.
Configure the top-level &lt;code&gt;exclude_schemas&lt;/code&gt; argument instead.
The &lt;code&gt;include_schemas&lt;/code&gt; argument applies only to &lt;code&gt;database_observability.mysql&lt;/code&gt; collectors and isn&amp;rsquo;t forwarded to the embedded &lt;code&gt;mysqld_exporter&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Refer to &lt;a href=&#34;../../prometheus/prometheus.exporter.mysql/&#34;&gt;&lt;code&gt;prometheus.exporter.mysql&lt;/code&gt;&lt;/a&gt; docs for the full list of supported arguments and sub-blocks.&lt;/p&gt;
&lt;p&gt;Unlike in &lt;code&gt;prometheus.exporter.mysql&lt;/code&gt;, the &lt;code&gt;text_limit&lt;/code&gt; argument of the &lt;code&gt;perf_schema.eventsstatements&lt;/code&gt; block defaults to &lt;code&gt;0&lt;/code&gt;.
The statement metrics then don&amp;rsquo;t have a &lt;code&gt;digest_text&lt;/code&gt; label, because the &lt;code&gt;query_details&lt;/code&gt; collector sends the statement text as logs.&lt;/p&gt;
&lt;h2 id=&#34;example&#34;&gt;Example&lt;/h2&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Alloy&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-alloy&#34;&gt;database_observability.mysql &amp;#34;orders_db&amp;#34; {
  data_source_name = &amp;#34;user:pass@tcp(mysql:3306)/&amp;#34;
  forward_to       = [loki.relabel.orders_db.receiver]

  enable_collectors = [&amp;#34;query_samples&amp;#34;, &amp;#34;explain_plans&amp;#34;]

  cloud_provider {
    aws {
      arn = &amp;#34;your-rds-db-arn&amp;#34;
    }
  }
}

loki.relabel &amp;#34;orders_db&amp;#34; {
  forward_to = [loki.write.logs_service.receiver]
  rule {
    target_label = &amp;#34;job&amp;#34;
    replacement  = &amp;#34;integrations/db-o11y&amp;#34;
  }
  rule {
    target_label = &amp;#34;instance&amp;#34;
    replacement  = &amp;#34;orders_db&amp;#34;
  }
}

discovery.relabel &amp;#34;orders_db&amp;#34; {
  targets = database_observability.mysql.orders_db.targets

  rule {
    target_label = &amp;#34;job&amp;#34;
    replacement  = &amp;#34;integrations/db-o11y&amp;#34;
  }
  rule {
    target_label = &amp;#34;instance&amp;#34;
    replacement  = &amp;#34;orders_db&amp;#34;
  }
}

prometheus.scrape &amp;#34;orders_db&amp;#34; {
  targets    = discovery.relabel.orders_db.targets
  job_name   = &amp;#34;integrations/db-o11y&amp;#34;
  forward_to = [prometheus.remote_write.metrics_service.receiver]
}

prometheus.remote_write &amp;#34;metrics_service&amp;#34; {
  endpoint {
    url = sys.env(&amp;#34;&amp;lt;GRAFANA_CLOUD_HOSTED_METRICS_URL&amp;gt;&amp;#34;)
    basic_auth {
      username = sys.env(&amp;#34;&amp;lt;GRAFANA_CLOUD_HOSTED_METRICS_ID&amp;gt;&amp;#34;)
      password = sys.env(&amp;#34;&amp;lt;GRAFANA_CLOUD_RW_API_KEY&amp;gt;&amp;#34;)
    }
  }
}

loki.write &amp;#34;logs_service&amp;#34; {
  endpoint {
    url = sys.env(&amp;#34;&amp;lt;GRAFANA_CLOUD_HOSTED_LOGS_URL&amp;gt;&amp;#34;)
    basic_auth {
      username = sys.env(&amp;#34;&amp;lt;GRAFANA_CLOUD_HOSTED_LOGS_ID&amp;gt;&amp;#34;)
      password = sys.env(&amp;#34;&amp;lt;GRAFANA_CLOUD_RW_API_KEY&amp;gt;&amp;#34;)
    }
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Replace the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;GRAFANA_CLOUD_HOSTED_METRICS_URL&amp;gt;&lt;/code&gt;&lt;/em&gt;: The URL for your Grafana Cloud hosted metrics.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;GRAFANA_CLOUD_HOSTED_METRICS_ID&amp;gt;&lt;/code&gt;&lt;/em&gt;: The user ID for your Grafana Cloud hosted metrics.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;GRAFANA_CLOUD_RW_API_KEY&amp;gt;&lt;/code&gt;&lt;/em&gt;: Your Grafana Cloud API key.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;GRAFANA_CLOUD_HOSTED_LOGS_URL&amp;gt;&lt;/code&gt;&lt;/em&gt;: The URL for your Grafana Cloud hosted logs.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;GRAFANA_CLOUD_HOSTED_LOGS_ID&amp;gt;&lt;/code&gt;&lt;/em&gt;: The user ID for your Grafana Cloud hosted logs.&lt;/li&gt;
&lt;/ul&gt;
&lt;!-- START GENERATED COMPATIBLE COMPONENTS --&gt;
&lt;h2 id=&#34;compatible-components&#34;&gt;Compatible components&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;database_observability.mysql&lt;/code&gt; can accept arguments from the following components:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Components that export &lt;a href=&#34;../../../compatibility/#targets-exporters&#34;&gt;Targets&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Components that export &lt;a href=&#34;../../../compatibility/#loki-logsreceiver-exporters&#34;&gt;Loki &lt;code&gt;LogsReceiver&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;code&gt;database_observability.mysql&lt;/code&gt; has exports that can be consumed by the following components:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Components that consume &lt;a href=&#34;../../../compatibility/#targets-consumers&#34;&gt;Targets&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;Connecting some components may not be sensible or components may require further configuration to make the connection work correctly.
Refer to the linked documentation for more details.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;!-- END GENERATED COMPATIBLE COMPONENTS --&gt;
]]></content><description>&lt;h1 id="database_observabilitymysql">&lt;code>database_observability.mysql&lt;/code>&lt;/h1>
&lt;p>&lt;code>database_observability.mysql&lt;/code> connects to a MySQL database and collects observability data from the &lt;code>performance_schema&lt;/code> and &lt;code>information_schema&lt;/code>.
The component collects query details, schema information, explain plans, query samples, and lock information.
It forwards this data as log entries to Loki receivers and exports targets for Prometheus scraping.&lt;/p></description></item><item><title>database_observability.postgres</title><link>https://grafana.com/docs/alloy/v1.22/reference/components/database_observability/database_observability.postgres/</link><pubDate>Fri, 13 Nov 2026 04:21:39 +0000</pubDate><guid>https://grafana.com/docs/alloy/v1.22/reference/components/database_observability/database_observability.postgres/</guid><content><![CDATA[&lt;h1 id=&#34;database_observabilitypostgres&#34;&gt;&lt;code&gt;database_observability.postgres&lt;/code&gt;&lt;/h1&gt;
&lt;p&gt;&lt;code&gt;database_observability.postgres&lt;/code&gt; connects to a PostgreSQL database and collects observability data from system catalogs and the &lt;code&gt;pg_stat_statements&lt;/code&gt; extension.
The component collects query details, schema information, explain plans, query samples, and processes PostgreSQL logs.
It forwards this data as log entries to Loki receivers and exports targets for Prometheus scraping.&lt;/p&gt;
&lt;h2 id=&#34;usage&#34;&gt;Usage&lt;/h2&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Alloy&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-alloy&#34;&gt;database_observability.postgres &amp;#34;&amp;lt;LABEL&amp;gt;&amp;#34; {
  data_source_name = &amp;lt;DATA_SOURCE_NAME&amp;gt;
  forward_to       = [&amp;lt;LOKI_RECEIVERS&amp;gt;]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;p&gt;You can use the following arguments with &lt;code&gt;database_observability.postgres&lt;/code&gt;:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;data_source_name&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;secret&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;a href=&#34;https://pkg.go.dev/github.com/lib/pq#hdr-URL_connection_strings-NewConfig&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Data Source Name&lt;/a&gt; for the Postgres server to connect to. Required when no &lt;code&gt;database_instance&lt;/code&gt; blocks are defined.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;forward_to&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;list(LogsReceiver)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Where to forward log entries after processing.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;targets&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;list(map(string))&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;List of external targets to scrape for Prometheus metrics.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;disable_collectors&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;list(string)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;A list of collectors to disable from the default set.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;enable_collectors&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;list(string)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;A list of collectors to enable on top of the default set.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;exclude_databases&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;list(string)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;A list of databases to exclude from monitoring on top of the default exclusions.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;[&amp;quot;alloydbadmin&amp;quot;, &amp;quot;alloydbmetadata&amp;quot;, &amp;quot;azure_maintenance&amp;quot;, &amp;quot;azure_sys&amp;quot;, &amp;quot;cloudsqladmin&amp;quot;, &amp;quot;rdsadmin&amp;quot;]&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;include_databases&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;list(string)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;A list of databases to monitor. When empty, all non-excluded databases are monitored. Items in &lt;code&gt;include_databases&lt;/code&gt; override the default exclusions, but cannot overlap with &lt;code&gt;exclude_databases&lt;/code&gt; or &lt;code&gt;azure_maintenance&lt;/code&gt;.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;[]&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;exclude_users&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;list(string)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;A list of users to exclude from monitoring on top of the default exclusions.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;[&amp;quot;azuresu&amp;quot;, &amp;quot;cloudsqladmin&amp;quot;, &amp;quot;db-o11y&amp;quot;, &amp;quot;rdsadmin&amp;quot;]&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;include_users&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;list(string)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;A list of users to monitor. When empty, all non-excluded users are monitored. Items in &lt;code&gt;include_users&lt;/code&gt; override the default exclusions, but cannot overlap with &lt;code&gt;exclude_users&lt;/code&gt;. &lt;code&gt;exclude_current_user&lt;/code&gt; still takes precedence.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;[]&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;exclude_current_user&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;bool&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Exclude from activity monitoring the user that Alloy uses to connect to the database. The resolved username is automatically added to &lt;code&gt;exclude_users&lt;/code&gt;, if not already present.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;true&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;Refer to the &lt;a href=&#34;https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;PostgreSQL documentation&lt;/a&gt; for more information about the format of the connection strings in &lt;code&gt;data_source_name&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;exports&#34;&gt;Exports&lt;/h2&gt;
&lt;p&gt;The following fields are exported and can be referenced by other components:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;logs_receiver&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;LogsReceiver&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Receiver for PostgreSQL logs that processes and exports error metrics. Exported in the single-DSN form only.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;logs_receivers&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;map(LogsReceiver)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;One logs receiver per [&lt;code&gt;database_instance&lt;/code&gt;][database_instance] block, keyed by block label. Empty in the single-DSN form.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;targets&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;list(map(string))&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Targets that can be used to collect metrics from the component.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;The following collectors are configurable:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Enabled by default&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;explain_plans&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Collect query explain plans.&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;table_stats&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Collect table-level scan statistics.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;index_stats&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Collect per-index usage statistics.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;query_details&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Collect queries information.&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;query_samples&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Collect query samples and wait events information.&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;schema_details&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Collect schemas, tables, and columns from PostgreSQL system catalogs.&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;blocks&#34;&gt;Blocks&lt;/h2&gt;
&lt;p&gt;You can use the following blocks with &lt;code&gt;database_observability.postgres&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;config-app&#34; style=&#34;--config-tree-row-count: 15;&#34; x3-data=&#34;configVisualizer(&amp;#34;\u003csection class=\&amp;#34;expand-table-wrapper\&amp;#34;\u003e\u003cdiv class=\&amp;#34;button-div\&amp;#34;\u003e\n      \u003cbutton class=\&amp;#34;expand-table-btn\&amp;#34;\u003eExpand table\u003c/button\u003e\n    \u003c/div\u003e\u003cdiv class=\&amp;#34;responsive-table-wrapper\&amp;#34;\u003e\n    \u003ctable\u003e\n      \u003cthead\u003e\n          \u003ctr\u003e\n              \u003cth\u003eBlock\u003c/th\u003e\n              \u003cth\u003eDescription\u003c/th\u003e\n              \u003cth\u003eRequired\u003c/th\u003e\n          \u003c/tr\u003e\n      \u003c/thead\u003e\n      \u003ctbody\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#cloud_provider\&amp;#34;\u003e\u003ccode\u003ecloud_provider\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eProvide Cloud Provider information.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ccode\u003ecloud_provider\u003c/code\u003e \u0026gt; \u003ca href=\&amp;#34;#aws\&amp;#34;\u003e\u003ccode\u003eaws\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eProvide AWS database host information.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ccode\u003ecloud_provider\u003c/code\u003e \u0026gt; \u003ca href=\&amp;#34;#azure\&amp;#34;\u003e\u003ccode\u003eazure\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eProvide Azure database host information.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ccode\u003ecloud_provider\u003c/code\u003e \u0026gt; \u003ca href=\&amp;#34;#gcp\&amp;#34;\u003e\u003ccode\u003egcp\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eProvide GCP database host information.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#database_instance\&amp;#34;\u003e\u003ccode\u003edatabase_instance\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eDefine one database to monitor. Repeat the block to monitor several databases.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ccode\u003edatabase_instance\u003c/code\u003e \u0026gt; \u003ca href=\&amp;#34;#cloud_provider\&amp;#34;\u003e\u003ccode\u003ecloud_provider\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eProvide Cloud Provider information for one database.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ccode\u003edatabase_instance\u003c/code\u003e \u0026gt; \u003ca href=\&amp;#34;#rule\&amp;#34;\u003e\u003ccode\u003erule\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eRelabel the metrics and logs of one database.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#clustering\&amp;#34;\u003e\u003ccode\u003eclustering\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eConfigure the component for when Alloy is running in clustered mode.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#query_details\&amp;#34;\u003e\u003ccode\u003equery_details\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eConfigure the queries collector.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#query_samples\&amp;#34;\u003e\u003ccode\u003equery_samples\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eConfigure the query samples collector.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#schema_details\&amp;#34;\u003e\u003ccode\u003eschema_details\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eConfigure the schema and table details collector.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#explain_plans\&amp;#34;\u003e\u003ccode\u003eexplain_plans\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eConfigure the explain plans collector.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#logs\&amp;#34;\u003e\u003ccode\u003elogs\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eConfigure the logs collector.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#health_check\&amp;#34;\u003e\u003ccode\u003ehealth_check\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eConfigure the health check collector.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#prometheus_exporter\&amp;#34;\u003e\u003ccode\u003eprometheus_exporter\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eConfigure the embedded \u003ccode\u003epostgres_exporter\u003c/code\u003e.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n      \u003c/tbody\u003e\n    \u003c/table\u003e\n  \u003c/div\u003e\n\u003c/section\u003e&amp;#34;)&#34;&gt;
  &lt;noscript&gt;
    &lt;div class=&#34;config-app__noscript&#34;&gt;&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Block&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#cloud_provider&#34;&gt;&lt;code&gt;cloud_provider&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Provide Cloud Provider information.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;cloud_provider&lt;/code&gt; &amp;gt; &lt;a href=&#34;#aws&#34;&gt;&lt;code&gt;aws&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Provide AWS database host information.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;cloud_provider&lt;/code&gt; &amp;gt; &lt;a href=&#34;#azure&#34;&gt;&lt;code&gt;azure&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Provide Azure database host information.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;cloud_provider&lt;/code&gt; &amp;gt; &lt;a href=&#34;#gcp&#34;&gt;&lt;code&gt;gcp&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Provide GCP database host information.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#database_instance&#34;&gt;&lt;code&gt;database_instance&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Define one database to monitor. Repeat the block to monitor several databases.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_instance&lt;/code&gt; &amp;gt; &lt;a href=&#34;#cloud_provider&#34;&gt;&lt;code&gt;cloud_provider&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Provide Cloud Provider information for one database.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_instance&lt;/code&gt; &amp;gt; &lt;a href=&#34;#rule&#34;&gt;&lt;code&gt;rule&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Relabel the metrics and logs of one database.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#clustering&#34;&gt;&lt;code&gt;clustering&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Configure the component for when Alloy is running in clustered mode.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#query_details&#34;&gt;&lt;code&gt;query_details&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Configure the queries collector.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#query_samples&#34;&gt;&lt;code&gt;query_samples&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Configure the query samples collector.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#schema_details&#34;&gt;&lt;code&gt;schema_details&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Configure the schema and table details collector.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#explain_plans&#34;&gt;&lt;code&gt;explain_plans&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Configure the explain plans collector.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#logs&#34;&gt;&lt;code&gt;logs&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Configure the logs collector.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#health_check&#34;&gt;&lt;code&gt;health_check&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Configure the health check collector.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#prometheus_exporter&#34;&gt;&lt;code&gt;prometheus_exporter&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Configure the embedded &lt;code&gt;postgres_exporter&lt;/code&gt;.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;/div&gt;
  &lt;/noscript&gt;
  &lt;main class=&#34;config-app__main&#34;&gt;
    &lt;template x3-if=&#34;flatBlocks.length === 0&#34;&gt;
      &lt;div class=&#34;empty-state&#34;&gt;
        &lt;div class=&#34;empty-state__icon&#34; x3-html=&#34;icons.AlertCircle&#34;&gt;&lt;/div&gt;
        &lt;p&gt;No valid configuration blocks found.&lt;/p&gt;
      &lt;/div&gt;
    &lt;/template&gt;

    &lt;template x3-if=&#34;flatBlocks.length &gt; 0&#34;&gt;
      &lt;div class=&#34;config-tree&#34;&gt;
        &lt;div class=&#34;config-tree__toolbar&#34;&gt;
          &lt;div class=&#34;config-tree__title&#34;&gt;&lt;/div&gt;
          &lt;button
            class=&#34;tree-explorer__button w-130 text-right&#34;
            x3-on:click=&#34;toggleExpandAll&#34;
            x3-bind:title=&#34;allExpanded ? &#39;Collapse all&#39; : &#39;Expand all&#39;&#34;
          &gt;
            &lt;span x3-text=&#34;allExpanded ? &#39;Collapse all&#39; : &#39;Expand all&#39;&#34;&gt;&lt;/span&gt;
            &lt;svg class=&#34;api-icon&#34; viewBox=&#34;0 0 24 24&#34;&gt;
              &lt;path x3-show=&#34;!allExpanded&#34; d=&#34;m6 9 6 6 6-6&#34; /&gt;
              &lt;path x3-show=&#34;allExpanded&#34; d=&#34;m18 15-6-6-6 6&#34; /&gt;
            &lt;/svg&gt;
          &lt;/button&gt;
        &lt;/div&gt;

        &lt;div class=&#34;nodes-container&#34;&gt;
          &lt;template x3-for=&#34;block in flatBlocks&#34; x3-bind:key=&#34;block.id&#34;&gt;
            &lt;div class=&#34;node&#34; x3-bind:class=&#34;isNodeVisible(block) ? &#39;node--visible&#39; : &#39;node--hidden&#39;&#34;&gt;
              &lt;div
                class=&#34;node__row&#34;
                x3-bind:class=&#34;getRowClass(block)&#34;
                x3-bind:style=&#34;`padding-left: ${block.level * 24 &#43; 16}px`&#34;
                x3-on:click=&#34;toggleNode(block.id)&#34;
              &gt;
                &lt;div class=&#34;node__left&#34;&gt;
                  &lt;div class=&#34;node__indicator&#34;&gt;
                    &lt;template x3-if=&#34;block.hasChildren&#34;&gt;
                      &lt;button type=&#34;button&#34; class=&#34;node__toggle&#34; x3-on:click.stop=&#34;toggleNode(block.id)&#34;&gt;
                        &lt;div
                          class=&#34;node__toggle-icon&#34;
                          x3-bind:class=&#34;block.expanded ? &#39;node__toggle-icon--expanded&#39; : &#39;&#39;&#34;
                          x3-html=&#34;icons.ChevronDown&#34;
                        &gt;&lt;/div&gt;
                      &lt;/button&gt;
                    &lt;/template&gt;
                    &lt;template x3-if=&#34;!block.hasChildren&#34;&gt;
                      &lt;div class=&#34;node__toggle-spacer&#34;&gt;&lt;/div&gt;
                    &lt;/template&gt;
                  &lt;/div&gt;

                  &lt;div class=&#34;node__content&#34;&gt;
                    &lt;div
                      class=&#34;node__title prose&#34;
                      x3-bind:class=&#34;block.level === 0 ? &#39;node__title--root&#39; : &#39;node__title--nested&#39;&#34;
                      x3-html=&#34;block.displayName&#34;
                    &gt;&lt;/div&gt;
                    &lt;div class=&#34;node__description body-xsmall&#34; x3-html=&#34;block.description&#34;&gt;&lt;/div&gt;
                  &lt;/div&gt;
                &lt;/div&gt;

                &lt;div class=&#34;node__meta&#34;&gt;
                  &lt;span
                    class=&#34;badge&#34;
                    x3-bind:class=&#34;block.required ? &#39;badge--required&#39; : &#39;badge--optional&#39;&#34;
                    x3-text=&#34;block.required ? &#39;Required&#39; : &#39;Optional&#39;&#34;
                  &gt;&lt;/span&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;
          &lt;/template&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/template&gt;
  &lt;/main&gt;
&lt;/div&gt;

&lt;h3 id=&#34;cloud_provider&#34;&gt;&lt;code&gt;cloud_provider&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;cloud_provider&lt;/code&gt; block has no attributes.
It contains zero or one of the &lt;a href=&#34;#aws&#34;&gt;&lt;code&gt;aws&lt;/code&gt;&lt;/a&gt;, &lt;a href=&#34;#azure&#34;&gt;&lt;code&gt;azure&lt;/code&gt;&lt;/a&gt;, or &lt;a href=&#34;#gcp&#34;&gt;&lt;code&gt;gcp&lt;/code&gt;&lt;/a&gt; blocks.
You use the &lt;code&gt;cloud_provider&lt;/code&gt; block to provide information related to the cloud provider that hosts the database under observation.
This information is appended as labels to the collected metrics.
The labels make it easier for you to filter and group your metrics.&lt;/p&gt;
&lt;h3 id=&#34;aws&#34;&gt;&lt;code&gt;aws&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;aws&lt;/code&gt; block supplies the &lt;a href=&#34;https://docs.aws.amazon.com/IAM/latest/UserGuide/reference-arns.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;ARN&lt;/a&gt; identifier for the database being monitored.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;arn&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The ARN associated with the database under observation.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;azure&#34;&gt;&lt;code&gt;azure&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;azure&lt;/code&gt; block supplies the identifying information for the database being monitored.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;subscription_id&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The Subscription ID for your Azure account.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;resource_group&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The Resource Group that holds the database resource.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;server_name&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The database server name, for example &lt;code&gt;orders-db&lt;/code&gt; for the host &lt;code&gt;orders-db.postgres.database.azure.com&lt;/code&gt;.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;gcp&#34;&gt;&lt;code&gt;gcp&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;gcp&lt;/code&gt; block supplies the identifying information for the GCP Cloud SQL database being monitored.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;connection_name&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The Cloud SQL instance connection name in the format &lt;code&gt;project:region:instance&lt;/code&gt;, for example &lt;code&gt;my-project:us-central1:my-db&lt;/code&gt;.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;database_instance&#34;&gt;&lt;code&gt;database_instance&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;database_instance&lt;/code&gt; block defines one database server to monitor.
Repeat the block to monitor several databases with a single component.
The block label must be unique across &lt;code&gt;database_instance&lt;/code&gt; blocks and identifies the database in the component&amp;rsquo;s metrics endpoint path and in the &lt;code&gt;logs_receivers&lt;/code&gt; export.
Each &lt;code&gt;database_instance&lt;/code&gt; block must also point to a distinct server: two blocks that resolve to the same host, port, and database name are rejected.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;data_source_name&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;secret&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;a href=&#34;https://pkg.go.dev/github.com/lib/pq#hdr-URL_connection_strings-NewConfig&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Data Source Name&lt;/a&gt; for the Postgres server to connect to.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;Each &lt;code&gt;database_instance&lt;/code&gt; block can also contain a [&lt;code&gt;cloud_provider&lt;/code&gt;][cloud_provider] block that applies to that database only, and [&lt;code&gt;rule&lt;/code&gt;][rule] blocks that relabel the metrics and logs of that database only.&lt;/p&gt;
&lt;p&gt;The component always embeds a &lt;code&gt;postgres_exporter&lt;/code&gt; for each &lt;code&gt;database_instance&lt;/code&gt; block and serves its metrics on the block&amp;rsquo;s metrics path.
Use the [&lt;code&gt;prometheus_exporter&lt;/code&gt;][prometheus_exporter] block to configure it.
External exporter targets are only supported in the top-level single-DSN form.&lt;/p&gt;
&lt;p&gt;When you define &lt;code&gt;database_instance&lt;/code&gt; blocks, don&amp;rsquo;t set the top-level &lt;code&gt;data_source_name&lt;/code&gt;, &lt;code&gt;targets&lt;/code&gt;, and &lt;code&gt;cloud_provider&lt;/code&gt; arguments.
They&amp;rsquo;re mutually exclusive with &lt;code&gt;database_instance&lt;/code&gt; blocks.
All other arguments and blocks, such as collector settings and &lt;code&gt;prometheus_exporter&lt;/code&gt;, apply to every configured database.&lt;/p&gt;
&lt;p&gt;The metrics for each database are served on a separate &lt;code&gt;/db/&amp;lt;LABEL&amp;gt;/metrics&lt;/code&gt; path under the component&amp;rsquo;s HTTP endpoint, and the exported targets point to the corresponding path.
When you don&amp;rsquo;t define &lt;code&gt;database_instance&lt;/code&gt; blocks, the component serves metrics on its historical &lt;code&gt;/metrics&lt;/code&gt; path.
The metrics endpoints are served exactly at those paths: requests to any other path under the component&amp;rsquo;s HTTP endpoint return HTTP 404.&lt;/p&gt;
&lt;p&gt;Each database also gets its own logs receiver in the &lt;code&gt;logs_receivers&lt;/code&gt; export, keyed by the block label.
Forward each database&amp;rsquo;s PostgreSQL logs to its own receiver so log-derived error metrics are attributed to the right database.&lt;/p&gt;
&lt;p&gt;For example:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Alloy&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-alloy&#34;&gt;database_observability.postgres &amp;#34;pool&amp;#34; {
  forward_to = [loki.write.logs_service.receiver]

  database_instance &amp;#34;orders&amp;#34; {
    data_source_name = sys.env(&amp;#34;ORDERS_DSN&amp;#34;)

    cloud_provider {
      aws {
        arn = &amp;#34;orders-rds-db-arn&amp;#34;
      }
    }

    rule {
      target_label = &amp;#34;environment&amp;#34;
      replacement  = &amp;#34;production&amp;#34;
    }
  }

  database_instance &amp;#34;billing&amp;#34; {
    data_source_name = sys.env(&amp;#34;BILLING_DSN&amp;#34;)

    rule {
      target_label = &amp;#34;environment&amp;#34;
      replacement  = &amp;#34;staging&amp;#34;
    }
  }
}

loki.source.file &amp;#34;orders_db_logs&amp;#34; {
  targets    = local.file_match.orders_db_logs.targets
  forward_to = [database_observability.postgres.pool.logs_receivers[&amp;#34;orders&amp;#34;]]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;In this example, the metrics and logs of the &lt;code&gt;orders&lt;/code&gt; database carry &lt;code&gt;environment=&amp;quot;production&amp;quot;&lt;/code&gt;, and those of the &lt;code&gt;billing&lt;/code&gt; database carry &lt;code&gt;environment=&amp;quot;staging&amp;quot;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The component doesn&amp;rsquo;t forward the raw PostgreSQL log lines it receives on &lt;code&gt;logs_receivers&lt;/code&gt;.
It reads them to derive error-message entries, and those derived entries are what the &lt;code&gt;rule&lt;/code&gt; blocks relabel.
Deriving them requires [&lt;code&gt;logs.enable_error_logs_processing&lt;/code&gt;][logs], which is disabled by default.&lt;/p&gt;
&lt;h3 id=&#34;rule&#34;&gt;&lt;code&gt;rule&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;rule&lt;/code&gt; block relabels the metrics and the logs of the &lt;code&gt;database_instance&lt;/code&gt; block that contains it.
Use it to tell the data of each monitored database apart, for example by environment, team, or tier.&lt;/p&gt;


&lt;div data-shared=&#34;reference/components/rule-block-database-observability.md&#34;&gt;
            &lt;p&gt;The &lt;code&gt;rule&lt;/code&gt; block defines a relabeling rule applied to the metrics and the logs of a single monitored database.
If you define more than one &lt;code&gt;rule&lt;/code&gt; block, the rules are applied in top-down order, after the labels the component sets itself, so a rule can read those labels with &lt;code&gt;source_labels&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;It takes the same arguments as the 
    &lt;a href=&#34;/docs/alloy/v1.22/reference/components/prometheus/prometheus.relabel/#rule&#34;&gt;&lt;code&gt;rule&lt;/code&gt; block&lt;/a&gt; used elsewhere in Alloy, in a restricted form: because one rule set applies to two signal paths, it supports the labelling actions only, and it can&amp;rsquo;t overwrite most of the labels the component sets.
Alloy refuses to load a configuration containing a rule that breaks either restriction, so such a rule is never silently ignored.&lt;/p&gt;
&lt;p&gt;Two further constraints are specific to a &lt;code&gt;database_instance&lt;/code&gt; block:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;target_label&lt;/code&gt; must be a literal label name&lt;/strong&gt;: Alloy checks it against the reserved labels when it loads the configuration, so it can&amp;rsquo;t contain a capture group reference.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;hashmod&lt;/code&gt; requires &lt;code&gt;source_labels&lt;/code&gt;, and can&amp;rsquo;t target &lt;code&gt;instance&lt;/code&gt;&lt;/strong&gt;: hashing the empty value gives every database the same result, and hashing into &lt;code&gt;instance&lt;/code&gt; buckets several databases onto one value even when the source is present.&lt;/li&gt;
&lt;/ul&gt;


&lt;div class=&#34;admonition admonition-caution&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Caution&lt;/p&gt;&lt;p&gt;A relabeling rule that computes an empty value &lt;em&gt;removes&lt;/em&gt; its target label instead of setting it, and the default &lt;code&gt;replacement&lt;/code&gt; of &lt;code&gt;&amp;quot;$1&amp;quot;&lt;/code&gt; computes an empty value when a rule has no &lt;code&gt;source_labels&lt;/code&gt;.
So &lt;code&gt;rule { target_label = &amp;quot;environment&amp;quot; }&lt;/code&gt; removes &lt;code&gt;environment&lt;/code&gt; rather than setting it, and Alloy rejects it.
Always set &lt;code&gt;replacement&lt;/code&gt; alongside a &lt;code&gt;target_label&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Alloy can only reject such a rule where the outcome is certain.
A rule that reads &lt;code&gt;source_labels&lt;/code&gt; depends on the labels present at runtime, so a missing or misspelled source label still removes the target label, except for the reserved labels and &lt;code&gt;instance&lt;/code&gt;, which keep their previous value.
Only removal is prevented: a rule that computes a &lt;em&gt;non-empty&lt;/em&gt; value still overwrites those labels, which is why &lt;code&gt;hashmod&lt;/code&gt; can&amp;rsquo;t target &lt;code&gt;instance&lt;/code&gt; at all.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;You can use the &lt;code&gt;hashmod&lt;/code&gt;, &lt;code&gt;labeldrop&lt;/code&gt;, &lt;code&gt;lowercase&lt;/code&gt;, &lt;code&gt;replace&lt;/code&gt;, and &lt;code&gt;uppercase&lt;/code&gt; actions.
The rest aren&amp;rsquo;t supported:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;drop&lt;/code&gt;, &lt;code&gt;dropequal&lt;/code&gt;, &lt;code&gt;keep&lt;/code&gt;, and &lt;code&gt;keepequal&lt;/code&gt; filter rather than label, and filtering means two different things on the two signal paths. Dropping a metrics target stops the database exporting metrics entirely, whereas dropping a log entry discards one line. To filter one database&amp;rsquo;s logs, use a 
    &lt;a href=&#34;/docs/alloy/v1.22/reference/components/loki/loki.relabel/&#34;&gt;&lt;code&gt;loki.relabel&lt;/code&gt;&lt;/a&gt; component on the receiver named in &lt;code&gt;forward_to&lt;/code&gt;, with a &lt;code&gt;drop&lt;/code&gt; rule that matches that database&amp;rsquo;s &lt;code&gt;instance&lt;/code&gt; or &lt;code&gt;server_id&lt;/code&gt;. Every database the component monitors forwards to the same receivers, so the rule has to identify the one it applies to. To filter one database&amp;rsquo;s metrics, use a 
    &lt;a href=&#34;/docs/alloy/v1.22/reference/components/discovery/discovery.relabel/&#34;&gt;&lt;code&gt;discovery.relabel&lt;/code&gt;&lt;/a&gt; component on the component&amp;rsquo;s exported targets.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;labelmap&lt;/code&gt; builds label names from &lt;code&gt;replacement&lt;/code&gt; at runtime, so Alloy can&amp;rsquo;t check them against the reserved labels when it loads the configuration.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;labelkeep&lt;/code&gt; removes every label its &lt;code&gt;regex&lt;/code&gt; doesn&amp;rsquo;t match, so a rule that preserves the reserved labels would have to match all of them. Use &lt;code&gt;labeldrop&lt;/code&gt; to remove specific labels instead.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Because the rules run after the component&amp;rsquo;s own labels, and those are protected, a &lt;code&gt;labeldrop&lt;/code&gt; rule can only remove a label that an earlier rule in the same block created.&lt;/p&gt;
&lt;h4 id=&#34;reserved-labels&#34;&gt;Reserved labels&lt;/h4&gt;
&lt;p&gt;A rule can&amp;rsquo;t write to the following labels, and a &lt;code&gt;labeldrop&lt;/code&gt; regular expression can&amp;rsquo;t match them:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Both metrics and logs&lt;/strong&gt;: &lt;code&gt;job&lt;/code&gt; and &lt;code&gt;server_id&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Logs only&lt;/strong&gt;: &lt;code&gt;engine&lt;/code&gt; and &lt;code&gt;op&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Metrics only&lt;/strong&gt;: &lt;code&gt;provider_name&lt;/code&gt;, &lt;code&gt;provider_region&lt;/code&gt;, &lt;code&gt;provider_account&lt;/code&gt;, &lt;code&gt;__address__&lt;/code&gt;, &lt;code&gt;__scheme__&lt;/code&gt;, and &lt;code&gt;__metrics_path__&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This applies to &lt;code&gt;rule&lt;/code&gt; blocks only.
A downstream &lt;code&gt;discovery.relabel&lt;/code&gt; or &lt;code&gt;loki.relabel&lt;/code&gt; component can still overwrite any of them, but it applies to every database the component monitors rather than one.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;instance&lt;/code&gt; label is a special case: a rule can rewrite its value, which is a common reason to use a &lt;code&gt;rule&lt;/code&gt; block, because a friendly name such as &lt;code&gt;orders_db&lt;/code&gt; then applies to that database&amp;rsquo;s metrics and logs together.
A rule can&amp;rsquo;t remove it, because metrics and logs are correlated on it, and because an empty &lt;code&gt;instance&lt;/code&gt; on a metrics target makes Prometheus fill it in from &lt;code&gt;__address__&lt;/code&gt;, which every database in one component shares, collapsing them all onto one series.&lt;/p&gt;
&lt;p&gt;For the same reason, two &lt;code&gt;database_instance&lt;/code&gt; blocks can&amp;rsquo;t rewrite &lt;code&gt;instance&lt;/code&gt; to the same value.
Alloy rejects that when both values are fixed in the configuration, but it can&amp;rsquo;t when the value comes from a label the databases share: &lt;code&gt;source_labels = [&amp;quot;job&amp;quot;]&lt;/code&gt; gives every database the same &lt;code&gt;instance&lt;/code&gt;, since they all carry the same &lt;code&gt;job&lt;/code&gt;.
Derive &lt;code&gt;instance&lt;/code&gt; from something that differs per database, or set a literal value in each block.&lt;/p&gt;
&lt;h4 id=&#34;labels-set-on-only-one-signal-path&#34;&gt;Labels set on only one signal path&lt;/h4&gt;
&lt;p&gt;Some of the labels above exist on one signal path and not the other, and a rule that reads one with &lt;code&gt;source_labels&lt;/code&gt; behaves differently on each path: where the label is absent the rule computes an empty value, which &lt;em&gt;removes&lt;/em&gt; its &lt;code&gt;target_label&lt;/code&gt; rather than setting it to an empty string.&lt;/p&gt;
&lt;p&gt;A rule reading &lt;code&gt;provider_region&lt;/code&gt;, which a database with a &lt;a href=&#34;#cloud_provider&#34;&gt;&lt;code&gt;cloud_provider&lt;/code&gt;&lt;/a&gt; block carries on its metrics targets but not on its log entries, sets &lt;code&gt;region&lt;/code&gt; on that database&amp;rsquo;s metrics and removes &lt;code&gt;region&lt;/code&gt; from its logs.
Reading a logs-only label such as &lt;code&gt;op&lt;/code&gt; does the same in reverse.
Only &lt;code&gt;job&lt;/code&gt;, &lt;code&gt;server_id&lt;/code&gt;, and &lt;code&gt;instance&lt;/code&gt; are set on both paths, so prefer those as &lt;code&gt;source_labels&lt;/code&gt;, or a label an earlier rule in the same block created.&lt;/p&gt;
&lt;/div&gt;

        
&lt;h3 id=&#34;clustering&#34;&gt;&lt;code&gt;clustering&lt;/code&gt;&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;enabled&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;bool&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Enables distributing databases with other cluster nodes.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;false&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;When Alloy is &lt;a href=&#34;../../../../get-started/clustering/&#34;&gt;using clustering&lt;/a&gt;, and &lt;code&gt;enabled&lt;/code&gt; is set to true, then this &lt;code&gt;database_observability.postgres&lt;/code&gt; component instance opts-in to distributing its configured databases between all cluster nodes.&lt;/p&gt;
&lt;p&gt;Clustering assumes that all cluster nodes are running with the same configuration file.
All component instances opting in to clustering use the instance key of each configured database, &lt;code&gt;postgresql://&amp;lt;host&amp;gt;:&amp;lt;port&amp;gt;/&amp;lt;dbname&amp;gt;&lt;/code&gt;, and a consistent hashing algorithm to determine ownership of each database between the cluster peers.
Each peer then only collects from the subset of databases it&amp;rsquo;s responsible for, and only exports the targets of those databases, so &lt;code&gt;prometheus.scrape&lt;/code&gt; components on the same node scrape exactly the databases the node owns.
When a node joins or leaves the cluster, every peer recalculates ownership: expect a short gap or a brief duplicate collection for a database while its ownership moves.
While the cluster isn&amp;rsquo;t yet ready to admit traffic, for example while it&amp;rsquo;s still forming and waiting for the minimum cluster size, the component doesn&amp;rsquo;t collect from any database.&lt;/p&gt;
&lt;p&gt;Every node exports the logs receivers of all configured databases, whether it owns them or not: a node that doesn&amp;rsquo;t own a database accepts and discards entries sent to that database&amp;rsquo;s receiver.
Log pipelines that forward PostgreSQL logs to the exported receivers therefore work unchanged on every node, but only the owning node processes the logs into error metrics.&lt;/p&gt;
&lt;p&gt;Clustering is also useful with a single database: when several cluster nodes run an identical configuration, exactly one node collects from the database at a time, which gives you a highly available setup without duplicate collection.&lt;/p&gt;
&lt;p&gt;If Alloy is &lt;em&gt;not&lt;/em&gt; running in clustered mode, then the block is a no-op and &lt;code&gt;database_observability.postgres&lt;/code&gt; collects from every configured database.&lt;/p&gt;
&lt;h3 id=&#34;query_details&#34;&gt;&lt;code&gt;query_details&lt;/code&gt;&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;collect_interval&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;duration&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;How frequently to collect information from database.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;&amp;quot;1m&amp;quot;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;statements_limit&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;integer&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Max number of recent queries to collect details for.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;100&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;query_samples&#34;&gt;&lt;code&gt;query_samples&lt;/code&gt;&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;collect_interval&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;duration&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;How frequently to collect information from database.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;&amp;quot;10s&amp;quot;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;disable_query_redaction&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;bool&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Collect unredacted SQL query text (might include parameters).&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;false&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;exclude_current_user&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;bool&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Deprecated. Use the top-level &lt;code&gt;exclude_current_user&lt;/code&gt; argument instead. This setting takes precedence over the top-level setting.&lt;/td&gt;
              &lt;td&gt;(unset)&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;enable_pre_classified_wait_events&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;boolean&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;When &lt;code&gt;true&lt;/code&gt;, emits telemetry data with pre-classified wait event information.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;true&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;schema_details&#34;&gt;&lt;code&gt;schema_details&lt;/code&gt;&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;collect_interval&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;duration&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;How frequently to collect information from database.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;&amp;quot;1m&amp;quot;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;cache_enabled&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;boolean&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Deprecated. Whether to enable caching of table definitions.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;true&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;cache_size&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;integer&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Deprecated. Cache size.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;256&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;cache_ttl&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;duration&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Deprecated. Cache TTL.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;&amp;quot;10m&amp;quot;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;The &lt;code&gt;cache_enabled&lt;/code&gt;, &lt;code&gt;cache_size&lt;/code&gt;, and &lt;code&gt;cache_ttl&lt;/code&gt; settings are deprecated: they are accepted for backward compatibility, but ignored.&lt;/p&gt;
&lt;h3 id=&#34;explain_plans&#34;&gt;&lt;code&gt;explain_plans&lt;/code&gt;&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;collect_interval&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;duration&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;How frequently to collect information from database.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;&amp;quot;1m&amp;quot;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;per_collect_ratio&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;float64&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The ratio of queries to collect explain plans for.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;1.0&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;logs&#34;&gt;&lt;code&gt;logs&lt;/code&gt;&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;enable_error_logs_processing&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;bool&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Emit per-query error telemetry by pairing error and statement log lines.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;false&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;The &lt;code&gt;logs&lt;/code&gt; collector is always enabled and counts server errors from the PostgreSQL logs forwarded to &lt;code&gt;logs_receiver&lt;/code&gt;. When &lt;code&gt;enable_error_logs_processing&lt;/code&gt; is &lt;code&gt;true&lt;/code&gt;, the collector additionally emits per-query error telemetry that associates each error with the query that caused it.&lt;/p&gt;
&lt;h3 id=&#34;health_check&#34;&gt;&lt;code&gt;health_check&lt;/code&gt;&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;collect_interval&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;duration&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;How frequently to collect information from database.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;&amp;quot;1h&amp;quot;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;prometheus_exporter&#34;&gt;&lt;code&gt;prometheus_exporter&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;prometheus_exporter&lt;/code&gt; block configures the embedded &lt;code&gt;postgres_exporter&lt;/code&gt; scrapers.
The &lt;code&gt;data_source_name&lt;/code&gt; is inherited from the parent block.
Only the &lt;code&gt;stat_statements&lt;/code&gt; collector is enabled by default.
The embedded exporter inherits the top-level &lt;code&gt;exclude_databases&lt;/code&gt; list in both &lt;code&gt;autodiscovery &amp;gt; database_denylist&lt;/code&gt; and &lt;code&gt;stat_statements &amp;gt; exclude_databases&lt;/code&gt;, inherits &lt;code&gt;include_databases&lt;/code&gt; in &lt;code&gt;autodiscovery &amp;gt; database_allowlist&lt;/code&gt;, and inherits the effective top-level &lt;code&gt;exclude_users&lt;/code&gt; list in &lt;code&gt;stat_statements &amp;gt; exclude_users&lt;/code&gt;.
Setting these nested filter lists in &lt;code&gt;prometheus_exporter&lt;/code&gt; is discouraged because it can cause the embedded exporter and the component&amp;rsquo;s collectors to monitor different databases or users.
Configure the top-level &lt;code&gt;exclude_databases&lt;/code&gt;, &lt;code&gt;include_databases&lt;/code&gt;, and &lt;code&gt;exclude_users&lt;/code&gt; arguments instead.
The embedded &lt;code&gt;stat_statements&lt;/code&gt; collector doesn&amp;rsquo;t support &lt;code&gt;include_databases&lt;/code&gt; or &lt;code&gt;include_users&lt;/code&gt;, so those filters apply to &lt;code&gt;database_observability.postgres&lt;/code&gt; collectors (and &lt;code&gt;autodiscovery&lt;/code&gt; for &lt;code&gt;include_databases&lt;/code&gt;) only.&lt;/p&gt;
&lt;p&gt;Refer to &lt;a href=&#34;../../prometheus/prometheus.exporter.postgres/&#34;&gt;&lt;code&gt;prometheus.exporter.postgres&lt;/code&gt;&lt;/a&gt; docs for the full list of supported arguments and sub-blocks.&lt;/p&gt;
&lt;h2 id=&#34;logs-collector&#34;&gt;&lt;code&gt;logs&lt;/code&gt; collector&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;logs&lt;/code&gt; collector processes PostgreSQL logs received through the &lt;code&gt;logs_receiver&lt;/code&gt; entry point. It counts server errors and exposes them as a Prometheus metric on the component&amp;rsquo;s metrics endpoint. When &lt;a href=&#34;#logs&#34;&gt;&lt;code&gt;enable_error_logs_processing&lt;/code&gt;&lt;/a&gt; is &lt;code&gt;true&lt;/code&gt;, it also emits per-query error telemetry as Loki log entries, so each error can be associated with the query that caused it.
When you define [&lt;code&gt;database_instance&lt;/code&gt;][database_instance] blocks, each database has its own entry point in the &lt;code&gt;logs_receivers&lt;/code&gt; export instead, keyed by block label.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;logs_receiver&lt;/code&gt; entry point must be fed by &lt;code&gt;loki&lt;/code&gt; log source components, for example:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;loki.source.file&lt;/code&gt;: to read and process PostgreSQL log files from a self-managed database instance&lt;/li&gt;
&lt;li&gt;&lt;code&gt;otelcol.receiver.awscloudwatch&lt;/code&gt; and &lt;code&gt;otelcol.exporter.loki&lt;/code&gt;: to read and process CloudWatch Logs for an AWS RDS instance&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;PostgreSQL must be configured with a specific &lt;code&gt;log_line_prefix&lt;/code&gt; so the collector can parse the logs.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;Refer to the &lt;a href=&#34;/docs/grafana-cloud/monitor-infrastructure/database-observability/set-up/postgres/&#34;&gt;PostgreSQL setup documentation&lt;/a&gt; for the required &lt;code&gt;log_line_prefix&lt;/code&gt; and detailed log configuration options.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h2 id=&#34;example&#34;&gt;Example&lt;/h2&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Alloy&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-alloy&#34;&gt;database_observability.postgres &amp;#34;orders_db&amp;#34; {
  data_source_name = &amp;#34;postgres://user:pass@localhost:5432/dbname&amp;#34;
  forward_to       = [loki.relabel.orders_db.receiver]

  // Enable per-query error telemetry from the processed PostgreSQL logs.
  logs {
    enable_error_logs_processing = true
  }
}

// OPTIONAL: read PostgreSQL log files and forward to logs collector
loki.source.file &amp;#34;postgres_logs&amp;#34; {
  targets = [{
    __path__ = &amp;#34;/var/log/postgresql/postgresql-*.log&amp;#34;,
    job      = &amp;#34;postgres-logs&amp;#34;,
  }]

  forward_to = [database_observability.postgres.orders_db.logs_receiver]
}

loki.relabel &amp;#34;orders_db&amp;#34; {
  forward_to = [loki.write.logs_service.receiver]
  rule {
    target_label = &amp;#34;job&amp;#34;
    replacement  = &amp;#34;integrations/db-o11y&amp;#34;
  }
  rule {
    target_label = &amp;#34;instance&amp;#34;
    replacement  = &amp;#34;orders_db&amp;#34;
  }
}

discovery.relabel &amp;#34;orders_db&amp;#34; {
  targets = database_observability.postgres.orders_db.targets

  rule {
    target_label = &amp;#34;job&amp;#34;
    replacement  = &amp;#34;integrations/db-o11y&amp;#34;
  }
  rule {
    target_label = &amp;#34;instance&amp;#34;
    replacement  = &amp;#34;orders_db&amp;#34;
  }
}

prometheus.scrape &amp;#34;orders_db&amp;#34; {
  targets    = discovery.relabel.orders_db.targets
  job_name   = &amp;#34;integrations/db-o11y&amp;#34;
  forward_to = [prometheus.remote_write.metrics_service.receiver]
}

prometheus.remote_write &amp;#34;metrics_service&amp;#34; {
  endpoint {
    url = sys.env(&amp;#34;&amp;lt;GRAFANA_CLOUD_HOSTED_METRICS_URL&amp;gt;&amp;#34;)
    basic_auth {
      username = sys.env(&amp;#34;&amp;lt;GRAFANA_CLOUD_HOSTED_METRICS_ID&amp;gt;&amp;#34;)
      password = sys.env(&amp;#34;&amp;lt;GRAFANA_CLOUD_RW_API_KEY&amp;gt;&amp;#34;)
    }
  }
}

loki.write &amp;#34;logs_service&amp;#34; {
  endpoint {
    url = sys.env(&amp;#34;&amp;lt;GRAFANA_CLOUD_HOSTED_LOGS_URL&amp;gt;&amp;#34;)
    basic_auth {
      username = sys.env(&amp;#34;&amp;lt;GRAFANA_CLOUD_HOSTED_LOGS_ID&amp;gt;&amp;#34;)
      password = sys.env(&amp;#34;&amp;lt;GRAFANA_CLOUD_RW_API_KEY&amp;gt;&amp;#34;)
    }
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Replace the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;GRAFANA_CLOUD_HOSTED_METRICS_URL&amp;gt;&lt;/code&gt;&lt;/em&gt;: The URL for your Grafana Cloud hosted metrics.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;GRAFANA_CLOUD_HOSTED_METRICS_ID&amp;gt;&lt;/code&gt;&lt;/em&gt;: The user ID for your Grafana Cloud hosted metrics.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;GRAFANA_CLOUD_RW_API_KEY&amp;gt;&lt;/code&gt;&lt;/em&gt;: Your Grafana Cloud API key.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;GRAFANA_CLOUD_HOSTED_LOGS_URL&amp;gt;&lt;/code&gt;&lt;/em&gt;: The URL for your Grafana Cloud hosted logs.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;GRAFANA_CLOUD_HOSTED_LOGS_ID&amp;gt;&lt;/code&gt;&lt;/em&gt;: The user ID for your Grafana Cloud hosted logs.&lt;/li&gt;
&lt;/ul&gt;
&lt;!-- START GENERATED COMPATIBLE COMPONENTS --&gt;
&lt;h2 id=&#34;compatible-components&#34;&gt;Compatible components&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;database_observability.postgres&lt;/code&gt; can accept arguments from the following components:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Components that export &lt;a href=&#34;../../../compatibility/#targets-exporters&#34;&gt;Targets&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Components that export &lt;a href=&#34;../../../compatibility/#loki-logsreceiver-exporters&#34;&gt;Loki &lt;code&gt;LogsReceiver&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;code&gt;database_observability.postgres&lt;/code&gt; has exports that can be consumed by the following components:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Components that consume &lt;a href=&#34;../../../compatibility/#targets-consumers&#34;&gt;Targets&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Components that consume &lt;a href=&#34;../../../compatibility/#loki-logsreceiver-consumers&#34;&gt;Loki &lt;code&gt;LogsReceiver&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;Connecting some components may not be sensible or components may require further configuration to make the connection work correctly.
Refer to the linked documentation for more details.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;!-- END GENERATED COMPATIBLE COMPONENTS --&gt;
]]></content><description>&lt;h1 id="database_observabilitypostgres">&lt;code>database_observability.postgres&lt;/code>&lt;/h1>
&lt;p>&lt;code>database_observability.postgres&lt;/code> connects to a PostgreSQL database and collects observability data from system catalogs and the &lt;code>pg_stat_statements&lt;/code> extension.
The component collects query details, schema information, explain plans, query samples, and processes PostgreSQL logs.
It forwards this data as log entries to Loki receivers and exports targets for Prometheus scraping.&lt;/p></description></item><item><title>database_observability.sql_server</title><link>https://grafana.com/docs/alloy/v1.22/reference/components/database_observability/database_observability.sql_server/</link><pubDate>Fri, 13 Nov 2026 04:21:39 +0000</pubDate><guid>https://grafana.com/docs/alloy/v1.22/reference/components/database_observability/database_observability.sql_server/</guid><content><![CDATA[&lt;h1 id=&#34;database_observabilitysql_server&#34;&gt;&lt;code&gt;database_observability.sql_server&lt;/code&gt;&lt;/h1&gt;


&lt;div data-shared=&#34;stability/experimental.md&#34;&gt;
            &lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;EXPERIMENTAL&lt;/strong&gt;: This is an &lt;a href=&#34;/docs/release-life-cycle/&#34;&gt;experimental&lt;/a&gt; component.
Experimental components are subject to frequent breaking changes, and may be removed with no equivalent replacement.
To enable and use an experimental component, you must set the &lt;code&gt;stability.level&lt;/code&gt; 
    &lt;a href=&#34;/docs/alloy/v1.22/reference/cli/run/&#34;&gt;flag&lt;/a&gt; to &lt;code&gt;experimental&lt;/code&gt;.&lt;/p&gt;&lt;/blockquote&gt;
&lt;/div&gt;

        
&lt;p&gt;&lt;code&gt;database_observability.sql_server&lt;/code&gt; connects to a Microsoft SQL Server instance and collects observability data across every accessible user database on that instance.
The component forwards this data as log entries to Loki receivers and exports targets for Prometheus scraping.&lt;/p&gt;
&lt;h2 id=&#34;usage&#34;&gt;Usage&lt;/h2&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Alloy&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-alloy&#34;&gt;database_observability.sql_server &amp;#34;&amp;lt;LABEL&amp;gt;&amp;#34; {
  data_source_name = &amp;lt;DATA_SOURCE_NAME&amp;gt;
  forward_to       = [&amp;lt;LOKI_RECEIVERS&amp;gt;]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;p&gt;You can use the following arguments with &lt;code&gt;database_observability.sql_server&lt;/code&gt;:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;data_source_name&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;secret&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;a href=&#34;https://github.com/microsoft/go-mssqldb#connection-parameters-and-dsn&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Data Source Name&lt;/a&gt; for the SQL Server instance to connect to. Required when no &lt;code&gt;database_instance&lt;/code&gt; blocks are defined.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;forward_to&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;list(LogsReceiver)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Where to forward log entries after processing.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;targets&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;list(map(string))&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;List of external targets to scrape.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;disable_collectors&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;list(string)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;A list of collectors to disable from the default set.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;enable_collectors&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;list(string)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;A list of collectors to enable on top of the default set.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;exclude_current_user&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;bool&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Exclude tagged Alloy queries and query samples from sessions matching the Alloy application name or opened with the login that Alloy uses.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;true&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;exclude_schemas&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;list(string)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;A list of schemas to exclude from monitoring on top of the default exclusions.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;[&amp;quot;alloydbadmin&amp;quot;, &amp;quot;alloydbmetadata&amp;quot;, &amp;quot;azure_maintenance&amp;quot;, &amp;quot;azure_sys&amp;quot;, &amp;quot;cloudsqladmin&amp;quot;, &amp;quot;rdsadmin&amp;quot;]&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;include_schemas&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;list(string)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;A list of schemas to monitor. When empty, all non-excluded schemas are monitored. Items in &lt;code&gt;include_schemas&lt;/code&gt; override the default exclusions, but cannot overlap with &lt;code&gt;exclude_schemas&lt;/code&gt; or system schemas (&lt;code&gt;sys&lt;/code&gt;, &lt;code&gt;information_schema&lt;/code&gt;).&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;[]&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;exclude_databases&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;list(string)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;A list of databases to exclude from monitoring on top of the default exclusions.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;[&amp;quot;alloydbadmin&amp;quot;, &amp;quot;alloydbmetadata&amp;quot;, &amp;quot;azure_maintenance&amp;quot;, &amp;quot;azure_sys&amp;quot;, &amp;quot;cloudsqladmin&amp;quot;, &amp;quot;rdsadmin&amp;quot;]&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;include_databases&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;list(string)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;A list of databases to monitor. When empty, all non-excluded databases are monitored. Items in &lt;code&gt;include_databases&lt;/code&gt; override the default exclusions, but cannot overlap with &lt;code&gt;exclude_databases&lt;/code&gt; or system databases (&lt;code&gt;master&lt;/code&gt;, &lt;code&gt;model&lt;/code&gt;, &lt;code&gt;msdb&lt;/code&gt;, &lt;code&gt;tempdb&lt;/code&gt;).&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;[]&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;exclude_users&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;list(string)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;A list of original SQL Server login names to exclude from query samples on top of the default exclusions.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;[&amp;quot;azuresu&amp;quot;, &amp;quot;cloudsqladmin&amp;quot;, &amp;quot;db-o11y&amp;quot;, &amp;quot;rdsadmin&amp;quot;]&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;include_users&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;list(string)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;A list of original SQL Server login names to monitor in query samples. When empty, all non-excluded logins are monitored. Items in &lt;code&gt;include_users&lt;/code&gt; override the default exclusions, but cannot overlap with &lt;code&gt;exclude_users&lt;/code&gt;. &lt;code&gt;exclude_current_user&lt;/code&gt; still takes precedence.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;[]&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;query_timeout&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;duration&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Timeout for each SQL statement.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;&amp;quot;10s&amp;quot;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;When &lt;code&gt;data_source_name&lt;/code&gt; doesn&amp;rsquo;t specify an application name (&lt;code&gt;app name&lt;/code&gt;), Alloy sets it to &lt;code&gt;grafana:alloy:database_observability&lt;/code&gt; on its SQL Server connections.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;exclude_current_user&lt;/code&gt; argument excludes SQL tagged by Alloy from query metrics, query details, explain plans, and query samples.
Query Store doesn&amp;rsquo;t identify the login or application name that executed a query, so this exclusion can&amp;rsquo;t remove arbitrary historical queries by login or previously captured Alloy queries without the marker.&lt;/p&gt;
&lt;p&gt;For live query samples, &lt;code&gt;exclude_current_user&lt;/code&gt; also excludes sessions whose &lt;code&gt;sys.dm_exec_sessions.program_name&lt;/code&gt; is &lt;code&gt;grafana:alloy:database_observability&lt;/code&gt; or that were opened with the SQL Server login configured for Alloy.
For &lt;code&gt;server_metrics&lt;/code&gt;, &lt;code&gt;exclude_current_user&lt;/code&gt; excludes sessions whose &lt;code&gt;sys.dm_exec_sessions.program_name&lt;/code&gt; is &lt;code&gt;grafana:alloy:database_observability&lt;/code&gt; from &lt;code&gt;database_observability_sql_server_user_sessions&lt;/code&gt;.
Setting it to &lt;code&gt;false&lt;/code&gt; disables marker, application name, and automatic current-login exclusion.
The &lt;code&gt;exclude_users&lt;/code&gt; list still applies to query samples, and Alloy always excludes the request that collects the samples.
Schema discovery, server configuration, and health-check results aren&amp;rsquo;t filtered by this argument.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;query_timeout&lt;/code&gt; applies separately to each SQL statement.
The timeout includes waiting for an available connection and reading the statement results.
A collection cycle can run multiple statements and can take longer than &lt;code&gt;query_timeout&lt;/code&gt;.
The &lt;code&gt;server_metrics&lt;/code&gt; collector also runs multiple statements during a Prometheus scrape, so the total scrape duration can exceed &lt;code&gt;query_timeout&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The following collectors are configurable:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Enabled by default&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;explain_plans&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Collect and parse query execution plans already captured by Query Store.&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;query_details&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Collect query text and parsed table names from Query Store.&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;query_metrics&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Collect per-query executions, errors, and duration counters from Query Store.&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;query_samples&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Collect query samples and wait events for tracked queries.&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;schema_details&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Collect schemas and tables from &lt;code&gt;information_schema&lt;/code&gt;.&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;server_configuration&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Collect connection, resource-limit, and memory configuration metrics.&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;server_metrics&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Collect SQL Server CPU, memory, and user session metrics.&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;blocks&#34;&gt;Blocks&lt;/h2&gt;
&lt;p&gt;You can use the following blocks with &lt;code&gt;database_observability.sql_server&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;config-app&#34; style=&#34;--config-tree-row-count: 15;&#34; x3-data=&#34;configVisualizer(&amp;#34;\u003csection class=\&amp;#34;expand-table-wrapper\&amp;#34;\u003e\u003cdiv class=\&amp;#34;button-div\&amp;#34;\u003e\n      \u003cbutton class=\&amp;#34;expand-table-btn\&amp;#34;\u003eExpand table\u003c/button\u003e\n    \u003c/div\u003e\u003cdiv class=\&amp;#34;responsive-table-wrapper\&amp;#34;\u003e\n    \u003ctable\u003e\n      \u003cthead\u003e\n          \u003ctr\u003e\n              \u003cth\u003eBlock\u003c/th\u003e\n              \u003cth\u003eDescription\u003c/th\u003e\n              \u003cth\u003eRequired\u003c/th\u003e\n          \u003c/tr\u003e\n      \u003c/thead\u003e\n      \u003ctbody\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#cloud_provider\&amp;#34;\u003e\u003ccode\u003ecloud_provider\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eProvide Cloud Provider information.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ccode\u003ecloud_provider\u003c/code\u003e \u0026gt; \u003ca href=\&amp;#34;#aws\&amp;#34;\u003e\u003ccode\u003eaws\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eProvide AWS database host information.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ccode\u003ecloud_provider\u003c/code\u003e \u0026gt; \u003ca href=\&amp;#34;#azure\&amp;#34;\u003e\u003ccode\u003eazure\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eProvide Azure database host information.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ccode\u003ecloud_provider\u003c/code\u003e \u0026gt; \u003ca href=\&amp;#34;#gcp\&amp;#34;\u003e\u003ccode\u003egcp\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eProvide GCP database host information.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#database_instance\&amp;#34;\u003e\u003ccode\u003edatabase_instance\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eDefine one SQL Server instance to monitor. Repeat the block to monitor several instances.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ccode\u003edatabase_instance\u003c/code\u003e \u0026gt; \u003ca href=\&amp;#34;#cloud_provider\&amp;#34;\u003e\u003ccode\u003ecloud_provider\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eProvide Cloud Provider information for one instance.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ccode\u003edatabase_instance\u003c/code\u003e \u0026gt; \u003ca href=\&amp;#34;#rule\&amp;#34;\u003e\u003ccode\u003erule\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eRelabel the metrics and logs of one instance.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#clustering\&amp;#34;\u003e\u003ccode\u003eclustering\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eConfigure the component for when Alloy is running in clustered mode.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#explain_plans\&amp;#34;\u003e\u003ccode\u003eexplain_plans\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eConfigure the query execution plan collector.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#health_check\&amp;#34;\u003e\u003ccode\u003ehealth_check\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eConfigure the health check collector.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#query_details\&amp;#34;\u003e\u003ccode\u003equery_details\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eConfigure the Query Store query text collector.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#query_metrics\&amp;#34;\u003e\u003ccode\u003equery_metrics\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eConfigure the Query Store metrics collector.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#query_samples\&amp;#34;\u003e\u003ccode\u003equery_samples\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eConfigure the query samples collector.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#schema_details\&amp;#34;\u003e\u003ccode\u003eschema_details\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eConfigure the schema and table details collector.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#server_configuration\&amp;#34;\u003e\u003ccode\u003eserver_configuration\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eConfigure the server configuration collector.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n      \u003c/tbody\u003e\n    \u003c/table\u003e\n  \u003c/div\u003e\n\u003c/section\u003e&amp;#34;)&#34;&gt;
  &lt;noscript&gt;
    &lt;div class=&#34;config-app__noscript&#34;&gt;&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Block&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#cloud_provider&#34;&gt;&lt;code&gt;cloud_provider&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Provide Cloud Provider information.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;cloud_provider&lt;/code&gt; &amp;gt; &lt;a href=&#34;#aws&#34;&gt;&lt;code&gt;aws&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Provide AWS database host information.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;cloud_provider&lt;/code&gt; &amp;gt; &lt;a href=&#34;#azure&#34;&gt;&lt;code&gt;azure&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Provide Azure database host information.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;cloud_provider&lt;/code&gt; &amp;gt; &lt;a href=&#34;#gcp&#34;&gt;&lt;code&gt;gcp&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Provide GCP database host information.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#database_instance&#34;&gt;&lt;code&gt;database_instance&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Define one SQL Server instance to monitor. Repeat the block to monitor several instances.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_instance&lt;/code&gt; &amp;gt; &lt;a href=&#34;#cloud_provider&#34;&gt;&lt;code&gt;cloud_provider&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Provide Cloud Provider information for one instance.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_instance&lt;/code&gt; &amp;gt; &lt;a href=&#34;#rule&#34;&gt;&lt;code&gt;rule&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Relabel the metrics and logs of one instance.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#clustering&#34;&gt;&lt;code&gt;clustering&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Configure the component for when Alloy is running in clustered mode.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#explain_plans&#34;&gt;&lt;code&gt;explain_plans&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Configure the query execution plan collector.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#health_check&#34;&gt;&lt;code&gt;health_check&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Configure the health check collector.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#query_details&#34;&gt;&lt;code&gt;query_details&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Configure the Query Store query text collector.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#query_metrics&#34;&gt;&lt;code&gt;query_metrics&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Configure the Query Store metrics collector.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#query_samples&#34;&gt;&lt;code&gt;query_samples&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Configure the query samples collector.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#schema_details&#34;&gt;&lt;code&gt;schema_details&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Configure the schema and table details collector.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#server_configuration&#34;&gt;&lt;code&gt;server_configuration&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Configure the server configuration collector.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;/div&gt;
  &lt;/noscript&gt;
  &lt;main class=&#34;config-app__main&#34;&gt;
    &lt;template x3-if=&#34;flatBlocks.length === 0&#34;&gt;
      &lt;div class=&#34;empty-state&#34;&gt;
        &lt;div class=&#34;empty-state__icon&#34; x3-html=&#34;icons.AlertCircle&#34;&gt;&lt;/div&gt;
        &lt;p&gt;No valid configuration blocks found.&lt;/p&gt;
      &lt;/div&gt;
    &lt;/template&gt;

    &lt;template x3-if=&#34;flatBlocks.length &gt; 0&#34;&gt;
      &lt;div class=&#34;config-tree&#34;&gt;
        &lt;div class=&#34;config-tree__toolbar&#34;&gt;
          &lt;div class=&#34;config-tree__title&#34;&gt;&lt;/div&gt;
          &lt;button
            class=&#34;tree-explorer__button w-130 text-right&#34;
            x3-on:click=&#34;toggleExpandAll&#34;
            x3-bind:title=&#34;allExpanded ? &#39;Collapse all&#39; : &#39;Expand all&#39;&#34;
          &gt;
            &lt;span x3-text=&#34;allExpanded ? &#39;Collapse all&#39; : &#39;Expand all&#39;&#34;&gt;&lt;/span&gt;
            &lt;svg class=&#34;api-icon&#34; viewBox=&#34;0 0 24 24&#34;&gt;
              &lt;path x3-show=&#34;!allExpanded&#34; d=&#34;m6 9 6 6 6-6&#34; /&gt;
              &lt;path x3-show=&#34;allExpanded&#34; d=&#34;m18 15-6-6-6 6&#34; /&gt;
            &lt;/svg&gt;
          &lt;/button&gt;
        &lt;/div&gt;

        &lt;div class=&#34;nodes-container&#34;&gt;
          &lt;template x3-for=&#34;block in flatBlocks&#34; x3-bind:key=&#34;block.id&#34;&gt;
            &lt;div class=&#34;node&#34; x3-bind:class=&#34;isNodeVisible(block) ? &#39;node--visible&#39; : &#39;node--hidden&#39;&#34;&gt;
              &lt;div
                class=&#34;node__row&#34;
                x3-bind:class=&#34;getRowClass(block)&#34;
                x3-bind:style=&#34;`padding-left: ${block.level * 24 &#43; 16}px`&#34;
                x3-on:click=&#34;toggleNode(block.id)&#34;
              &gt;
                &lt;div class=&#34;node__left&#34;&gt;
                  &lt;div class=&#34;node__indicator&#34;&gt;
                    &lt;template x3-if=&#34;block.hasChildren&#34;&gt;
                      &lt;button type=&#34;button&#34; class=&#34;node__toggle&#34; x3-on:click.stop=&#34;toggleNode(block.id)&#34;&gt;
                        &lt;div
                          class=&#34;node__toggle-icon&#34;
                          x3-bind:class=&#34;block.expanded ? &#39;node__toggle-icon--expanded&#39; : &#39;&#39;&#34;
                          x3-html=&#34;icons.ChevronDown&#34;
                        &gt;&lt;/div&gt;
                      &lt;/button&gt;
                    &lt;/template&gt;
                    &lt;template x3-if=&#34;!block.hasChildren&#34;&gt;
                      &lt;div class=&#34;node__toggle-spacer&#34;&gt;&lt;/div&gt;
                    &lt;/template&gt;
                  &lt;/div&gt;

                  &lt;div class=&#34;node__content&#34;&gt;
                    &lt;div
                      class=&#34;node__title prose&#34;
                      x3-bind:class=&#34;block.level === 0 ? &#39;node__title--root&#39; : &#39;node__title--nested&#39;&#34;
                      x3-html=&#34;block.displayName&#34;
                    &gt;&lt;/div&gt;
                    &lt;div class=&#34;node__description body-xsmall&#34; x3-html=&#34;block.description&#34;&gt;&lt;/div&gt;
                  &lt;/div&gt;
                &lt;/div&gt;

                &lt;div class=&#34;node__meta&#34;&gt;
                  &lt;span
                    class=&#34;badge&#34;
                    x3-bind:class=&#34;block.required ? &#39;badge--required&#39; : &#39;badge--optional&#39;&#34;
                    x3-text=&#34;block.required ? &#39;Required&#39; : &#39;Optional&#39;&#34;
                  &gt;&lt;/span&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;
          &lt;/template&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/template&gt;
  &lt;/main&gt;
&lt;/div&gt;

&lt;h3 id=&#34;cloud_provider&#34;&gt;&lt;code&gt;cloud_provider&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;cloud_provider&lt;/code&gt; block has no attributes.
It contains zero or one of the &lt;a href=&#34;#aws&#34;&gt;&lt;code&gt;aws&lt;/code&gt;&lt;/a&gt;, &lt;a href=&#34;#azure&#34;&gt;&lt;code&gt;azure&lt;/code&gt;&lt;/a&gt;, or &lt;a href=&#34;#gcp&#34;&gt;&lt;code&gt;gcp&lt;/code&gt;&lt;/a&gt; blocks.
You use the &lt;code&gt;cloud_provider&lt;/code&gt; block to provide information related to the cloud provider that hosts the database under observation.
This information is appended as labels to the collected metrics.
The labels make it easier for you to filter and group your metrics.&lt;/p&gt;
&lt;p&gt;When you don&amp;rsquo;t configure a &lt;code&gt;cloud_provider&lt;/code&gt; block, Alloy attempts to detect AWS RDS and Azure SQL hosts from the &lt;code&gt;data_source_name&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;aws&#34;&gt;&lt;code&gt;aws&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;aws&lt;/code&gt; block supplies the &lt;a href=&#34;https://docs.aws.amazon.com/IAM/latest/UserGuide/reference-arns.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;ARN&lt;/a&gt; identifier for the database being monitored.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;arn&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The ARN associated with the database under observation.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;azure&#34;&gt;&lt;code&gt;azure&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;azure&lt;/code&gt; block supplies the identifying information for the database being monitored.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;subscription_id&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The Subscription ID for your Azure account.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;resource_group&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The Resource Group that holds the database resource.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;server_name&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The database server name, for example &lt;code&gt;orders-db&lt;/code&gt; for the host &lt;code&gt;orders-db.database.windows.net&lt;/code&gt;.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;gcp&#34;&gt;&lt;code&gt;gcp&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;gcp&lt;/code&gt; block supplies the identifying information for the GCP Cloud SQL database being monitored.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;connection_name&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The Cloud SQL instance connection name in the format &lt;code&gt;project:region:instance&lt;/code&gt;, for example &lt;code&gt;my-project:us-central1:my-db&lt;/code&gt;.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;database_instance&#34;&gt;&lt;code&gt;database_instance&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;database_instance&lt;/code&gt; block defines one SQL Server instance to monitor.
Repeat the block to monitor several instances with a single component.
The block label must be unique across &lt;code&gt;database_instance&lt;/code&gt; blocks and identifies the instance in the component&amp;rsquo;s metrics endpoint path.
Each &lt;code&gt;database_instance&lt;/code&gt; block must also point to a distinct server: two blocks that resolve to the same host, port or named instance, and database name are rejected.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;data_source_name&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;secret&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;a href=&#34;https://github.com/microsoft/go-mssqldb#connection-parameters-and-dsn&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Data Source Name&lt;/a&gt; for the SQL Server instance to connect to.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;Each &lt;code&gt;database_instance&lt;/code&gt; block can also contain a [&lt;code&gt;cloud_provider&lt;/code&gt;][cloud_provider] block that applies to that instance only, and [&lt;code&gt;rule&lt;/code&gt;][rule] blocks that relabel the metrics and logs of that instance only.&lt;/p&gt;
&lt;p&gt;When you define &lt;code&gt;database_instance&lt;/code&gt; blocks, don&amp;rsquo;t set the top-level &lt;code&gt;data_source_name&lt;/code&gt;, &lt;code&gt;targets&lt;/code&gt;, and &lt;code&gt;cloud_provider&lt;/code&gt; arguments.
They&amp;rsquo;re mutually exclusive with &lt;code&gt;database_instance&lt;/code&gt; blocks.
All other arguments and blocks, such as collector settings, apply to every configured instance.&lt;/p&gt;
&lt;p&gt;The metrics for each instance are served on a separate &lt;code&gt;/db/&amp;lt;LABEL&amp;gt;/metrics&lt;/code&gt; path under the component&amp;rsquo;s HTTP endpoint, and the exported targets point to the corresponding path.
When you don&amp;rsquo;t define &lt;code&gt;database_instance&lt;/code&gt; blocks, the component serves metrics on its historical &lt;code&gt;/metrics&lt;/code&gt; path.
The metrics endpoints are served exactly at those paths: requests to any other path under the component&amp;rsquo;s HTTP endpoint return HTTP 404.&lt;/p&gt;
&lt;p&gt;For example:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Alloy&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-alloy&#34;&gt;database_observability.sql_server &amp;#34;pool&amp;#34; {
  forward_to = [loki.write.logs_service.receiver]

  database_instance &amp;#34;orders&amp;#34; {
    data_source_name = sys.env(&amp;#34;ORDERS_DSN&amp;#34;)

    cloud_provider {
      aws {
        arn = &amp;#34;orders-rds-db-arn&amp;#34;
      }
    }

    rule {
      target_label = &amp;#34;environment&amp;#34;
      replacement  = &amp;#34;production&amp;#34;
    }
  }

  database_instance &amp;#34;billing&amp;#34; {
    data_source_name = sys.env(&amp;#34;BILLING_DSN&amp;#34;)

    rule {
      target_label = &amp;#34;environment&amp;#34;
      replacement  = &amp;#34;staging&amp;#34;
    }
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;In this example, the metrics and logs of the &lt;code&gt;orders&lt;/code&gt; instance carry &lt;code&gt;environment=&amp;quot;production&amp;quot;&lt;/code&gt;, and those of the &lt;code&gt;billing&lt;/code&gt; instance carry &lt;code&gt;environment=&amp;quot;staging&amp;quot;&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;rule&#34;&gt;&lt;code&gt;rule&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;rule&lt;/code&gt; block relabels the metrics and the logs of the &lt;code&gt;database_instance&lt;/code&gt; block that contains it.
Use it to tell the data of each monitored instance apart, for example by environment, team, or tier.&lt;/p&gt;


&lt;div data-shared=&#34;reference/components/rule-block-database-observability.md&#34;&gt;
            &lt;p&gt;The &lt;code&gt;rule&lt;/code&gt; block defines a relabeling rule applied to the metrics and the logs of a single monitored database.
If you define more than one &lt;code&gt;rule&lt;/code&gt; block, the rules are applied in top-down order, after the labels the component sets itself, so a rule can read those labels with &lt;code&gt;source_labels&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;It takes the same arguments as the 
    &lt;a href=&#34;/docs/alloy/v1.22/reference/components/prometheus/prometheus.relabel/#rule&#34;&gt;&lt;code&gt;rule&lt;/code&gt; block&lt;/a&gt; used elsewhere in Alloy, in a restricted form: because one rule set applies to two signal paths, it supports the labelling actions only, and it can&amp;rsquo;t overwrite most of the labels the component sets.
Alloy refuses to load a configuration containing a rule that breaks either restriction, so such a rule is never silently ignored.&lt;/p&gt;
&lt;p&gt;Two further constraints are specific to a &lt;code&gt;database_instance&lt;/code&gt; block:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;target_label&lt;/code&gt; must be a literal label name&lt;/strong&gt;: Alloy checks it against the reserved labels when it loads the configuration, so it can&amp;rsquo;t contain a capture group reference.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;hashmod&lt;/code&gt; requires &lt;code&gt;source_labels&lt;/code&gt;, and can&amp;rsquo;t target &lt;code&gt;instance&lt;/code&gt;&lt;/strong&gt;: hashing the empty value gives every database the same result, and hashing into &lt;code&gt;instance&lt;/code&gt; buckets several databases onto one value even when the source is present.&lt;/li&gt;
&lt;/ul&gt;


&lt;div class=&#34;admonition admonition-caution&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Caution&lt;/p&gt;&lt;p&gt;A relabeling rule that computes an empty value &lt;em&gt;removes&lt;/em&gt; its target label instead of setting it, and the default &lt;code&gt;replacement&lt;/code&gt; of &lt;code&gt;&amp;quot;$1&amp;quot;&lt;/code&gt; computes an empty value when a rule has no &lt;code&gt;source_labels&lt;/code&gt;.
So &lt;code&gt;rule { target_label = &amp;quot;environment&amp;quot; }&lt;/code&gt; removes &lt;code&gt;environment&lt;/code&gt; rather than setting it, and Alloy rejects it.
Always set &lt;code&gt;replacement&lt;/code&gt; alongside a &lt;code&gt;target_label&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Alloy can only reject such a rule where the outcome is certain.
A rule that reads &lt;code&gt;source_labels&lt;/code&gt; depends on the labels present at runtime, so a missing or misspelled source label still removes the target label, except for the reserved labels and &lt;code&gt;instance&lt;/code&gt;, which keep their previous value.
Only removal is prevented: a rule that computes a &lt;em&gt;non-empty&lt;/em&gt; value still overwrites those labels, which is why &lt;code&gt;hashmod&lt;/code&gt; can&amp;rsquo;t target &lt;code&gt;instance&lt;/code&gt; at all.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;You can use the &lt;code&gt;hashmod&lt;/code&gt;, &lt;code&gt;labeldrop&lt;/code&gt;, &lt;code&gt;lowercase&lt;/code&gt;, &lt;code&gt;replace&lt;/code&gt;, and &lt;code&gt;uppercase&lt;/code&gt; actions.
The rest aren&amp;rsquo;t supported:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;drop&lt;/code&gt;, &lt;code&gt;dropequal&lt;/code&gt;, &lt;code&gt;keep&lt;/code&gt;, and &lt;code&gt;keepequal&lt;/code&gt; filter rather than label, and filtering means two different things on the two signal paths. Dropping a metrics target stops the database exporting metrics entirely, whereas dropping a log entry discards one line. To filter one database&amp;rsquo;s logs, use a 
    &lt;a href=&#34;/docs/alloy/v1.22/reference/components/loki/loki.relabel/&#34;&gt;&lt;code&gt;loki.relabel&lt;/code&gt;&lt;/a&gt; component on the receiver named in &lt;code&gt;forward_to&lt;/code&gt;, with a &lt;code&gt;drop&lt;/code&gt; rule that matches that database&amp;rsquo;s &lt;code&gt;instance&lt;/code&gt; or &lt;code&gt;server_id&lt;/code&gt;. Every database the component monitors forwards to the same receivers, so the rule has to identify the one it applies to. To filter one database&amp;rsquo;s metrics, use a 
    &lt;a href=&#34;/docs/alloy/v1.22/reference/components/discovery/discovery.relabel/&#34;&gt;&lt;code&gt;discovery.relabel&lt;/code&gt;&lt;/a&gt; component on the component&amp;rsquo;s exported targets.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;labelmap&lt;/code&gt; builds label names from &lt;code&gt;replacement&lt;/code&gt; at runtime, so Alloy can&amp;rsquo;t check them against the reserved labels when it loads the configuration.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;labelkeep&lt;/code&gt; removes every label its &lt;code&gt;regex&lt;/code&gt; doesn&amp;rsquo;t match, so a rule that preserves the reserved labels would have to match all of them. Use &lt;code&gt;labeldrop&lt;/code&gt; to remove specific labels instead.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Because the rules run after the component&amp;rsquo;s own labels, and those are protected, a &lt;code&gt;labeldrop&lt;/code&gt; rule can only remove a label that an earlier rule in the same block created.&lt;/p&gt;
&lt;h4 id=&#34;reserved-labels&#34;&gt;Reserved labels&lt;/h4&gt;
&lt;p&gt;A rule can&amp;rsquo;t write to the following labels, and a &lt;code&gt;labeldrop&lt;/code&gt; regular expression can&amp;rsquo;t match them:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Both metrics and logs&lt;/strong&gt;: &lt;code&gt;job&lt;/code&gt; and &lt;code&gt;server_id&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Logs only&lt;/strong&gt;: &lt;code&gt;engine&lt;/code&gt; and &lt;code&gt;op&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Metrics only&lt;/strong&gt;: &lt;code&gt;provider_name&lt;/code&gt;, &lt;code&gt;provider_region&lt;/code&gt;, &lt;code&gt;provider_account&lt;/code&gt;, &lt;code&gt;__address__&lt;/code&gt;, &lt;code&gt;__scheme__&lt;/code&gt;, and &lt;code&gt;__metrics_path__&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This applies to &lt;code&gt;rule&lt;/code&gt; blocks only.
A downstream &lt;code&gt;discovery.relabel&lt;/code&gt; or &lt;code&gt;loki.relabel&lt;/code&gt; component can still overwrite any of them, but it applies to every database the component monitors rather than one.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;instance&lt;/code&gt; label is a special case: a rule can rewrite its value, which is a common reason to use a &lt;code&gt;rule&lt;/code&gt; block, because a friendly name such as &lt;code&gt;orders_db&lt;/code&gt; then applies to that database&amp;rsquo;s metrics and logs together.
A rule can&amp;rsquo;t remove it, because metrics and logs are correlated on it, and because an empty &lt;code&gt;instance&lt;/code&gt; on a metrics target makes Prometheus fill it in from &lt;code&gt;__address__&lt;/code&gt;, which every database in one component shares, collapsing them all onto one series.&lt;/p&gt;
&lt;p&gt;For the same reason, two &lt;code&gt;database_instance&lt;/code&gt; blocks can&amp;rsquo;t rewrite &lt;code&gt;instance&lt;/code&gt; to the same value.
Alloy rejects that when both values are fixed in the configuration, but it can&amp;rsquo;t when the value comes from a label the databases share: &lt;code&gt;source_labels = [&amp;quot;job&amp;quot;]&lt;/code&gt; gives every database the same &lt;code&gt;instance&lt;/code&gt;, since they all carry the same &lt;code&gt;job&lt;/code&gt;.
Derive &lt;code&gt;instance&lt;/code&gt; from something that differs per database, or set a literal value in each block.&lt;/p&gt;
&lt;h4 id=&#34;labels-set-on-only-one-signal-path&#34;&gt;Labels set on only one signal path&lt;/h4&gt;
&lt;p&gt;Some of the labels above exist on one signal path and not the other, and a rule that reads one with &lt;code&gt;source_labels&lt;/code&gt; behaves differently on each path: where the label is absent the rule computes an empty value, which &lt;em&gt;removes&lt;/em&gt; its &lt;code&gt;target_label&lt;/code&gt; rather than setting it to an empty string.&lt;/p&gt;
&lt;p&gt;A rule reading &lt;code&gt;provider_region&lt;/code&gt;, which a database with a &lt;a href=&#34;#cloud_provider&#34;&gt;&lt;code&gt;cloud_provider&lt;/code&gt;&lt;/a&gt; block carries on its metrics targets but not on its log entries, sets &lt;code&gt;region&lt;/code&gt; on that database&amp;rsquo;s metrics and removes &lt;code&gt;region&lt;/code&gt; from its logs.
Reading a logs-only label such as &lt;code&gt;op&lt;/code&gt; does the same in reverse.
Only &lt;code&gt;job&lt;/code&gt;, &lt;code&gt;server_id&lt;/code&gt;, and &lt;code&gt;instance&lt;/code&gt; are set on both paths, so prefer those as &lt;code&gt;source_labels&lt;/code&gt;, or a label an earlier rule in the same block created.&lt;/p&gt;
&lt;/div&gt;

        
&lt;h3 id=&#34;clustering&#34;&gt;&lt;code&gt;clustering&lt;/code&gt;&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;enabled&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;bool&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Enables distributing instances with other cluster nodes.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;false&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;When Alloy is &lt;a href=&#34;../../../../get-started/clustering/&#34;&gt;using clustering&lt;/a&gt;, and &lt;code&gt;enabled&lt;/code&gt; is set to true, then this &lt;code&gt;database_observability.sql_server&lt;/code&gt; component instance opts-in to distributing its configured instances between all cluster nodes.&lt;/p&gt;
&lt;p&gt;Clustering assumes that all cluster nodes are running with the same configuration file.
All component instances opting in to clustering use the instance key of each configured instance, &lt;code&gt;&amp;lt;host&amp;gt;:&amp;lt;port&amp;gt;/&amp;lt;database&amp;gt;&lt;/code&gt;, and a consistent hashing algorithm to determine ownership of each instance between the cluster peers.
Each peer then only collects from the subset of instances it&amp;rsquo;s responsible for, and only exports the targets of those instances, so &lt;code&gt;prometheus.scrape&lt;/code&gt; components on the same node scrape exactly the instances the node owns.
When a node joins or leaves the cluster, every peer recalculates ownership: expect a short gap or a brief duplicate collection for an instance while its ownership moves.
While the cluster isn&amp;rsquo;t yet ready to admit traffic, for example while it&amp;rsquo;s still forming and waiting for the minimum cluster size, the component doesn&amp;rsquo;t collect from any instance.&lt;/p&gt;
&lt;p&gt;Clustering is also useful with a single instance: when several cluster nodes run an identical configuration, exactly one node collects from the instance at a time, which gives you a highly available setup without duplicate collection.&lt;/p&gt;
&lt;p&gt;If Alloy is &lt;em&gt;not&lt;/em&gt; running in clustered mode, then the block is a no-op and &lt;code&gt;database_observability.sql_server&lt;/code&gt; collects from every configured instance.&lt;/p&gt;
&lt;h3 id=&#34;explain_plans&#34;&gt;&lt;code&gt;explain_plans&lt;/code&gt;&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;collect_interval&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;duration&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;How frequently to check for a changed execution plan.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;&amp;quot;1m&amp;quot;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;The &lt;code&gt;explain_plans&lt;/code&gt; collector reads the execution plan &lt;a href=&#34;https://learn.microsoft.com/sql/relational-databases/performance/monitoring-performance-by-using-the-query-store&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Query Store&lt;/a&gt; already captured for each query tracked by the &lt;code&gt;query_metrics&lt;/code&gt; collector.
It doesn&amp;rsquo;t compile or run a fresh plan.
Only queries that &lt;code&gt;query_metrics&lt;/code&gt; is currently tracking are eligible.
When &lt;code&gt;query_metrics&lt;/code&gt; is disabled, &lt;code&gt;explain_plans&lt;/code&gt; produces no output.&lt;/p&gt;
&lt;p&gt;The collector checks for a changed plan every &lt;code&gt;collect_interval&lt;/code&gt;.
It forwards a log entry only when the plan&amp;rsquo;s shape has changed since the last entry.
It also forwards a log entry when 30 minutes have passed since the last entry.
This keeps log volume low and ensures a fresh entry at least every 30 minutes.&lt;/p&gt;
&lt;h3 id=&#34;health_check&#34;&gt;&lt;code&gt;health_check&lt;/code&gt;&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;collect_interval&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;duration&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;How frequently to run health checks.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;&amp;quot;1h&amp;quot;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;The &lt;code&gt;health_check&lt;/code&gt; collector periodically verifies that the login has the required grants (&lt;code&gt;VIEW DEFINITION&lt;/code&gt;, plus &lt;code&gt;VIEW DATABASE STATE&lt;/code&gt; or its SQL Server 2022&#43; equivalent &lt;code&gt;VIEW DATABASE PERFORMANCE STATE&lt;/code&gt;, and on editions other than Azure SQL Database &lt;code&gt;VIEW SERVER STATE&lt;/code&gt; or &lt;code&gt;VIEW SERVER PERFORMANCE STATE&lt;/code&gt;) and that &lt;a href=&#34;https://learn.microsoft.com/sql/relational-databases/performance/monitoring-performance-by-using-the-query-store&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Query Store&lt;/a&gt; is enabled and populated, on every database the login can access on the instance. Each check emits a log entry with &lt;code&gt;op=&amp;quot;health_status&amp;quot;&lt;/code&gt; and a &lt;code&gt;check&lt;/code&gt; field identifying it: &lt;code&gt;AlloyVersion&lt;/code&gt;, &lt;code&gt;RequiredGrantsPresent&lt;/code&gt;, &lt;code&gt;QueryStoreEnabled&lt;/code&gt;, or &lt;code&gt;QueryStoreHasRows&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;RequiredGrantsPresent&lt;/code&gt; and &lt;code&gt;QueryStoreEnabled&lt;/code&gt; pass only when at least one accessible user database exists and the check holds on every database the login can access (plus the server-level grant on non-Azure SQL Database editions); when they fail, the log entry&amp;rsquo;s value describes the missing server grant, non-compliant databases, or &lt;code&gt;no accessible databases&lt;/code&gt;. &lt;code&gt;QueryStoreHasRows&lt;/code&gt; passes as soon as any accessible database has Query Store data, since it&amp;rsquo;s expected for a low-traffic database to have none.&lt;/p&gt;
&lt;h3 id=&#34;query_details&#34;&gt;&lt;code&gt;query_details&lt;/code&gt;&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;collect_interval&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;duration&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;How frequently to collect query text from Query Store.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;&amp;quot;1m&amp;quot;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;The &lt;code&gt;query_details&lt;/code&gt; collector reads &lt;a href=&#34;https://learn.microsoft.com/sql/relational-databases/performance/monitoring-performance-by-using-the-query-store&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Query Store&lt;/a&gt; query text for the database selected in the &lt;code&gt;data_source_name&lt;/code&gt;, not every database on the instance.&lt;/p&gt;
&lt;h3 id=&#34;query_metrics&#34;&gt;&lt;code&gt;query_metrics&lt;/code&gt;&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;collect_interval&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;duration&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;How frequently to collect metrics from Query Store.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;&amp;quot;1m&amp;quot;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;statements_limit&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;int&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Maximum number of queries to track, ranked by recent duration.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;50&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;statements_lookback&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;duration&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Only queries executed within this window are eligible for tracking.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;&amp;quot;1h&amp;quot;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;The &lt;code&gt;query_metrics&lt;/code&gt; collector reads &lt;a href=&#34;https://learn.microsoft.com/sql/relational-databases/performance/monitoring-performance-by-using-the-query-store&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Query Store&lt;/a&gt; for the database selected in the &lt;code&gt;data_source_name&lt;/code&gt;, not every database on the instance.
Configure the &lt;code&gt;data_source_name&lt;/code&gt; to select a user database that has Query Store enabled.
When the connected database is a system database such as &lt;code&gt;master&lt;/code&gt;, or Query Store is disabled or read-only, the collector skips collection and remains healthy.&lt;/p&gt;
&lt;p&gt;The login requires &lt;code&gt;VIEW DATABASE STATE&lt;/code&gt; on the connected database. On SQL Server 2022 and later, &lt;code&gt;VIEW DATABASE PERFORMANCE STATE&lt;/code&gt; is also sufficient.&lt;/p&gt;
&lt;h3 id=&#34;query_samples&#34;&gt;&lt;code&gt;query_samples&lt;/code&gt;&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;collect_interval&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;duration&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;How frequently to collect query samples.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;&amp;quot;10s&amp;quot;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;disable_query_redaction&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;bool&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Collect unredacted SQL query text (might include parameters).&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;false&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;sample_min_duration&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;duration&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Minimum elapsed duration for a completed query sample to be emitted. Set to &lt;code&gt;&amp;quot;0s&amp;quot;&lt;/code&gt; to disable filtering.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;&amp;quot;0s&amp;quot;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;wait_event_min_duration&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;duration&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Minimum duration for a wait event occurrence to be emitted. Set to &lt;code&gt;&amp;quot;0s&amp;quot;&lt;/code&gt; to disable filtering.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;&amp;quot;1ms&amp;quot;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;max_samples_per_query&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;int&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Maximum number of completed query samples emitted per &lt;code&gt;(database, query_hash)&lt;/code&gt; in a single collection cycle. Set to &lt;code&gt;0&lt;/code&gt; for no per-query limit.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;5&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;max_samples_per_collect&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;int&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Maximum total number of completed query samples emitted across all tracked queries in a single collection cycle. Set to &lt;code&gt;0&lt;/code&gt; for no per-collection limit.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;50&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;The &lt;code&gt;query_samples&lt;/code&gt; collector only collects requests whose query hash is tracked by the &lt;code&gt;query_metrics&lt;/code&gt; collector.
The collector checks &lt;a href=&#34;https://learn.microsoft.com/sql/relational-databases/performance/monitoring-performance-by-using-the-query-store&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Query Store&lt;/a&gt; state on the connected database before polling live requests.
When the connected database is a system database such as &lt;code&gt;master&lt;/code&gt;, or Query Store is disabled or read-only, the collector skips collection.&lt;/p&gt;
&lt;p&gt;When requests finish between polls, the collector filters out any request whose final elapsed time is shorter than &lt;code&gt;sample_min_duration&lt;/code&gt;.
Remaining completed requests are ranked by elapsed duration and then CPU time, and capped by &lt;code&gt;max_samples_per_query&lt;/code&gt; and &lt;code&gt;max_samples_per_collect&lt;/code&gt;.
When a request is dropped by &lt;code&gt;sample_min_duration&lt;/code&gt;, &lt;code&gt;max_samples_per_query&lt;/code&gt;, or &lt;code&gt;max_samples_per_collect&lt;/code&gt;, neither the query sample nor its wait event occurrences are emitted.
For emitted samples, only wait event occurrences with a final duration of at least &lt;code&gt;wait_event_min_duration&lt;/code&gt; are logged.&lt;/p&gt;
&lt;p&gt;The collector polls live requests and can miss queries shorter than &lt;code&gt;collect_interval&lt;/code&gt;, wait events that start and finish between collections, and a query&amp;rsquo;s first execution before Query Store admits its hash.
For completed requests, the emitted resource counters contain the values from the final observation and can omit work performed after that observation.&lt;/p&gt;
&lt;p&gt;The login requires &lt;code&gt;VIEW DATABASE STATE&lt;/code&gt; (or &lt;code&gt;VIEW DATABASE PERFORMANCE STATE&lt;/code&gt; on SQL Server 2022 and later) on the connected database, plus &lt;code&gt;VIEW SERVER STATE&lt;/code&gt; on SQL Server 2019 (or &lt;code&gt;VIEW SERVER PERFORMANCE STATE&lt;/code&gt; on SQL Server 2022 and later and Azure SQL Managed Instance). On Azure SQL Database, &lt;code&gt;VIEW DATABASE STATE&lt;/code&gt; on the connected database is sufficient.&lt;/p&gt;
&lt;h3 id=&#34;schema_details&#34;&gt;&lt;code&gt;schema_details&lt;/code&gt;&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;collect_interval&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;duration&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;How frequently to collect information from database.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;&amp;quot;1m&amp;quot;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;The collector scans every database that the login can access on the instance and collects schema details from each. Only databases where the login has &lt;code&gt;CONNECT&lt;/code&gt; and &lt;code&gt;VIEW DEFINITION&lt;/code&gt; permissions are collected.&lt;/p&gt;
&lt;h3 id=&#34;server_configuration&#34;&gt;&lt;code&gt;server_configuration&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;server_configuration&lt;/code&gt; block configures how often &lt;code&gt;database_observability.sql_server&lt;/code&gt; collects connection, resource-limit, and memory configuration metrics.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;collect_interval&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;duration&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;How frequently to collect configuration metrics.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;&amp;quot;10m&amp;quot;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;The collector queries configuration immediately after it starts and then every &lt;code&gt;collect_interval&lt;/code&gt;.
Prometheus scrapes read the latest successful result from memory and don&amp;rsquo;t query SQL Server.
If a query fails, the collector retains the last successful result and tries again at the next interval.
The top-level &lt;code&gt;query_timeout&lt;/code&gt; applies to each configuration query.&lt;/p&gt;
&lt;p&gt;For SQL Server, Amazon RDS for SQL Server, Google Cloud SQL for SQL Server, and Azure SQL Managed Instance, the collector reads the settings available in &lt;code&gt;sys.configurations&lt;/code&gt;.
Managed database services can omit settings or manage their values.
The collector skips unavailable settings without failing the collection.&lt;/p&gt;
&lt;p&gt;The collector exports the following metrics:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Metric&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Source setting&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_config_backup_compression_default&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;backup compression default&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Whether backup compression is enabled by default.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_config_cost_threshold_for_parallelism&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;cost threshold for parallelism&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Threshold at which SQL Server creates and runs parallel plans.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_config_database_max_degree_of_parallelism&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.database_scoped_configurations.MAXDOP&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Maximum degree of parallelism for the current Azure SQL Database.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_config_index_create_memory_bytes&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;index create memory (KB)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Minimum memory for index creation.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_config_max_degree_of_parallelism&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;max degree of parallelism&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Maximum processors used for a parallel plan.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_config_max_server_memory_bytes&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;max server memory (MB)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Maximum memory available to the SQL Server memory manager.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_config_max_worker_threads&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;max worker threads&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Maximum worker threads.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_config_min_memory_per_query_bytes&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;min memory per query (KB)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Minimum memory for query execution.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_config_min_server_memory_bytes&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;min server memory (MB)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Minimum memory retained by the SQL Server memory manager.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_config_network_packet_size_bytes&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;network packet size (B)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Default network packet size.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_config_optimize_for_ad_hoc_workloads&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;optimize for ad hoc workloads&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Whether plan cache efficiency for single-use ad hoc batches is enabled.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_config_remote_admin_connections&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;remote admin connections&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Whether remote dedicated administrator connections are enabled.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_config_remote_login_timeout_seconds&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;remote login timeout (s)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Timeout for outgoing remote login attempts.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_config_user_connections&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;user connections&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Configured user connection limit.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;Except for &lt;code&gt;database_observability_sql_server_config_database_max_degree_of_parallelism&lt;/code&gt;, each metric has a &lt;code&gt;state&lt;/code&gt; label.
The &lt;code&gt;configured&lt;/code&gt; state reports the requested value from &lt;code&gt;sys.configurations.value&lt;/code&gt;.
The &lt;code&gt;in_use&lt;/code&gt; state reports the running value from &lt;code&gt;sys.configurations.value_in_use&lt;/code&gt;.
The values can differ when an administrator hasn&amp;rsquo;t run &lt;code&gt;RECONFIGURE&lt;/code&gt; or when a setting change requires a restart.
SQL Server can also represent automatic defaults differently for &lt;code&gt;max server memory (MB)&lt;/code&gt; and &lt;code&gt;min server memory (MB)&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;server_metrics-collector&#34;&gt;&lt;code&gt;server_metrics&lt;/code&gt; collector&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;server_metrics&lt;/code&gt; collector queries SQL Server when Prometheus scrapes the component.
It has no configuration block; enable or disable it with the &lt;code&gt;enable_collectors&lt;/code&gt; and &lt;code&gt;disable_collectors&lt;/code&gt; arguments.
It supports SQL Server 2019 and later, including SQL Server on Amazon RDS, Google Cloud SQL, Azure SQL Database, and Azure SQL Managed Instance.&lt;/p&gt;
&lt;p&gt;The collector exports the following metrics:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Metric&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Source&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_batch_requests_total&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;counter&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_os_performance_counters&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Total Transact-SQL command batches received by SQL Server.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_buffer_cache_hit_ratio&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_os_performance_counters&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Ratio of pages found in the buffer pool without reading from disk.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_checkpoint_pages_total&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;counter&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_os_performance_counters&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Total pages flushed to disk by checkpoint operations.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_connection_resets_total&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;counter&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_os_performance_counters&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Total logins started from the connection pool since SQL Server last started.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_database_cpu_utilization_ratio&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_db_resource_stats&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Average Azure SQL Database CPU utilization relative to the service-tier limit.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_database_data_io_utilization_ratio&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_db_resource_stats&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Average Azure SQL Database data I/O utilization relative to the service-tier limit.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_database_dtu_limit&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_user_db_resource_governance&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;DTU limit of an Azure SQL Database that uses the DTU purchasing model.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_database_log_write_utilization_ratio&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_db_resource_stats&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Average Azure SQL Database log-write utilization relative to the service-tier limit.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_database_memory_grant_limit_ratio&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_user_db_resource_governance&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Maximum memory grant for a single Azure SQL Database request as a ratio of user workload group memory.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_database_memory_utilization_ratio&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_db_resource_stats&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Average Azure SQL Database memory utilization relative to the service-tier limit.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_database_resource_stats_timestamp_seconds&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_db_resource_stats&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Unix timestamp of the latest Azure SQL Database resource statistics interval.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_database_resource_governor_max_degree_of_parallelism&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_user_db_resource_governance&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Maximum degree of parallelism enforced by the Azure SQL Database user workload group.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_database_session_utilization_ratio&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_db_resource_stats&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Maximum Azure SQL Database session utilization during the latest reporting interval.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_database_storage_allocated_bytes&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.database_files&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Space allocated to the connected database files, labeled by &lt;code&gt;file_type&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_database_storage_limit_bytes&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;DATABASEPROPERTYEX&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Maximum configured storage capacity of the connected database.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_database_storage_used_bytes&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.database_files&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Space used within the connected database files, labeled by &lt;code&gt;file_type&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_database_vcore_limit&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_user_db_resource_governance&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;vCore limit of an Azure SQL Database that uses the vCore purchasing model.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_database_worker_limit&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_user_db_resource_governance&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Worker thread limit of the Azure SQL Database user workload group.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_database_worker_utilization_ratio&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_db_resource_stats&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Maximum Azure SQL Database worker utilization during the latest reporting interval.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_deadlocks_total&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;counter&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_os_performance_counters&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Total lock requests that resulted in a deadlock.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_free_list_stalls_total&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;counter&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_os_performance_counters&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Total requests that had to wait for a free page in the buffer pool.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_full_scans_total&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;counter&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_os_performance_counters&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Total unrestricted base-table or full-index scans performed by SQL Server.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_host_commit_available_bytes&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_os_sys_memory&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Available operating system commit visible to the SQL Server host.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_host_commit_limit_bytes&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_os_sys_memory&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Operating system commit limit visible to the SQL Server host.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_host_high_memory_signal&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_os_sys_memory&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Whether the host high-memory resource notification is set.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_host_logical_cpu_count&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_os_sys_info&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Number of logical CPUs visible to the SQL Server host.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_host_low_memory_signal&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_os_sys_memory&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Whether the host low-memory resource notification is set.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_host_physical_memory_available_bytes&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_os_sys_memory&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Available physical memory visible to the SQL Server host.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_host_physical_memory_total_bytes&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_os_sys_memory&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Total physical memory visible to the SQL Server host.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_info&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;SERVERPROPERTY&lt;/code&gt;, &lt;code&gt;sys.databases&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;SQL Server engine edition and product version metadata, labeled by &lt;code&gt;engine_edition&lt;/code&gt;, &lt;code&gt;edition_name&lt;/code&gt;, &lt;code&gt;product_version&lt;/code&gt;, &lt;code&gt;product_level&lt;/code&gt;, &lt;code&gt;product_build&lt;/code&gt;, and &lt;code&gt;compatibility_level&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_instance_cpu_utilization_ratio&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_db_resource_stats&lt;/code&gt;, &lt;code&gt;master.sys.server_resource_stats&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Average CPU utilization relative to the Azure SQL service-tier limit.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_instance_io_operations_per_second&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;master.sys.server_resource_stats&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Average physical I/O operations per second during the latest Azure SQL Managed Instance reporting interval.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_instance_io_read_bytes_per_second&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;master.sys.server_resource_stats&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Average physical bytes read per second during the latest Azure SQL Managed Instance reporting interval.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_instance_io_written_bytes_per_second&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;master.sys.server_resource_stats&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Average physical bytes written per second during the latest Azure SQL Managed Instance reporting interval.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_instance_memory_utilization_ratio&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_db_resource_stats&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Average memory utilization of the database engine instance hosting an Azure SQL Database.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_instance_resource_stats_timestamp_seconds&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;master.sys.server_resource_stats&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Unix timestamp of the latest Azure SQL Managed Instance resource statistics interval.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_instance_storage_allocated_bytes&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_io_virtual_file_stats&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Total space allocated to database files on the SQL Server instance.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_instance_storage_available_bytes&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_os_volume_stats&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Available storage capacity on operating system volumes hosting SQL Server files.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_instance_storage_limit_bytes&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;master.sys.server_resource_stats&lt;/code&gt;, &lt;code&gt;sys.dm_os_volume_stats&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Reserved storage capacity of an Azure SQL Managed Instance or total operating system volume capacity.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_instance_storage_used_bytes&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;master.sys.server_resource_stats&lt;/code&gt;, &lt;code&gt;sys.dm_os_volume_stats&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Storage used by an Azure SQL Managed Instance or across operating system volumes hosting SQL Server files.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_instance_vcore_limit&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;master.sys.server_resource_stats&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;vCore limit of an Azure SQL Managed Instance.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_io_read_bytes_total&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;counter&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_io_virtual_file_stats&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Total bytes read from SQL Server database and log files.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_io_read_stall_seconds_total&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;counter&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_io_virtual_file_stats&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Total time spent waiting for read operations on SQL Server files.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_io_reads_total&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;counter&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_io_virtual_file_stats&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Total physical read operations issued on SQL Server database and log files.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_io_write_stall_seconds_total&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;counter&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_io_virtual_file_stats&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Total time spent waiting for write operations on SQL Server files.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_io_writes_total&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;counter&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_io_virtual_file_stats&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Total physical write operations issued on SQL Server database and log files.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_io_written_bytes_total&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;counter&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_io_virtual_file_stats&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Total bytes written to SQL Server database and log files.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_lazy_writes_total&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;counter&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_os_performance_counters&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Total pages written to disk by the lazy writer to free buffer pool pages.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_lock_wait_seconds_total&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;counter&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_os_performance_counters&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Total time spent waiting for locks.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_lock_waits_total&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;counter&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_os_performance_counters&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Total lock requests that required the caller to wait.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_logins_total&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;counter&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_os_performance_counters&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Total logins started outside the connection pool since SQL Server last started.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_logouts_total&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;counter&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_os_performance_counters&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Total logout operations since SQL Server last started.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_memory_grants_pending&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_os_performance_counters&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Current number of processes waiting for a workspace memory grant.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_memory_manager_committed_bytes&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_os_sys_info&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Memory committed by the SQL Server memory manager.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_memory_manager_target_bytes&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_os_sys_info&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Memory the SQL Server memory manager can consume.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_page_life_expectancy_seconds&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_os_performance_counters&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Duration in seconds that a data page stays in the buffer pool without references.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_page_splits_total&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;counter&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_os_performance_counters&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Total index page splits performed by SQL Server.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_process_available_commit_memory_bytes&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_os_process_memory&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Memory available to be committed by the SQL Server process.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_process_committed_memory_resident_ratio&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_os_process_memory&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Ratio of committed process memory resident in the working set.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_process_cpu_limit&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_os_job_object&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Logical CPU capacity available to Azure SQL Managed Instance.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_process_cpu_seconds_total&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;counter&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_os_sys_info&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;CPU time consumed by SQL Server threads, labeled by &lt;code&gt;mode&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_process_memory_limit_bytes&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_os_job_object&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Maximum committed memory available to Azure SQL Managed Instance.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_process_page_faults_total&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;counter&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_os_process_memory&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Page faults incurred by the SQL Server process.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_process_physical_memory_low&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_os_process_memory&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Whether the process is responding to a low physical-memory notification.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_process_resident_memory_bytes&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_os_process_memory&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;SQL Server process working set.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_process_virtual_memory_bytes&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_os_process_memory&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Virtual address space committed by the SQL Server process.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_process_virtual_memory_low&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_os_process_memory&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Whether the process has detected a low virtual-memory condition.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_processes_blocked&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_os_performance_counters&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Current number of blocked processes.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_sos_memory_target_bytes&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_os_job_object&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Memory available to the Azure SQL Managed Instance SQL operating system.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_sql_compilations_total&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;counter&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_os_performance_counters&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Total SQL compilations performed by SQL Server.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_sql_recompilations_total&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;counter&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_os_performance_counters&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Total SQL statement recompilations performed by SQL Server.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_tempdb_space_unallocated_bytes&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;tempdb.sys.dm_db_file_space_usage&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Unallocated space in &lt;code&gt;tempdb&lt;/code&gt; data files.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_tempdb_space_used_bytes&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;tempdb.sys.dm_db_file_space_usage&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Space used in &lt;code&gt;tempdb&lt;/code&gt; data files, labeled by &lt;code&gt;category&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_transactions_total&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;counter&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_os_performance_counters&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Total transactions started across all databases.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_uptime_seconds&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_os_sys_info&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Time since the SQL Server process started.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_user_session_limit&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.configurations&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Maximum user sessions allowed by the active configuration and service limit.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;database_observability_sql_server_user_sessions&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sys.dm_exec_sessions&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Authenticated user sessions, labeled by &lt;code&gt;status&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;The &lt;code&gt;process_cpu_seconds_total&lt;/code&gt; counter has the &lt;code&gt;mode&lt;/code&gt; label values &lt;code&gt;user&lt;/code&gt; and &lt;code&gt;kernel&lt;/code&gt;.
The &lt;code&gt;user_sessions&lt;/code&gt; gauge has the &lt;code&gt;status&lt;/code&gt; label values &lt;code&gt;running&lt;/code&gt;, &lt;code&gt;sleeping&lt;/code&gt;, &lt;code&gt;dormant&lt;/code&gt;, and &lt;code&gt;preconnect&lt;/code&gt;.
Process-lifetime counters reset when SQL Server restarts or fails over.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;user_session_limit&lt;/code&gt; metric resolves the default &lt;code&gt;user connections&lt;/code&gt; setting of &lt;code&gt;0&lt;/code&gt; to &lt;code&gt;32767&lt;/code&gt;.
For Azure SQL Managed Instance, it reports the lower of the configured limit and the service limit of &lt;code&gt;30000&lt;/code&gt;.
Other resources, such as workers and memory, can become saturated before the session limit.
For Azure SQL Database, &lt;code&gt;user_sessions&lt;/code&gt; is a current count from the connected database.
The separate &lt;code&gt;database_session_utilization_ratio&lt;/code&gt; metric is the maximum session utilization during the latest 15-second resource statistics interval.
CPU, memory, data I/O, and log-write ratios are averages over that interval.
Worker and session ratios are maxima.
For databases in an elastic pool, these ratios are relative to the per-database limits configured by the pool.&lt;/p&gt;
&lt;p&gt;The Azure SQL Database resource metrics require &lt;code&gt;VIEW DATABASE STATE&lt;/code&gt;.
For Basic, S0, and S1 service objectives and databases in elastic pools, the monitoring login must be a server administrator, a Microsoft Entra administrator, or a member of the &lt;code&gt;##MS_ServerStateReader##&lt;/code&gt; server role.&lt;/p&gt;
&lt;p&gt;The host CPU and memory metrics are available for self-hosted SQL Server, Amazon RDS, and Google Cloud SQL.
They describe the operating system visible to SQL Server and can include managed-service overhead.
Use provider metrics as the authoritative source for cloud service entitlement.&lt;/p&gt;
&lt;p&gt;The host metrics aren&amp;rsquo;t emitted for Azure SQL Managed Instance because its host values don&amp;rsquo;t represent the resources allocated to the managed instance.
The collector instead uses &lt;code&gt;sys.dm_os_job_object&lt;/code&gt; to export the governed CPU and memory limits.
It uses &lt;code&gt;master.sys.server_resource_stats&lt;/code&gt; for direct CPU, vCore, storage, and I/O metrics.
The I/O metrics are average rates calculated from the totals and actual duration of the latest source interval.
This view is refreshed independently of the Prometheus scrape interval.&lt;/p&gt;
&lt;p&gt;The login requires &lt;code&gt;VIEW SERVER STATE&lt;/code&gt; on SQL Server 2019.
On SQL Server 2022 and later, &lt;code&gt;VIEW SERVER PERFORMANCE STATE&lt;/code&gt; is also sufficient.
Azure SQL Managed Instance requires &lt;code&gt;VIEW SERVER PERFORMANCE STATE&lt;/code&gt; for process, job-object, and complete session metrics.
Without that permission, &lt;code&gt;user_sessions&lt;/code&gt; can include only the monitoring login&amp;rsquo;s own session.&lt;/p&gt;
&lt;h2 id=&#34;example&#34;&gt;Example&lt;/h2&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Alloy&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-alloy&#34;&gt;database_observability.sql_server &amp;#34;orders_db&amp;#34; {
  data_source_name = &amp;#34;sqlserver://user:pass@server:1433&amp;#34;
  forward_to       = [loki.write.logs_service.receiver]
}

loki.write &amp;#34;logs_service&amp;#34; {
  endpoint {
    url = sys.env(&amp;#34;&amp;lt;GRAFANA_CLOUD_HOSTED_LOGS_URL&amp;gt;&amp;#34;)
    basic_auth {
      username = sys.env(&amp;#34;&amp;lt;GRAFANA_CLOUD_HOSTED_LOGS_ID&amp;gt;&amp;#34;)
      password = sys.env(&amp;#34;&amp;lt;GRAFANA_CLOUD_RW_API_KEY&amp;gt;&amp;#34;)
    }
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Replace the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;GRAFANA_CLOUD_HOSTED_LOGS_URL&amp;gt;&lt;/code&gt;&lt;/em&gt;: The URL for your Grafana Cloud hosted logs.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;GRAFANA_CLOUD_HOSTED_LOGS_ID&amp;gt;&lt;/code&gt;&lt;/em&gt;: The user ID for your Grafana Cloud hosted logs.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;GRAFANA_CLOUD_RW_API_KEY&amp;gt;&lt;/code&gt;&lt;/em&gt;: Your Grafana Cloud API key.&lt;/li&gt;
&lt;/ul&gt;
&lt;!-- START GENERATED COMPATIBLE COMPONENTS --&gt;
&lt;h2 id=&#34;compatible-components&#34;&gt;Compatible components&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;database_observability.sql_server&lt;/code&gt; can accept arguments from the following components:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Components that export &lt;a href=&#34;../../../compatibility/#targets-exporters&#34;&gt;Targets&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Components that export &lt;a href=&#34;../../../compatibility/#loki-logsreceiver-exporters&#34;&gt;Loki &lt;code&gt;LogsReceiver&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;code&gt;database_observability.sql_server&lt;/code&gt; has exports that can be consumed by the following components:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Components that consume &lt;a href=&#34;../../../compatibility/#targets-consumers&#34;&gt;Targets&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;Connecting some components may not be sensible or components may require further configuration to make the connection work correctly.
Refer to the linked documentation for more details.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;!-- END GENERATED COMPATIBLE COMPONENTS --&gt;
]]></content><description>&lt;h1 id="database_observabilitysql_server">&lt;code>database_observability.sql_server&lt;/code>&lt;/h1>
&lt;div data-shared="stability/experimental.md">
&lt;blockquote>
&lt;p>&lt;strong>EXPERIMENTAL&lt;/strong>: This is an &lt;a href="/docs/release-life-cycle/">experimental&lt;/a> component.
Experimental components are subject to frequent breaking changes, and may be removed with no equivalent replacement.
To enable and use an experimental component, you must set the &lt;code>stability.level&lt;/code>
&lt;a href="/docs/alloy/v1.22/reference/cli/run/">flag&lt;/a> to &lt;code>experimental&lt;/code>.&lt;/p></description></item></channel></rss>