Table of Contents (🔎 Click to expand/collapse)
OpenCensus is an open source framework for metrics collection and distributed tracing. It offers the following benefits to its users:
- Low overhead data collection.
- Standard wire protocols and consistent APIs for handling metrics and trace data.
- Vendor interoperability via the OpenMetrics standard. OpenCensus can ingest into multiple backends in parallel, enabling incremental transitions and side-by-side comparison of backends.
- Correlation with traces and, in the future, log entries.
While multiple methods exist for reporting application metrics to Cloud Monitoring (see Other Methods for Reporting Application Metrics to Cloud Monitoring later in this lab), Google and Cloud Monitoring have adopted OpenCensus officially as the default mechanism for ingestion.
$ go get go.opencensus.io
$ go get contrib.go.opencensus.io/exporter/stackdriver
$ go mod init test3
$ go mod tidy
Logs-based metrics are Cloud Monitoring metrics that are based on the content of log entries.