Hello everyone,
   I am delighted to announce observability tools to help provide 
distributed tracing and metrics for your SQL drivers in Go.

*"contrib.go.opencensus/integrations/ocsql"* is an instrumented wrapper for 
*"database/sql"*, using OpenCensus https://opencensus.io/

It can be trivially added to your apps with either of these 2 methods:
1. By registration:

package main
import (
        "database/sql"
        "log"

        "contrib.go.opencensus.io/integrations/ocsql")
func main() {
        var ordinaryDriverName string // For example "mysql", "sqlite3" etc.    
// First step is to register the driver and     // then reuse that driver name 
while invoking sql.Open  driverName, err := ocsql.Register(ordinaryDriverName)
        if err != nil {
                log.Fatalf("Failed to register the ocsql driver: %v", err)
        }
        db, err := sql.Open(driverName, "resource.db")
        if err != nil {
                log.Fatalf("Failed to open the SQL database: %v", err)
        }
        defer db.Close()}


2.  By explicitly wrapping

package mainimport (
        "log"
        "database/sql"

        sqlite3 "github.com/mattn/go-sqlite3"
        "contrib.go.opencensus.io/integrations/ocsql"}
const driverName = "ocsql"
func main() {
        // wrap ocsql around existing database driver   driver := 
ocsql.Wrap(&sqlite3.SQLiteDriver{})

        // register our ocsql wrapped driver with database/sql  
sql.Register(driverName, driver)

        // use our ocsql driver db, err := sql.Open(driverName, "my-sqlite.db")
        if err != nil {
                log.Fatalf("Failed to open the SQL database: %v", err)
        }
        defer db.Close()

}


For an end-to-end guide, please take a look 
at https://opencensus.io/integrations/sql/go_sql/#end-to-end-example
which when run will extract traces and metrics.

Couple that with say:
* ochttp https://opencensus.io/guides/http/go/net_http/
* ocgrpc https://opencensus.io/guides/grpc/go/

and your applications/micro-services will be lit up with observability, 
with minimal effort. I encourage you to check it out.
A bonus to tack on simplicity and reduce the hassle of deployment would be 
to use the *OpenCensus Agent* https://opencensus.io/agent/

You are all cordially welcome to the OpenCensus project and community 
https://opencensus.io/community/,
but also it would be great to get your feedback so please don't hesitate to 
reach out. 

Thank you for your time, attention and kind consideration.
Kind regards,
Emmanuel Odeke
Orijtech, Inc.

*PS:*
*A word about OpenCensus:*
The OpenCensus project https://opencensus.io provides a vendor-agnostic and 
single distribution of libraries for observability with distributed tracing 
and metrics.
It is the open source rewrite of the observability tools that have powered 
Google's production systems for the past 10+ years. The project's libraries 
are available in
a variety of languages like Go, C#, Java, Python, C++, Erlang/Elixir, PHP, 
Node.js and Ruby. It allows you to collect observability signals once and 
export to a plethora
of backends such as AWS X-Ray, Google Stackdriver, Honeycomb, Microsoft 
Azure Monitor, DataDog, Prometheus, Zipkin, Jaeger, Instana and many more.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to