Course contentsShow
← AI Engineering
Lesson 1285 of 1,88631. LLM Observability PlatformsFree lesson

Custom Metadata and Tagging

Attaching user IDs, session data, and custom tags to traces for filtering and analysis in observability platforms.

Custom Metadata and Tagging

What you'll learn: How to enrich your LLM traces with custom metadata like user IDs, session data, and tags to make filtering and analysis powerful and practical in observability platforms.

Why Metadata Matters

Imagine having thousands of LLM requests flowing through your system every hour. Without context, they're just a sea of anonymous API calls. Custom metadata transforms each trace into a story: who made the request, what feature they were using, which experiment variant they saw, and why it matters to your business.

What Is Custom Metadata?

Custom metadata is additional information you attach to traces beyond the default input/output logging. Think of it like adding luggage tags to your traces so you can find exactly what you're looking for later.

Common metadata includes:

  • User identifiers: user_id, account_id, organization_id
  • Session context: session_id, conversation_id, request_number
  • Feature tags: feature="chat", environment="production", model_version="v2"
  • Business context: subscription_tier="premium", experiment_group="variant_A"

Practical Applications

With proper tagging, you can:

  • Filter traces to debug one specific user's issue
  • Compare performance across different customer segments
  • Analyze costs by feature or team
  • Track quality metrics for A/B test cohorts
  • Identify patterns in failed requests from mobile vs. web users

Most observability platforms (LangSmith, Arize, Helicone) let you add metadata through their SDKs as simple key-value pairs during instrumentation.

Key Takeaway: Custom metadata and tags transform raw traces into queryable, actionable data by adding the business and user context that makes debugging and analysis meaningful at scale.