Repository: prometheus-community/windows_exporter

Issue #602: collected metric process_start_time_seconds gauge:<value:1.600194451e+09 >  should be a Counter
Created: 2020-09-16T17:14:00Z
Instead of directly downloading the msi from the releases, we have forked the repo and built the msi to make our bits signed.
used that msi to run in our kubernetes containers but we are getting the below error.
Any idea of how to resolve this issue?
PS C:\app> wget http://localhost:50505/metrics
wget : An error has occurred while serving metrics:
collected metric process_start_time_seconds gauge:<value:1.600194451e+09 >  should be a Counter

Duplicate issue #586: Change metric type process_start_time_seconds
Created: 2020-08-12T18:11:29Z
Hi. I'm trying to push metrics from windows_exporter to pushgateway (both latest versions), but I get the error:
Invoke-webrequest: Submitted metrics are invalid or incompatible with existing metrics: Collected metric "process_start_time_seconds" {label: label: label: label: counter:} is
not a GAUGE

The process_start_time_seconds metric given by windows_exporter has a counter type, and Pushgateway can only accept a gauge type. Could you change the metric type to gauge so that I can push metrics to Pushgateway?

Closing comment (2020-11-02T11:22:57Z): I ran into the same problem when I pushed metrics from windows exporter (v0.14) and jmx exporter (v0.13) from the same host to a pushgateway. The used windows_exporter was the latest download from this site: branch="master",goversion="go1.13.3",revision="922c08b85b60da8a444a57a84126448d7c993307",version="0.14.0" .
After some search, I suspect that windows_exporter has hardcoded the metric type of process_start_time_seconds to COUNTER (which conflicts with other exporters in premetheus core):



  
    
      windows_exporter/exporter.go
    
    
        Lines 79 to 85
      in
      f623c0e
    
  
  
    

        
          
           startTime     = float64(time.Now().Unix()) 
        

        
          
           startTimeDesc = prometheus.NewDesc( 
        

        
          
           	"process_start_time_seconds", 
        

        
          
           	"Start time of the process since unix epoch in seconds.", 
        

        
          
           	nil, 
        

        
          
           	nil, 
        

        
          
           ) 
        
    
  





  
    
      windows_exporter/exporter.go
    
    
        Lines 106 to 110
      in
      f623c0e
    
  
  
    

        
          
           ch <- prometheus.MustNewConstMetric( 
        

        
          
           	startTimeDesc, 
        

        
          
           	prometheus.CounterValue, 
        

        
          
           	startTime, 
        

        
          
           ) 
        
    
  




I worked around the problem by changing the metric type to gauge in my scraper script before I send the metric to a pushgateway.
Unfortunately, I have not managed to build windows_exporter and submit a PR (I just start learning go). Could someone change the metric type to GAUGE ?
This issue is likely related to #602 and the unanswered question in https://stackoverflow.com/questions/58181122/expected-gauge-in-metric-process-start-time-seconds-label-prometheus .