> ## Documentation Index
> Fetch the complete documentation index at: https://www.traceloop.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Associating Entities with Traces

> How to associate traces with entities in your own application

Each trace you run is usually connected to entities in your own application -
things like `user_id`, `chat_id`, or anything else that is tied to the flow that triggered the trace.

OpenLLMetry allows you to easily mark traces with these IDs so you can track them in the UI.

<Tip>
  You can use any key-value pair to associate a trace with an entity - it can
  also be `org_id`, `team_id`, whatever you want. The only requirement is that
  the key and the value are strings.
</Tip>

<CodeGroup>
  ```python Python theme={null}
  from traceloop.sdk import Traceloop
   
  Traceloop.set_association_properties({ "user_id": "user12345", "chat_id": "chat12345" })
  ```

  ```js Typescript theme={null}
  // Option 1 (for class methods only) - set association properties within a workflow, task, agent or tool
  class MyClass {
    @traceloop.workflow({ associationProperties: { userId: "user123" })
    myMethod() {
      // Your code here
    }
  }

  // Option 2 - set association properties within a workflow, task, agent or tool
  traceloop.withWorkflow(
    {
      name: "workflow_name",
      associationProperties: { userId: "user12345", chatId: "chat12345" },
    },
    () => {
      // Your code here
      // (function can be made async if needed)
    }
  );

  // Option 3  - set association properties directly
  traceloop.withAssociationProperties(
    {
      userId: "user12345",
      chatId: "chat12345",
    },
    () => {
      // Your code here
      // (can be async or sync)
    }
  );
  ```
</CodeGroup>
