> ## Documentation Index
> Fetch the complete documentation index at: https://wb-21fd5541-sdk-testing-latest.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# withAttributes

> TypeScript SDK 레퍼런스

<div id="withattributes">
  # withAttributes
</div>

▸ **withAttributes**\<`T`>(`attrs`, `fn`): `Promise`\<`T`> | `T`

현재 실행 컨텍스트에 속성을 추가하여 `fn` 내부에서 생성된 모든 calls가
자동으로 이를 상속하도록 합니다. 속성은 트레이스 서버의 call 기록에
기록되며 Weave UI/필터링에 표시되므로 request ID, tenant, 실험 등으로 run에 태그를 지정하는 데
적합합니다.

예시:

```ts theme={null}
await withAttributes({requestId: 'abc'}, async () => {
  await myOp();
});
```

<div id="type-parameters">
  #### 유형 매개변수
</div>

| 이름  |
| :-- |
| `T` |

<div id="parameters">
  #### 매개변수
</div>

| 이름      | 유형                         |                 |
| :------ | :------------------------- | --------------- |
| `attrs` | `Record`\<`string`, `any`> |                 |
| `fn`    | () => `T`                  | `Promise`\<`T`> |

<div id="returns">
  #### 반환값
</div>

`Promise`\<`T`> | `T`

<div id="defined-in">
  #### 정의 위치
</div>

[clientApi.ts:201](https://github.com/wandb/weave/blob/6538626556c93d6f31ae725fdefe4e6b8b71bc2c/sdks/node/src/clientApi.ts#L201)

***
