Giter Club home page Giter Club logo

otelsql's Introduction

otelsql

ci codecov Go Report Card Documentation

It is an OpenTelemetry instrumentation for Golang database/sql, a port from open-telemetry/opentelemetry-go-contrib#505.

It can only instrument traces for the present.

Install

$ go get github.com/XSAM/otelsql

Features

Feature Description Status Reason
Rows, RowsClose Will enable the creation of spans on corresponding calls. Enabled by default, can't be disabled We need to know the status of Rows
Query If set to true, will enable recording of sql queries in spans. Enabled by default Will populate db.statement, which is a conditional attribute.
Ping If set to true, will enable the creation of spans on Ping requests. Implemented Ping has context argument, but it might no needs to record.
RowsNext If set to true, will enable the creation of events on corresponding calls. This can result in many events. Implemented It provides more visibility.
DisableErrSkip If set to true, will suppress driver.ErrSkip errors in spans. Implemented ErrSkip error might annoying
RecordError If set to true, will invoke the specified function which decides if the error should be recorded or not Implemented This gives the opportunity to check driver specific error codes and not record those that might not be a relevant error (eg. MySQL 1062 Duplicate Entry might be handled in the app and should not be recorded as an error).
AllowRoot If set to true, will allow otelsql to create root spans in absence of existing spans or even context. Implemented It might helpful while debugging missing operations.
RowsAffected, LastInsertID If set to true, will enable the creation of spans on RowsAffected/LastInsertId calls. Dropped Don't know its use cases. We might add this later based on the users' feedback.
QueryParams If set to true, will enable recording of parameters used with parametrized queries. Dropped It will cause high cardinality values and security problems.

Example

See example

Compatibility

This project is tested on the following systems.

OS Go Version Architecture
Ubuntu 1.17 amd64
Ubuntu 1.16 amd64
Ubuntu 1.17 386
Ubuntu 1.16 386
MacOS 1.17 amd64
MacOS 1.16 amd64
Windows 1.17 amd64
Windows 1.16 amd64
Windows 1.17 386
Windows 1.16 386

While this project should work for other systems, no compatibility guarantees are made for those systems currently.

The project follows the Release Policy to support major Go releases.

Why port this?

Based on this comment, OpenTelemetry SIG team like to see broader usage and community consensus on an approach before they commit to the level of support that would be required of a package in contrib. But it is painful for users without a stable version, and they have to use replacement in go.mod to use this instrumentation.

Therefore, I host this module independently for convenience and make improvements based on users' feedback.

otelsql's People

Contributors

xsam avatar noseglid avatar ccpost avatar jbub avatar rcrowe avatar wesleyvicthor avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.