Code Monkey home page Code Monkey logo

Comments (5)

kylexlau avatar kylexlau commented on September 13, 2024 2

Change prometheus.Handler to promhttp.Handler . @ammanms19

from prometheus_oracle_exporter.

floyd871 avatar floyd871 commented on September 13, 2024

Did you perform a "go get / go install" previous?
Seems something wrong with your environment.

from prometheus_oracle_exporter.

azet avatar azet commented on September 13, 2024

same problem. changing anything in source to promhttp.Handler as suggested by @kylexlau doesn't do anything for me when building manually from source either.


[azauner@xxx~]$ https_proxy=xxx:xxx go get -u github.com/freenetdigital/prometheus_oracle_exporter

# github.com/freenetdigital/prometheus_oracle_exporter
go/src/github.com/freenetdigital/prometheus_oracle_exporter/main.go:938:3: undefined: prometheus.Handler

[azauner@xxx~]$ go version
go version go1.11.5 linux/amd64

from prometheus_oracle_exporter.

azet avatar azet commented on September 13, 2024

Hi,

Got it to work. You need to change not only the Handler but of course also need to import the relevant dependency at the top;

--- a/main.go    2019-06-24 15:04:53.134872921 +0200
+++ b/main.go 2019-06-24 15:02:52.614874202 +0200
@@ -8,6 +8,7 @@
     "time"
   _ "github.com/mattn/go-oci8"
     "github.com/prometheus/client_golang/prometheus"
+    "github.com/prometheus/client_golang/prometheus/promhttp"
     "github.com/prometheus/common/log"
 )

@@ -935,7 +936,7 @@
   if r.URL.Query().Get("tablebytes") == "true" {; e.vTabBytes = true; }
   if r.URL.Query().Get("indexbytes") == "true" {; e.vIndBytes = true; }
   if r.URL.Query().Get("lobbytes") == "true" {; e.vLobBytes = true; }
-  prometheus.Handler().ServeHTTP(w, r)
+  promhttp.Handler().ServeHTTP(w, r)
 }

 func main() {

from prometheus_oracle_exporter.

floyd871 avatar floyd871 commented on September 13, 2024

Thank you.

from prometheus_oracle_exporter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.