The AutoInstrumentation Custom Resource is the primary configuration interface for defining:
  • Which pods to instrument (selectors)
  • How to instrument them (provider, packages, environment)
  • Where to send telemetry data (OTLP configuration)
  • What attributes to include (resource attributes)

Resource Structure

Basic Structure

apiVersion: openlit.io/v1alpha1
kind: AutoInstrumentation
metadata:
  name: example-instrumentation
  namespace: default
spec:
  selector: {}           # Pod selection criteria
  ignore: {}             # Pods to ignore  
  python: {}             # Python instrumentation config
  otlp: {}               # OTLP endpoint configuration
  resource: {}           # Resource attributes
status: {}               # Resource status (read-only)

Pod Selection Configuration

Configure which pods should be instrumented using label selectors.

Selector Parameters

ParameterTypeDescriptionDefaultExample
spec.selectorLabelSelectorPods to instrumentRequiredSee examples below
spec.selector.matchLabelsmap[string]stringExact label matches{}{"app": "chatbot"}
spec.selector.matchExpressions[]LabelSelectorRequirementExpression-based matching[]See expressions table

Match Expressions

FieldTypeDescriptionValuesExample
keystringLabel key to matchAny label key"environment"
operatorstringMatching operatorIn, NotIn, Exists, DoesNotExist"In"
values[]stringValues to match (for In/NotIn)List of strings["prod", "staging"]

Ignore Configuration

ParameterTypeDescriptionDefaultExample
spec.ignoreLabelSelectorPods to skip even if they match selector{}See example
spec.ignore.matchLabelsmap[string]stringExact label matches to ignore{}{"debug": "true"}
spec.ignore.matchExpressions[]LabelSelectorRequirementExpression-based ignoring[]System pods

Python Instrumentation Configuration

Configure Python-specific instrumentation settings.

Instrumentation Parameters

ParameterTypeDescriptionDefaultExample
spec.python.instrumentation.enabledboolEnable Python instrumentationtruefalse
spec.python.instrumentation.providerstringInstrumentation provider"openlit""openinference"
spec.python.instrumentation.versionstringProvider version"latest""v1.0.0"
spec.python.instrumentation.customInitImagestringCustom init container image"""custom-registry.com/openlit:v1.0"
spec.python.instrumentation.imagePullPolicystringImage pull policy"IfNotPresent""Always"
spec.python.instrumentation.customPackagesstringAdditional pip packages"""langchain>=0.1.0,chromadb>=0.4.0"

Supported Providers

ProviderDescriptionUse CaseImage Repository
"openlit"Full OpenLIT instrumentationComplete AI observabilityghcr.io/openlit/openlit-ai-instrumentation
"openinference"OpenInference standardOpenTelemetry standard complianceghcr.io/openlit/openinference-ai-instrumentation
"openllmetry"OpenLLMetry instrumentationLLM-focused observabilityghcr.io/openlit/openllmetry-ai-instrumentation
"custom"Custom instrumentationCustom implementationUser-defined via customInitImage

Environment Variables

ParameterTypeDescriptionDefaultExample
spec.python.instrumentation.env[]EnvVarEnvironment variables for instrumented containers[]See examples
spec.python.instrumentation.env[].namestringEnvironment variable nameRequired"OPENLIT_API_KEY"
spec.python.instrumentation.env[].valuestringDirect value"""debug-mode"
spec.python.instrumentation.env[].valueFromEnvVarSourceValue from external sourcenilSecret/ConfigMap reference

Environment Variable Sources

Source TypeFieldDescriptionExample
secretKeyRefname, keyValue from Kubernetes Secret{name: "openlit-secret", key: "api-key"}
configMapKeyRefname, keyValue from ConfigMap{name: "openlit-config", key: "endpoint"}
fieldReffieldPathValue from pod/container field{fieldPath: "metadata.name"}
resourceFieldRefresourceValue from resource field{resource: "requests.cpu"}

OTLP Configuration

Configure OpenTelemetry Protocol (OTLP) endpoint settings.

OTLP Parameters

ParameterTypeDescriptionDefaultExampleValidation
spec.otlp.endpointstringOTLP endpoint URLRequired"http://openlit:4318"Valid HTTP/HTTPS URL
spec.otlp.headersstringHTTP headers (comma-separated)"""authorization=Bearer token123"key=value format
spec.otlp.timeoutintRequest timeout in seconds30601-300 seconds

Endpoint Formats

FormatDescriptionExampleUse Case
Internal ServiceKubernetes service referencehttp://openlit:4318Same cluster deployment
Fully QualifiedFull service DNS namehttp://openlit.openlit.svc.cluster.local:4318Cross-namespace access
External HTTPSExternal secure endpointhttps://traces.example.com:4318Cloud/external services
Load BalancerLoad balancer endpointhttp://otlp-lb.company.com:4318High availability setup

Headers Format

Headers should be comma-separated key=value pairs:
Header TypeFormatExampleUse Case
Authorizationauthorization=Bearer <token>"authorization=Bearer abc123"API authentication
API Keyx-api-key=<key>"x-api-key=secret456"API key authentication
Multiple Headerskey1=val1,key2=val2"auth=token,x-trace-id=123"Multiple authentication
URL EncodedURL-encoded special chars"auth=Bearer%20token"Special characters

Resource Attributes

Configure resource attributes that will be added to all telemetry data.

Resource Parameters

ParameterTypeDescriptionDefaultExampleOpenTelemetry Mapping
spec.resource.environmentstringDeployment environment"""production"deployment.environment
spec.resource.serviceNamestringService name override"""ai-chat-service"service.name
spec.resource.serviceNamespacestringService namespace"""ai-platform"service.namespace
spec.resource.serviceVersionstringService version"""v2.1.0"service.version

Automatic Attributes

The operator automatically sets these attributes (cannot be overridden):
AttributeSourceExampleDescription
k8s.pod.namePod metadata"chatbot-abc123"Kubernetes pod name
k8s.namespace.namePod namespace"production"Kubernetes namespace
k8s.deployment.nameOwner reference"ai-chatbot"Deployment name (if applicable)
k8s.replicaset.nameOwner reference"ai-chatbot-xyz789"ReplicaSet name (if applicable)
k8s.node.namePod spec"worker-node-1"Node where pod is running