Skip to content

Commit 7ea5730

Browse files
committed
fix comments
Signed-off-by: Renaud Bourassa <[email protected]>
1 parent fa81fc6 commit 7ea5730

File tree

3 files changed

+22
-27
lines changed

3 files changed

+22
-27
lines changed

docs/source/workflows/observe/observe-workflow-with-dbnl.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Create a new Trace Ingestion project in DBNL. To create a new project in DBNL:
3838
6. Click on Generate API Token and note down the generated **API Token**
3939
7. Note down the **Project Id** for the project
4040

41-
### Step 3: Configure Your Environment
41+
## Step 3: Configure Your Environment
4242

4343
Set the following environment variables in your terminal:
4444

@@ -67,9 +67,6 @@ general:
6767
tracing:
6868
otelcollector:
6969
_type: dbnl
70-
api_url: ${DBNL_API_URL}
71-
api_token: ${DBNL_API_TOKEN}
72-
project_id: ${DBNL_PROJECT_ID}
7370
```
7471
7572
## Step 6: Run the workflow

examples/observability/simple_calculator_observability/configs/config-dbnl.yml

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,14 @@ general:
2727
tracing:
2828
dbnl:
2929
_type: dbnl
30-
api_url: ${DBNL_API_URL}
31-
api_token: ${DBNL_API_TOKEN}
32-
project_id: ${DBNL_PROJECT_ID}
30+
31+
function_groups:
32+
calculator:
33+
_type: calculator
3334

3435
functions:
35-
calculator_multiply:
36-
_type: calculator_multiply
37-
calculator_inequality:
38-
_type: calculator_inequality
39-
calculator_divide:
40-
_type: nat_simple_calculator/calculator_divide
4136
current_datetime:
4237
_type: current_datetime
43-
calculator_subtract:
44-
_type: calculator_subtract
4538

4639
llms:
4740
nim_llm:
@@ -52,12 +45,7 @@ llms:
5245

5346
workflow:
5447
_type: react_agent
55-
tool_names:
56-
- calculator_multiply
57-
- calculator_inequality
58-
- current_datetime
59-
- calculator_divide
60-
- calculator_subtract
48+
tool_names: [calculator, current_datetime]
6149
llm_name: nim_llm
6250
verbose: true
6351
parse_agent_response_max_retries: 3

packages/nvidia_nat_opentelemetry/src/nat/plugins/opentelemetry/register.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,9 @@ async def galileo_telemetry_exporter(config: GalileoTelemetryExporter, builder:
198198
class DBNLTelemetryExporter(BatchConfigMixin, TelemetryExporterBaseConfig, name="dbnl"):
199199
"""A telemetry exporter to transmit traces to DBNL."""
200200

201-
api_url: str = Field(description="The DBNL API url.", default="http://localhost:8080/api")
202-
api_token: str = Field(description="The DBNL API token.")
203-
project_id: str = Field(description="The DBNL project id.")
201+
api_url: str | None = Field(description="The DBNL API url.", default=None)
202+
api_token: str | None = Field(description="The DBNL API token.", default=None)
203+
project_id: str | None = Field(description="The DBNL project id.", default=None)
204204

205205

206206
@register_telemetry_exporter(config_type=DBNLTelemetryExporter)
@@ -209,12 +209,22 @@ async def dbnl_telemetry_exporter(config: DBNLTelemetryExporter, builder: Builde
209209

210210
from nat.plugins.opentelemetry import OTLPSpanAdapterExporter
211211

212+
api_token = config.api_token or os.environ.get("DBNL_API_TOKEN")
213+
if not api_token:
214+
raise ValueError("API token is required for DBNL")
215+
project_id = config.project_id or os.environ.get("DBNL_PROJECT_ID")
216+
if not project_id:
217+
raise ValueError("Project id is required for DBNL")
218+
212219
headers = {
213-
"Authorization": f"Bearer {config.api_token}",
214-
"x-dbnl-project-id": config.project_id,
220+
"Authorization": f"Bearer {api_token}",
221+
"x-dbnl-project-id": project_id,
215222
}
216223

217-
endpoint = config.api_url.rstrip("/") + "/otel/v1/traces"
224+
api_url = config.api_url or os.environ.get("DBNL_API_URL")
225+
if not api_url:
226+
raise ValueError("API url is required for DBNL")
227+
endpoint = api_url.rstrip("/") + "/otel/v1/traces"
218228

219229
yield OTLPSpanAdapterExporter(
220230
endpoint=endpoint,

0 commit comments

Comments
 (0)