Skip to content

Instantly share code, notes, and snippets.

@avivl
Created March 18, 2018 14:06
Show Gist options
  • Select an option

  • Save avivl/15fd071ca0212838aebec2e45430eb1c to your computer and use it in GitHub Desktop.

Select an option

Save avivl/15fd071ca0212838aebec2e45430eb1c to your computer and use it in GitHub Desktop.
import (
"go.opencensus.io/exporter/prometheus"
"go.opencensus.io/exporter/stackdriver"
"go.opencensus.io/stats/view"
)
Exporter, err := prometheus.NewExporter(prometheus.Options{})
if err != nil {
logger.Error("Error creating prometheus exporter ", zap.Error(err))
}
// Export to Prometheus Monitoring.
view.RegisterExporter(pExporter)
sExporter, err := stackdriver.NewExporter(stackdriver.Options{ProjectID: config.ProjectID})
if err != nil {
logger.Error("Error creating stackdriver exporter ", zap.Error(err))
}
// Export to Stackdriver Monitoring.
view.RegisterExporter(sExporter)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment