package prometheus
Import Path
contrib.go.opencensus.io/exporter/prometheus (on go.dev)
Dependency Relation
imports 12 packages, and imported by one package
Involved Source Files
Package prometheus contains a Prometheus exporter that supports exporting
OpenCensus views as Prometheus metrics.
sanitize.go
Code Examples
package main
import (
"contrib.go.opencensus.io/exporter/prometheus"
"log"
"net/http"
)
func main() {
exporter, err := prometheus.NewExporter(prometheus.Options{})
if err != nil {
log.Fatal(err)
}
// Serve the scrape endpoint on port 9999.
http.Handle("/metrics", exporter)
log.Fatal(http.ListenAndServe(":9999", nil))
}
Package-Level Type Names (total 5, in which 2 are exported)
Exporter exports stats to Prometheus, users need
to register the exporter as an http.Handler to be
able to export.
c *collector
g prometheus.Gatherer
handler http.Handler
opts Options
ExportView exports to the Prometheus if view data has one or more rows.
Each OpenCensus AggregationData will be converted to
corresponding Prometheus Metric: SumData will be converted
to Untyped Metric, CountData will be a Counter Metric,
DistributionData will be a Histogram Metric.
Deprecated in lieu of metricexport.Reader interface.
ServeHTTP serves the Prometheus endpoint.
*T : go.opencensus.io/stats/view.Exporter
*T : net/http.Handler
func NewExporter(o Options) (*Exporter, error)
Options contains options for configuring the exporter.
// ConstLabels will be set as labels on all views.
Namespace string
OnError func(err error)
Registry *prometheus.Registry
(*T) onError(err error)
func NewExporter(o Options) (*Exporter, error)
func newCollector(opts Options, registrar *prometheus.Registry) *collector
Package-Level Functions (total 10, in which 1 are exported)
NewExporter returns an exporter that exports stats to Prometheus.
Package-Level Constants (only one, which is unexported)
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |