Skip to main content

Semantic Conventions

This guide covers OpenTelemetry semantic conventions and how LangWatch implements them, along with our custom attributes for LLM-specific observability.

OpenTelemetry Standards

Understand the OpenTelemetry semantic conventions that LangWatch follows for consistent observability.

LangWatch Attributes

Explore LangWatch’s custom attributes designed specifically for LLM applications and AI observability.

What Are Semantic Conventions?

Semantic conventions are standardized naming and structure guidelines for observability data. They ensure consistency across different systems and make it easier to analyze and correlate data from various sources.
OpenTelemetry semantic conventions provide a standardized way to name attributes, events, and other observability data, making it easier to build tools and dashboards that work across different applications and services. For practical examples of these conventions in action, see Manual Instrumentation.

Benefits of Semantic Conventions

  • Consistency: Standardized naming across all your services
  • Interoperability: Works with any OpenTelemetry-compatible tool
  • Analytics: Easier to build dashboards and alerts
  • Debugging: Familiar patterns make troubleshooting faster
  • Team Collaboration: Shared understanding of observability data

OpenTelemetry Semantic Conventions

LangWatch fully implements OpenTelemetry semantic conventions, ensuring your traces are compatible with any OpenTelemetry-compatible observability platform.

Core Semantic Conventions

The OpenTelemetry specification defines conventions for common observability scenarios. LangWatch supports all OpenTelemetry semantic conventions while also providing its own custom attributes for LLM-specific observability.

Span Types and Attributes

OpenTelemetry defines standard span types and their associated attributes. LangWatch extends these with custom span types for LLM operations:

TypeScript Autocomplete Support

All attribute setting methods in LangWatch provide full TypeScript autocomplete support, you don’t need to import anything, just use the attribute names directly and autocomplete will appear in your editor.

Autocomplete in Span Methods

Autocomplete in Configuration

LangWatch Attributes Reference

LangWatch provides a comprehensive set of custom attributes for LLM-specific observability. All attributes are available with TypeScript autocomplete support.

Core LangWatch Attributes

SDK Information Attributes

Prompt Management Attributes

LangChain Integration Attributes

Using SDK Constants

Instead of using raw attribute strings, both SDKs provide typed constants you can import:
TypeScript: import { attributes } from "langwatch"Python: from langwatch.attributes import AttributeKey

Best Practices

Attribute Naming

Follow these conventions for consistent observability:

Attribute Values

Use appropriate data types and formats:

Sensitive Data

Never include sensitive information in attributes:

Performance Considerations

Limit the number and size of attributes for performance:

Summary

Semantic conventions provide a standardized approach to observability data that:
  • Ensures consistency across your entire application
  • Enables interoperability with OpenTelemetry-compatible tools
  • Improves debugging with familiar patterns
  • Supports team collaboration with shared understanding
LangWatch implements both OpenTelemetry semantic conventions and custom LLM-specific attributes, all with full TypeScript autocomplete support to help you use the right attributes consistently.
Key takeaways:
  • Use semantic convention attributes for consistency
  • Import attributes from LangWatch for autocomplete
  • Follow OpenTelemetry standards for interoperability
  • Leverage LangWatch’s LLM-specific attributes for AI observability
For practical examples and advanced usage patterns:
Use semantic conventions consistently across your application for better analytics, debugging, and team collaboration. Start with the Manual Instrumentation tutorial to see these conventions in practice.