Skip to main content
The OpenInference Java SDK provides tracing capabilities for AI applications using OpenTelemetry. It enables you to instrument and monitor different code executions across models, frameworks, and vendors. The SDK uses semantic conventions - standardized attribute names and values - to ensure consistent tracing across different LLM providers and frameworks.

openinference/java at main · Arize-ai/openinference

GitHub

Overview of Packages

OpenInference Java is part of the OpenInference project. The Java SDK consists of three main packages:

openinference-semantic-conventions

This package provides Java constants for OpenInference semantic conventions. Semantic conventions are standardized attribute names and values that ensure consistent tracing across different LLM providers, models, and frameworks. They define a common vocabulary for describing LLM operations, making it easier to analyze and compare traces from different sources. OpenInference semantic conventions include standardized attributes for:
  • Span Kinds: LLM, Chain, Tool, Agent, Retriever, Embedding, Reranker, Guardrail, Evaluator
  • Attributes: Model names, token counts, prompts, completions, embeddings, etc.

openinference-instrumentation

This package provides base instrumentation utilities for creating customized manual traces

openinference-instrumentation-langchain4j

This package provides auto-instrumentation for LangChain4j applications, automatically capturing traces from LangChain4j components:

Prerequisites

  • Java 11 or higher
  • OpenTelemetry Java 1.49.0 or higher
  • (Optional) Phoenix API key if using auth

Gradle

Add the dependencies to your build.gradle:

Maven

Add the dependencies to your pom.xml:

Quick Start

Manual Instrumentation

Auto-instrumentation (with LangChain4j)

Environment Configuration Example for Phoenix Tracing

Set your Phoenix credentials as environment variables:
If you are using Phoenix Cloud, adjust the endpoint in the code below as needed.

Observability in Phoenix

Once configured, your OpenInference traces will be automatically sent to Phoenix where you can:
  • Monitor Performance: Track latency, throughput, and error rates
  • Analyze Usage: View token usage, model performance, and cost metrics
  • Debug Issues: Trace request flows and identify bottlenecks
  • Evaluate Quality: Run evaluations on your LLM outputs

Support