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

Empty datapoints #9

Open
ymettier opened this issue May 19, 2020 · 0 comments
Open

Empty datapoints #9

ymettier opened this issue May 19, 2020 · 0 comments

Comments

@ymettier
Copy link

Hello,

I'm using cloudeye_exporter on FlexibleEngine (huawei cloud distributed by Orange in France).

When I try to retrieve metrics from SYS.OBS namespace, I have empty datapoints. After investigations, I noticed that the datapoints are not available in the interval [now - 5 minutes, now].

Below is a little quick'n dirty patch that I produced to prove my investigation :

diff -bruaN cloudeye-exporter.orig/collector/collector.go cloudeye-exporter/collector/collector.go
--- cloudeye-exporter.orig/collector/collector.go	2020-05-18 19:23:04.253169061 +0200
+++ cloudeye-exporter/collector/collector.go	2020-05-18 19:24:01.780775057 +0200
@@ -160,10 +160,11 @@
 
 func (exporter *BaseHuaweiCloudExporter) Collect(ch chan<- prometheus.Metric) {
 	periodm, _ := time.ParseDuration("-5m")
+	offsetm, _ := time.ParseDuration("-5m")
 
 	now := time.Now()
-	from := strconv.FormatInt(int64(now.Add(periodm).UnixNano()/1e6), 10)
-	to := strconv.FormatInt(int64(now.UnixNano()/1e6), 10)
+	from := strconv.FormatInt(int64(now.Add(offsetm).Add(periodm).UnixNano()/1e6), 10)
+	to := strconv.FormatInt(int64(now.Add(offsetm).UnixNano()/1e6), 10)
 	exporter.From = from
 	exporter.To = to

Without this patch : datapoints are empty.

With this patch, I get metrics.

I will soon provide a Pull Request with a better fix.

ymettier pushed a commit to ymettier/cloudeye-exporter that referenced this issue May 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant