Documentation ¶
Overview ¶
Package prometheus contains a Prometheus exporter that supports exporting OpenCensus views as Prometheus metrics.
Example ¶
package main import ( "log" "net/http" "go.opencensus.io/exporter/prometheus" "go.opencensus.io/stats/view" ) func main() { exporter, err := prometheus.NewExporter(prometheus.Options{}) if err != nil { log.Fatal(err) } view.RegisterExporter(exporter) // Serve the scrape endpoint on port 9999. http.Handle("/metrics", exporter) log.Fatal(http.ListenAndServe(":9999", nil)) }
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Exporter ¶
type Exporter struct {
// contains filtered or unexported fields
}
Exporter exports stats to Prometheus, users need to register the exporter as an http.Handler to be able to export.
func NewExporter ¶
NewExporter returns an exporter that exports stats to Prometheus.
func (*Exporter) ExportView ¶
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.
Click to show internal directories.
Click to hide internal directories.