Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[redis] values transformed into tags in prometheus output #5036

Closed
axinojolais opened this issue Nov 26, 2018 · 3 comments
Closed

[redis] values transformed into tags in prometheus output #5036

axinojolais opened this issue Nov 26, 2018 · 3 comments
Labels
discussion Topics for discussion

Comments

@axinojolais
Copy link
Contributor

Hi,

Using telegraf-1.8.3, redis version 4.0.11.

Some values reported by the redis plugin are considered as tags by the prometheus output, presumably because they're strings and not numerals. As you can see in the test below, the tags are host, port, replication_role and server :

$ telegraf --config /etc/telegraf/telegraf.d/redis.conf --input-filter redis --test
> redis,host=<foo>,port=6379,replication_role=master,server=1.2.3.4 active_defrag_hits=0i,active_defrag_key_hits=0i,active_defrag_key_misses=0i,active_defrag_misses=0i,active_defrag_running=0i,aof_current_rewrite_time_sec=-1i,aof_enabled=0i,aof_last_bgrewrite_status="ok",aof_last_cow_size=0i,aof_last_rewrite_time_sec=-1i,aof_last_write_status="ok",aof_rewrite_in_progress=0i,aof_rewrite_scheduled=0i,blocked_clients=0i,client_biggest_input_buf=0i,client_longest_output_list=0i,clients=2i,cluster_enabled=0i,connected_slaves=0i,evicted_keys=0i,expired_keys=0i,expired_stale_perc=0,expired_time_cap_reached_count=0i,instantaneous_input_kbps=0,instantaneous_ops_per_sec=0i,instantaneous_output_kbps=0,keyspace_hitrate=0,keyspace_hits=0i,keyspace_misses=0i,latest_fork_usec=0i,lazyfree_pending_objects=0i,loading=0i,lru_clock=16504280i,master_repl_offset=0i,maxmemory=0i,maxmemory_policy="noeviction",mem_fragmentation_ratio=6.94,migrate_cached_sockets=0i,pubsub_channels=0i,pubsub_patterns=0i,rdb_bgsave_in_progress=0i,rdb_changes_since_last_save=0i,rdb_current_bgsave_time_sec=-1i,rdb_last_bgsave_status="ok",rdb_last_bgsave_time_sec=-1i,rdb_last_cow_size=0i,rdb_last_save_time=1543225250i,rdb_last_save_time_elapsed=5686i,redis_version="4.0.11",rejected_connections=0i,repl_backlog_active=0i,repl_backlog_first_byte_offset=0i,repl_backlog_histlen=0i,repl_backlog_size=1048576i,second_repl_offset=-1i,slave_expires_tracked_keys=0i,sync_full=0i,sync_partial_err=0i,sync_partial_ok=0i,total_commands_processed=346i,total_connections_received=73i,total_net_input_bytes=4877i,total_net_output_bytes=974798i,total_system_memory=4136558592i,uptime=5686i,used_cpu_sys=7.17,used_cpu_sys_children=0,used_cpu_user=2.79,used_cpu_user_children=0,used_memory=590976i,used_memory_dataset=16384i,used_memory_dataset_perc="19.77%",used_memory_lua=37888i,used_memory_overhead=574592i,used_memory_peak=590976i,used_memory_peak_perc="100.00%",used_memory_rss=4104192i,used_memory_startup=508104i 1543230936000000000

However, if I curl telegraf, a few of these are switched to tags :

$ curl -s localhost:9103/metrics|egrep ^redis_used_cpu_user_children
redis_used_cpu_user_children{aof_last_bgrewrite_status="ok",aof_last_write_status="ok",host="<foo>",maxmemory_policy="noeviction",port="6379",rdb_last_bgsave_status="ok",redis_version="4.0.11",replication_role="master",server="1.2.3.4",used_memory_dataset_perc="19.96%",used_memory_peak_perc="96.47%"} 0

I don't mind redis_version, but the rest doesn't belong as tags. Transforming the percentages into numbers should be easy (just drop the %), but for the rest I don't have a good solution to propose.

Thanks

@glinton
Copy link
Contributor

glinton commented Nov 27, 2018

Isn't that just how prometheus works, storing only key/value pairs? If you want to preserve the fields and tags influxdb would be a better choice as a backend.

@danielnelson
Copy link
Contributor

I think you probably have string_as_label set to true, if you disable it should be fixed. Let us know if this helps.

@glinton glinton added the discussion Topics for discussion label Nov 28, 2018
@axinojolais
Copy link
Contributor Author

Indeed, disabling string_as_label works. Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Topics for discussion
Projects
None yet
Development

No branches or pull requests

3 participants