autotel

command module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 13, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

README

OpenTelemetry source level automatic instrumentation

This project adds OpenTelemetry instrumentation (https://github.com/open-telemetry/opentelemetry-go) to Go applications by automatically modifying their source code in similar way as compiler. It can instrument any golang project. It depends only on standard libraries and is platform agnostic.

How to use it

In order to instrument your project you have to add following call in your entry point function, usually main (you can look at tests directory for reference) and invoke autotel tool.

func main() {
    rtlib.AutotelEntryPoint__()

Autotel requires three parameters: command, path to project and package(s) pattern we would like to instrument.

./autotel --inject [path to your go project] [package(s) pattern]

Below concrete example with one of test instrumentation that is part of the project.

./autotel --inject ./tests/fib ./...

./... works like wildcard in this case and it will instrument all packages in this path, but it can be invoked with specific package as well

./autotel --inject ./tests/fib github.com/pdelewski/autotel/tests/fib

How it works

There are few passes during execution.

  1. Search for entry point, a function definition with AutotelEntryPoint__() call.
  2. Building call graph. Traversing all calls from entry point through all function definitions.
  3. Context propagation. Adding additional context parameter to all function declarations and function call expressions that are visible (it will not add context argument to call expression without having visible function declaration).
  4. Injecting open telemetry calls into functions bodies.

image info

Project Status

This project is actively maintained by Sumo Logic and is currently in it's initial days. We would love to receive your ideas, feedback & contributions.

Contributing

We welcome issues, questions, and pull requests.

License

This project is licensed under the terms of the MIT license. Please refer to LICENSE for the full terms.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
autotellib module
examples
fib Module
goroutines Module
methods Module
recursion Module
tests
fib Module
goroutines Module
methods Module
recursion Module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL