iamseth / oracledb_exporter

Prometheus Oracle database exporter.
MIT License
472 stars 242 forks source link

Unable to use custom metrics configuration file #436

Closed LuvlinLiu closed 2 months ago

LuvlinLiu commented 2 months ago

I'm submitting a ...

Whether use a custom metrics configuration file or the default one, an error will be reported.

appuser@pro01-oc-odb-exporter-7c46dd64b-g7rpx:/$ ./oracledb_exporter --custom.metrics="pro01-oc-odb-metrics.toml" ts=2024-04-19T03:01:47.681Z caller=collector.go:352 level=info pro01-oc-odb-metrics.toml="has been changed. Reloading metrics..." panic: assignment to entry in nil map

goroutine 11 [running]: github.com/iamseth/oracledb_exporter/collector.(Exporter).checkIfMetricsChanged(0xc0001de000) /go/src/oracledb_exporter/collector/collector.go:353 +0x3e5 github.com/iamseth/oracledb_exporter/collector.(Exporter).scrape(0xc0001de000, 0xc00007e2a0) /go/src/oracledb_exporter/collector/collector.go:268 +0x585 github.com/iamseth/oracledb_exporter/collector.(Exporter).Collect(0xc0001de000, 0x0?) /go/src/oracledb_exporter/collector/collector.go:180 +0xf4 github.com/iamseth/oracledb_exporter/collector.(Exporter).Describe(0x0?, 0xc0000729c0) /go/src/oracledb_exporter/collector/collector.go:158 +0xc7 github.com/prometheus/client_golang/prometheus.(Registry).Register.func1() /go/pkg/mod/github.com/prometheus/client_golang@v1.14.0/prometheus/registry.go:280 +0x2b created by github.com/prometheus/client_golang/prometheus.(Registry).Register /go/pkg/mod/github.com/prometheus/client_golang@v1.14.0/prometheus/registry.go:279 +0x19b appuser@pro01-oc-odb-exporter-7c46dd64b-g7rpx:/$ ./oracledb_exporter --custom.metrics="default-metrics.toml"
ts=2024-04-19T03:03:28.900Z caller=collector.go:352 level=info default-metrics.toml="has been changed. Reloading metrics..." panic: assignment to entry in nil map

goroutine 39 [running]: github.com/iamseth/oracledb_exporter/collector.(Exporter).checkIfMetricsChanged(0xc00026a000) /go/src/oracledb_exporter/collector/collector.go:353 +0x3e5 github.com/iamseth/oracledb_exporter/collector.(Exporter).scrape(0xc00026a000, 0xc000262180) /go/src/oracledb_exporter/collector/collector.go:268 +0x585 github.com/iamseth/oracledb_exporter/collector.(Exporter).Collect(0xc00026a000, 0x0?) /go/src/oracledb_exporter/collector/collector.go:180 +0xf4 github.com/iamseth/oracledb_exporter/collector.(Exporter).Describe(0x0?, 0xc0002046c0) /go/src/oracledb_exporter/collector/collector.go:158 +0xc7 github.com/prometheus/client_golang/prometheus.(Registry).Register.func1() /go/pkg/mod/github.com/prometheus/client_golang@v1.14.0/prometheus/registry.go:280 +0x2b created by github.com/prometheus/client_golang/prometheus.(Registry).Register /go/pkg/mod/github.com/prometheus/client_golang@v1.14.0/prometheus/registry.go:279 +0x19b appuser@pro01-oc-odb-exporter-7c46dd64b-g7rpx:/$

Version: 0.5.0

LuvlinLiu commented 2 months ago

I can start the exporter normally using the following command, but the metrics inside are still the default ones and no new ones are added.

appuser@pro01-oc-odb-exporter-7c46dd64b-g7rpx:/$ ./oracledb_exporter --default.metrics="pro01-oc-odb-metrics.toml" ts=2024-04-19T03:07:36.636Z caller=collector.go:313 level=error Errorscrapingfor=waittime ="unsupported value type" 60.316846ms=: ts=2024-04-19T03:07:36.650Z caller=collector.go:313 level=error Errorscrapingfor=resource _="unsupported value type" 74.23198ms=: ts=2024-04-19T03:07:36.676Z caller=main.go:69 level=info msg="Starting oracledb_exporter" version="(version=, branch=, revision=unknown)" ts=2024-04-19T03:07:36.676Z caller=main.go:70 level=info msg="Build context" build="(go=go1.19.9, platform=linux/amd64, user=, date=, tags=unknown)" ts=2024-04-19T03:07:36.677Z caller=main.go:71 level=info msg="Collect from: " metricPath=/metrics ts=2024-04-19T03:07:36.677Z caller=tls_config.go:232 level=info msg="Listening on" address=[::]:9161 ts=2024-04-19T03:07:36.677Z caller=tls_config.go:235 level=info msg="TLS is disabled." http2=false address=[::]:9161 ts=2024-04-19T03:07:43.697Z caller=collector.go:313 level=error Errorscrapingfor=waittime ="unsupported value type" 46.857195ms=: ts=2024-04-19T03:07:43.714Z caller=collector.go:313 level=error Errorscrapingfor=resource _="unsupported value type" 63.959155ms=: