Use this file to discover all available pages before exploring further.
Custom instrumentation lets you define custom eBPF-based instrumentations for specific functions or methods in your application or its dependencies. Unlike automatic instrumentation, which covers common frameworks and libraries, custom instrumentation targets the exact code you choose—for example, a business-critical function or an internal helper that you want to see as a span in your traces. The VM Agent supports Java and Go. For Go, you can instrument either a function (by package and function name) or a receiver method (by package, receiver type, and method name); you must use one form or the other, not both.There are two ways to add a custom instrumentation rule: using odictl or using YAML files.
odictl
YAML
1
Launch odictl
odictl
2
Open the Instrumentation Rules pane
Use Tab to cycle to the Instrumentation Rules pane, or click it with your mouse. Press Enter or click + Add Rule to add a new rule.
3
Choose Custom instrumentation
Select Custom instrumentation as the rule type and press Enter.
4
Configure the rule
Press i to enter INSERT mode.
For Java: set class (fully qualified class name) and method (method name).
For Go function: set packageName and functionName. Do not set receiverName or receiverMethodName.
For Go receiver method: set packageName, receiverName, and receiverMethodName. Do not set functionName.
When finished, press Esc, then type :wq to save and exit.
Examples
Java
Instrument a method by fully qualified class and method name:
The java: and golang: keys accept a list; add multiple entries to instrument several methods or functions in one rule. Use only one language per rule (do not combine java: and golang:). For Go, use either functions or receiver methods in a single rule, not both.
To cancel, press Esc if in INSERT mode, then type :q! to exit without saving.
5
Complete adding the rule
Select OK. The rule appears in the Rules section in odictl.
6
Verify the rule
The rule appears in the Rules list.
1
Navigate to the rules configuration folder
cd /etc/odigos-vmagent/rules.d
2
Create a rule YAML file
Create a YAML file for your custom instrumentation rule. The example below uses vi.
sudo vi custom-instrumentation.yaml
3
Add the custom instrumentation configuration
Add a rule with customInstrumentation and either golang or java. For Go, use either a function (package + functionName) or a receiver method (package + receiverName + receiverMethodName), not both.