Skip to content

Commit 2ede009

Browse files
authored
Merge pull request #312291 from jeffwmartinez/jefmarti-ds-logging
Clarify dynamic sessions logging
2 parents 55c1116 + 449279c commit 2ede009

7 files changed

Lines changed: 357 additions & 46 deletions

articles/container-apps/sessions-code-interpreter.md

Lines changed: 57 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ File names and paths must use only the following supported characters:
8686

8787
### Upload a file
8888

89-
To upload a file to a session, send a `POST` request to the `uploadFile` endpoint in a multipart form data request. Include the file data in the request body. The file must include a file name.
89+
To upload a file to a session, send a `POST` request to the `files` endpoint in a multipart form data request. Include the file data in the request body. The file must include a file name.
9090

9191
Uploaded files are stored in the session's file system in the `/mnt/data` directory.
9292

@@ -95,7 +95,7 @@ The following example shows how to upload a file to a session.
9595
Before you send the request, replace the placeholders between the `<>` brackets with values that are specific to your request.
9696

9797
```http
98-
POST https://<REGION>.dynamicsessions.io/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/sessionPools/<SESSION_POOL_NAME>/files/upload?api-version=2024-02-02-preview&identifier=<SESSION_ID>
98+
POST https://<REGION>.dynamicsessions.io/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/sessionPools/<SESSION_POOL_NAME>/files?api-version=2025-10-02-preview&identifier=<SESSION_ID>
9999
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
100100
Authorization: Bearer <TOKEN>
101101
@@ -109,14 +109,27 @@ Content-Type: application/octet-stream
109109

110110
### Download a file
111111

112-
To download a file from a session's `/mnt/data` directory, send a `GET` request to the `file/content/{filename}` endpoint. The response includes the file data.
112+
To download a file from a session's `/mnt/data` directory, send a `GET` request to the `files/{filename}/content` endpoint. The response includes the file data.
113113

114114
The following example demonstrates how to format a `GET` request to download a file.
115115

116116
Before you send the request, replace the placeholders between the `<>` brackets with values that are specific to your request.
117117

118118
```http
119-
GET https://<REGION>.dynamicsessions.io/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/sessionPools/<SESSION_POOL_NAME>/files/content/<FILE_NAME_AND_EXTENSION>?api-version=2024-02-02-preview&identifier=<SESSION_ID>
119+
GET https://<REGION>.dynamicsessions.io/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/sessionPools/<SESSION_POOL_NAME>/files/<FILE_NAME_AND_EXTENSION>/content?api-version=2025-10-02-preview&identifier=<SESSION_ID>
120+
Authorization: Bearer <TOKEN>
121+
```
122+
123+
### Get file metadata
124+
125+
To get metadata for a file in a session's `/mnt/data` directory, send a `GET` request to the `files/{filename}` endpoint. The response includes file properties such as size and last modified time.
126+
127+
The following example demonstrates how to format a `GET` request to retrieve file metadata.
128+
129+
Before you send the request, replace the placeholders between the `<>` brackets with values that are specific to your request.
130+
131+
```http
132+
GET https://<REGION>.dynamicsessions.io/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/sessionPools/<SESSION_POOL_NAME>/files/<FILE_NAME_AND_EXTENSION>?api-version=2025-10-02-preview&identifier=<SESSION_ID>
120133
Authorization: Bearer <TOKEN>
121134
```
122135

@@ -129,7 +142,7 @@ The following example shows how to list the files in a session's directory.
129142
Before you send the request, replace the placeholders between the `<>` brackets with values that are specific to your request.
130143

131144
```http
132-
GET https://<REGION>.dynamicsessions.io/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/sessionPools/<SESSION_POOL_NAME>/files?api-version=2024-02-02-preview&identifier=<SESSION_ID>
145+
GET https://<REGION>.dynamicsessions.io/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/sessionPools/<SESSION_POOL_NAME>/files?api-version=2025-10-02-preview&identifier=<SESSION_ID>
133146
Authorization: Bearer <TOKEN>
134147
```
135148

@@ -183,14 +196,14 @@ If you're not using an LLM framework integration, you can interact with the sess
183196

184197
## Run code in a session
185198

186-
To run code in a session, send a `POST` request to the `code/execute` endpoint with the code to run in the request body. Each code execution is limited to a maximum runtime of 220 seconds.
199+
To run code in a session, send a `POST` request to the `executions` endpoint with the code to run in the request body. Each code execution is limited to a maximum runtime of 220 seconds.
187200

188201
The following example prints `Hello, world!` in Python.
189202

190203
Before you send the request, replace the placeholders between the `<>` brackets with the appropriate values for your session pool and session identifier.
191204

192205
```http
193-
POST https://<REGION>.dynamicsessions.io/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/sessionPools/<SESSION_POOL_NAME>/code/execute?api-version=2024-02-02-preview&identifier=<SESSION_ID>
206+
POST https://<REGION>.dynamicsessions.io/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/sessionPools/<SESSION_POOL_NAME>/executions?api-version=2025-10-02-preview&identifier=<SESSION_ID>
194207
Content-Type: application/json
195208
Authorization: Bearer <TOKEN>
196209
@@ -207,14 +220,14 @@ To reuse a session, specify the same session identifier in subsequent requests.
207220

208221
#### Upload a file to a session
209222

210-
To upload a file to a session, send a `POST` request to the `uploadFile` endpoint in a multipart form data request. Include the file data in the request body. The file must include a file name.
223+
To upload a file to a session, send a `POST` request to the `files` endpoint in a multipart form data request. Include the file data in the request body. The file must include a file name.
211224

212225
Uploaded files are stored in the session's file system in the `/mnt/data` directory.
213226

214227
Before you send the request, replace the placeholders between the `<>` brackets with values that are specific to your request.
215228

216229
```http
217-
POST https://<REGION>.dynamicsessions.io/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/sessionPools/<SESSION_POOL_NAME>/files/upload?api-version=2024-02-02-preview&identifier=<SESSION_ID>
230+
POST https://<REGION>.dynamicsessions.io/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/sessionPools/<SESSION_POOL_NAME>/files?api-version=2025-10-02-preview&identifier=<SESSION_ID>
218231
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
219232
Authorization: Bearer <TOKEN>
220233
@@ -231,12 +244,23 @@ Content-Type: application/octet-stream
231244
232245
#### Download a file from a session
233246

234-
To download a file from a session's `/mnt/data` directory, send a `GET` request to the `file/content/{filename}` endpoint. The response includes the file data.
247+
To download a file from a session's `/mnt/data` directory, send a `GET` request to the `files/{filename}/content` endpoint. The response includes the file data.
248+
249+
Before you send the request, replace the placeholders between the `<>` brackets with values that are specific to your request.
250+
251+
```http
252+
GET https://<REGION>.dynamicsessions.io/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/sessionPools/<SESSION_POOL_NAME>/files/<FILE_NAME_AND_EXTENSION>/content?api-version=2025-10-02-preview&identifier=<SESSION_ID>
253+
Authorization: Bearer <TOKEN>
254+
```
255+
256+
#### Get file metadata
257+
258+
To get metadata for a file in a session's `/mnt/data` directory, send a `GET` request to the `files/{filename}` endpoint. The response includes file properties such as size and last modified time.
235259

236260
Before you send the request, replace the placeholders between the `<>` brackets with values that are specific to your request.
237261

238262
```http
239-
GET https://<REGION>.dynamicsessions.io/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/sessionPools/<SESSION_POOL_NAME>/files/content/<FILE_NAME_AND_EXTENSION>?api-version=2024-02-02-preview&identifier=<SESSION_ID>
263+
GET https://<REGION>.dynamicsessions.io/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/sessionPools/<SESSION_POOL_NAME>/files/<FILE_NAME_AND_EXTENSION>?api-version=2025-10-02-preview&identifier=<SESSION_ID>
240264
Authorization: Bearer <TOKEN>
241265
```
242266

@@ -247,7 +271,7 @@ To list the files in a session's `/mnt/data` directory, send a `GET` request to
247271
Before you send the request, replace the placeholders between the `<>` brackets with values that are specific to your request.
248272

249273
```http
250-
GET https://<REGION>.dynamicsessions.io/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/sessionPools/<SESSION_POOL_NAME>/files?api-version=2024-02-02-preview&identifier=<SESSION_ID>
274+
GET https://<REGION>.dynamicsessions.io/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/sessionPools/<SESSION_POOL_NAME>/files?api-version=2025-10-02-preview&identifier=<SESSION_ID>
251275
Authorization: Bearer <TOKEN>
252276
```
253277

@@ -285,12 +309,12 @@ Following is an example of the type of response you can expect when you request
285309

286310
Python code interpreter sessions include popular Python packages such as NumPy, pandas, and scikit-learn.
287311

288-
To output the list of preinstalled packages, call the `code/execute` endpoint with the following code.
312+
To output the list of preinstalled packages, call the `executions` endpoint with the following code.
289313

290314
Before you send the request, replace the placeholders between the `<>` brackets with values that are specific to your request.
291315

292316
```http
293-
POST https://<REGION>.dynamicsessions.io/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/sessionPools/<SESSION_POOL_NAME>/identifier/<SESSION_ID>/code/execute?api-version=2024-02-02-preview&identifier=<SESSION_ID>
317+
POST https://<REGION>.dynamicsessions.io/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/sessionPools/<SESSION_POOL_NAME>/executions?api-version=2025-10-02-preview&identifier=<SESSION_ID>
294318
Content-Type: application/json
295319
Authorization: Bearer <TOKEN>
296320
@@ -305,13 +329,30 @@ Authorization: Bearer <TOKEN>
305329

306330
## Logging
307331

308-
Code interpreter sessions don't support logging directly. The application that's interacting with the sessions can log requests to the session pool management API and its responses.
332+
The available outputs are the results you return from code execution, including `stdout` and `stderr`.
333+
334+
If you need request or response tracing, capture it in the application that calls the session pool management API (for example, log request IDs, inputs, and responses at your app boundary).
335+
336+
> [!NOTE]
337+
> Code interpreter sessions don't emit AppEnvSession logs to Log Analytics.
338+
339+
## Metrics
340+
341+
Code interpreter usage and execution metrics are returned as HTTP response headers for the code execution API. These metrics aren't written to Log Analytics.
342+
343+
### View metrics
344+
345+
1. Call the code execution API (`/executions`).
346+
2. Inspect the HTTP response headers for usage and execution metrics.
347+
348+
For details about the code execution API and endpoints, see [Run code in a session](#run-code-in-a-session) and [Management API endpoints](#management-api-endpoints).
309349

310350
## Billing
311351

312352
Code interpreter sessions are billed based on the duration of each session. For more information, see [Billing](billing.md#dynamic-sessions).
313353

314-
## Next step
354+
## Next steps
315355

316356
> [!div class="nextstepaction"]
317357
> [Use code interpreter sessions with LangChain](./sessions-tutorial-langchain.md)
358+

0 commit comments

Comments
 (0)