# Tracing

* Tracing penting untuk mencatat setiao request yang masuk.
* Gunakan opentracing agar lebih fleksible.
* Tambahkan env untuk tracing di file .env

```
PORT = 7070
POSTGRES_HOST = localhost
POSTGRES_PORT = 5432
POSTGRES_USER = postgres
POSTGRES_PASSWORD = pass
POSTGRES_DB = drivers
AUTH_SERVICE = localhost:5050
SERVICE_NAME = skeleton
DD_AGENT_HOST = localhost
```

* Update file server.go untuk memasang opentracing

```go
t := opentracer.New(
        tracer.WithServiceName(os.Getenv("SERVICE_NAME")),
        tracer.WithAnalytics(true),
        tracer.WithAgentAddr(os.Getenv("DD_AGENT_HOST")),
    )
    opentracing.SetGlobalTracer(t)
    defer tracer.Stop()
```


---

# Agent Instructions: 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:

```
GET https://golang-microservices.rijalasepnugroho.com/grpc-framework/grpc-tracing.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
