[ 
https://issues.apache.org/jira/browse/KARAF-7841?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17900386#comment-17900386
 ] 

ASF GitHub Bot commented on KARAF-7841:
---------------------------------------

fpapon commented on code in PR #337:
URL: https://github.com/apache/karaf-decanter/pull/337#discussion_r1853962036


##########
collector/prometheus/src/main/java/org/apache/karaf/decanter/collector/prometheus/PrometheusCollector.java:
##########
@@ -71,28 +73,39 @@ public void activate(Dictionary<String, Object> properties) 
throws Exception {
     public void run() {
         try {
             URLConnection connection = prometheusURL.openConnection();
-            Map<String, Object> data = new HashMap<>();
-            data.put("type", "prometheus");
+            String topic = (properties.get(EventConstants.EVENT_TOPIC) != 
null) ? (String) properties.get(EventConstants.EVENT_TOPIC) : 
"decanter/collect/prometheus";
+            String type = (properties.get("type") != null) ? (String) 
properties.get("type") : "prometheus";

Review Comment:
   Good point, we should hardcode the type in all collectors/appenders and just 
ignore the key if present in the properties file.
   Thoughts?





> Use Prometheus labels and create 1 event per metric in the 
> Prometheus-Collector
> -------------------------------------------------------------------------------
>
>                 Key: KARAF-7841
>                 URL: https://issues.apache.org/jira/browse/KARAF-7841
>             Project: Karaf
>          Issue Type: Improvement
>          Components: decanter
>    Affects Versions: decanter-2.10.0
>            Reporter: Francois Papon
>            Assignee: Francois Papon
>            Priority: Major
>             Fix For: decanter-2.11.0
>
>
> We should be able to parse labels in Prometheus metric like:
> {code:java}
> # HELP request_time_total
> # TYPE request_time_total counter
> request_time_total_seconds{api="my-api",endpoint="/send",method="POST"} 1.0
> # HELP memoryPool_usage_bytes Current usage of the memory pool
> # TYPE memoryPool_usage_bytes gauge
> memoryPool_usage_bytes{name="Compressed Class Space"} 2.2561752E7
> memoryPool_usage_bytes{name="G1 Eden Space"} 1.2582912E7{code}
> The purpose is to store each labels as an event data property.
> We also should create 1 event per metric.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to