withAttributes
▸ withAttributes<T>(attrs, fn): Promise<T> | T
現在の実行コンテキストに属性をアタッチし、 fn 内で作成されるすべてのコールが自動的にそれらを継承するようにします。属性はトレースサーバー上のコールレコードに書き込まれ、 Weave UIやフィルタリングに表示されます。そのため、リクエストID、テナント、 Experiments などのタグを Runs に付与するのに最適です。
Example:
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type |
|---|---|
attrs | Record<string, any> |
fn | () => T | Promise<T> |
Returns
Promise<T> | T