> For the complete documentation index, see [llms.txt](https://docs.raga.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.raga.ai/ragaai-catalyst/concepts/uploading-data/trace-level-metadata.md).

# Trace Level Metadata

Users can add custom information to real-time traces, if needed. While open telemetry data is logged automatically, customer-specific metadata can be attached to individual traces on the go. This can be done using dedicated functions as follows.

**Step 1: Define Metadata Fields**

When initializing the RagaAI Catalyst tracer in your application, define the various metadata fields (key-value) you might require through the course of the complete flow. Only fields defined here can be edited further in the code.

<pre class="language-python"><code class="lang-python"><strong>tracer = Tracer(
</strong>    project_name=project_name,
    dataset_name=tracer_dataset_name,
    metadata={"name": "abc", "age": 25, "company": "ragaai"},
    tracer_type="langchain",
)
</code></pre>

In the above example, "name", "age", and "company" are the three metadata fields defined, which can be assigned values for each individual trace going ahead.

**Step 2: Update Metadata Fields**

Using the `add_metadata` method, users can update one or more metadata fields as shown:

```python
tracer.add_metadata({"name": "def", "age": 32})
```

This function can be called right before your LLM call to update the values as required. When the LLM call is successful and the trace is uploaded onto the RagaAI Catalyst platform, these fields will show as different columns, with default values wherever not set.

Note: If metadata fields are not set explicitly for each trace (as shown above), the respective columns will be populated with default values set during initialization. Values are only set at the trace level and do not persist once a trace is uploaded successfully.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.raga.ai/ragaai-catalyst/concepts/uploading-data/trace-level-metadata.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
