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

# 설정 및 종료

> init, force_flush, shutdown, TracingSession을 사용하여 트레이싱을 시작, 플러시, 중지합니다.

`tracing` 모듈을 통해 다음 항목에 액세스할 수 있습니다:

```python theme={"system"}
from coreweave.forge.agentlens import tracing
```

<h2 id="init">
  init
</h2>

```python theme={"system"}
def init(
    project_name: str,
    *,
    api_key: Union[str, None] = None,
    base_url: Union[str, None] = None,
    service_name: str = 'coreweave-forge-sdk',
    autopatch_integrations: bool = True,
) -> TracingSession: ...
```

패키지가 생성한 에이전트 span을 Agent Lens 프로젝트로 내보내기 시작합니다.

`project_name`은 반드시 `entity/project` 형식이어야 합니다. 이 패키지는 기본 entity를 찾는 데
W\&B 계정 API에 의존하지 않도록 의도적으로 설계되었습니다. 자격 증명은
`api_key`, `WANDB_API_KEY` 또는 `.netrc`의 W\&B 호스트 항목에서 가져옵니다.
`autopatch_integrations=True`로 설정하면 `sys.modules`에 이미 로드된 지원 공급자 SDK를 패치하고,
이후에 임포트되는 공급자도 감지합니다.
다시 초기화하면 이전 세션을 플러시하고, 새 span은
새 프로젝트로 라우팅됩니다. 아직 열려 있는 span은 시작된 프로젝트로 계속
내보내집니다. 이전 세션은 다음 `init` 호출이나
`shutdown` 호출 시 닫힙니다.

<h2 id="force_flush">
  force\_flush
</h2>

```python theme={"system"}
def force_flush(timeout_millis: int = 30000) -> bool: ...
```

<h2 id="shutdown">
  shutdown
</h2>

```python theme={"system"}
def shutdown() -> None: ...
```

<h2 id="tracingsession">
  TracingSession
</h2>

```python theme={"system"}
@dataclass
class TracingSession: ...
```

OTLP 공급자와 해당 공급자의 백그라운드 내보내기 워커를 소유합니다.

**필드**

| 필드 | 유형 | 기본값 |
| - | - | - |
| `provider` | `TracerProvider` | 필수 |
| `endpoint` | `str` | 필수 |
| `project_id` | `str` | 필수 |

<h3 id="tracingsessionforce_flush">
  TracingSession.force\_flush
</h3>

```python theme={"system"}
def force_flush(timeout_millis: int = 30000) -> bool: ...
```

<h3 id="tracingsessionshutdown">
  TracingSession.shutdown
</h3>

```python theme={"system"}
def shutdown() -> None: ...
```
