SumoLogic-Labs / autotel

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OpenTelemetry Go Source Automatic Instrumentation

This package provides a code generation utility that instruments existing source code with OpenTelemetry. If you are looking for more details about internal working, see How it works.

Project Status

🚧 This package is currently work in progress.

Build

From driver directory execute:

go build

Prerequisites

instrgen driver utility needs to be on your PATH environment variable.

How to use it

Instrgen has to be invoked from main module directory and requires three parameters: command, directory (files from specified directory will be rewritten).

./driver --inject [file pattern] [replace input source] [entry point]

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

driver --inject  /testdata/basic yes main.main

Above command will invoke golang compiler under the hood:

go build -work -a -toolexec driver

which means that the above command can be executed directly, however first instrgen_cmd.json configuration file needs to be provided. This file is created internally by driver based on provided command line.

Below example content of instrgen_cmd.json:

{
"ProjectPath": ".",
"FilePattern": "/testdata/basic",
"Cmd": "inject",
"Replace": "yes",
"EntryPoint": {
    "Pkg": "main",
    "FunName": "main"
 }
}

Work in progress:

Library instrumentation:

  • HTTP

Compatibility

The instrgen utility is based on the Go standard library and is platform agnostic.

About


Languages

Language:Go 100.0%