Skip to main content
This Instrumentation Rule is currently only available with the Odigos Enterprise plan.
Contact us for more information.

Considerations

If you wish to create custom eBPF-based instrumentations for Go or Java applications, you can define a “Custom Instrumentation” rule via the Odigos InstrumentationRule CRD or the Odigos UI. This feature is a great way to extend Odigos’s auto-instrumentation capabilities to cover your specific use cases and application logic.

Configuration Options

When function is specified, receiverName and receiverMethodName must NOT be specified, and vice versa, if receiverName and receiverMethodName are specified, function must NOT be specified.PackageName is required in all cases.
packageName string - The name of the package containing the function to instrument.
  • This field is required
functionName string - The name of the function to instrument.
  • This field is optional
receiverName string - The name of the receiver type if the function is a method.
  • This field is optional
receiverMethodName string - The name of the method receiver if the function is a method.
  • This field is optional
class string - The fully qualified name of the class containing the method to instrument.
  • This field is required
method string - The name of the method to instrument.
  • This field is required

Basic Example

The following example shows how to create a “Custom Instrumentation” rule that instruments a function named ProcessOrder in the github.com/example/ecommerce package.
1

Create a YAML file named custom-instrumentation.yaml with the following content:
apiVersion: odigos.io/v1alpha1
kind: InstrumentationRule
metadata:
    name: custom-instrumentation-rule
    namespace: odigos-system
spec:
    ruleName: "Custom Instrumentation for ProcessOrder"
    customInstrumentation:
        golang:
            packageName: "github.com/example/ecommerce"
            functionName: "ProcessOrder"
apiVersion: odigos.io/v1alpha1
kind: InstrumentationRule
metadata:
    name: custom-instrumentation-rule
    namespace: odigos-system
spec:
    ruleName: "Custom Instrumentation for ProcessOrder Method"
    customInstrumentation:
        golang:
            packageName: "github.com/example/ecommerce"
            receiverName: "OrderProcessor"
            receiverMethodName: "ProcessOrder"
2

Apply the action to the cluster:
kubectl apply -f custom-instrumentation.yaml