public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager] status: influxdb: always quote tags
@ 2024-11-27 11:18 Dominik Csapak
  2024-11-27 19:22 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Dominik Csapak @ 2024-11-27 11:18 UTC (permalink / raw)
  To: pve-devel

Since tags are mostly free-form, a single tag with a numeric value will
get sent to influxdb as a number by default. Change that to always quote
the tags as a string, like we do for the 'name' field. (InfluxDB can
only have one type per field, so either a string or a number type).

This won't fix influxdb databases after there are already numeric values
in there, but I guess most tags won't be purely numeric, so this won't
be an issue for most users, and fixes the reverse case where purely
numeric tags won't show up in influxdb.

reported in the community forum:
https://forum.proxmox.com/threads/138004/#post-724127

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 PVE/Status/InfluxDB.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/PVE/Status/InfluxDB.pm b/PVE/Status/InfluxDB.pm
index 95c1d559..13a96711 100644
--- a/PVE/Status/InfluxDB.pm
+++ b/PVE/Status/InfluxDB.pm
@@ -276,8 +276,8 @@ sub test_connection {
 sub build_influxdb_payload {
     my ($class, $txn, $data, $ctime, $tags, $excluded, $measurement, $instance) = @_;
 
-    # 'abc' and '123' are both valid hostnames, that confuses influx's type detection
-    my $to_quote = { name => 1 };
+    # 'abc' and '123' are both valid hostnames/tags, that confuses influx's type detection
+    my $to_quote = { name => 1, tags => 1, };
 
     my @values = ();
 
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pve-devel] applied: [PATCH manager] status: influxdb: always quote tags
  2024-11-27 11:18 [pve-devel] [PATCH manager] status: influxdb: always quote tags Dominik Csapak
@ 2024-11-27 19:22 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2024-11-27 19:22 UTC (permalink / raw)
  To: Proxmox VE development discussion, Dominik Csapak

Am 27.11.24 um 12:18 schrieb Dominik Csapak:
> Since tags are mostly free-form, a single tag with a numeric value will
> get sent to influxdb as a number by default. Change that to always quote
> the tags as a string, like we do for the 'name' field. (InfluxDB can
> only have one type per field, so either a string or a number type).
> 
> This won't fix influxdb databases after there are already numeric values
> in there, but I guess most tags won't be purely numeric, so this won't
> be an issue for most users, and fixes the reverse case where purely
> numeric tags won't show up in influxdb.
> 
> reported in the community forum:
> https://forum.proxmox.com/threads/138004/#post-724127
> 
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
>  PVE/Status/InfluxDB.pm | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
>

applied, thanks!


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-11-27 19:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-27 11:18 [pve-devel] [PATCH manager] status: influxdb: always quote tags Dominik Csapak
2024-11-27 19:22 ` [pve-devel] applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal