Skip to content

Commit 70f86c2

Browse files
committed
Log more information sara timeseries response
1 parent 6d7d893 commit 70f86c2

1 file changed

Lines changed: 19 additions & 4 deletions

File tree

api/Services/TimeseriesService.cs

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ public record TriggerTimeseriesUploadRequest
2020
public Dictionary<string, string> Metadata { get; init; } = [];
2121
}
2222

23+
public record TriggerTimeseriesUploadResponse
24+
{
25+
public string? TimeseriesId { get; init; }
26+
public int StatusCode { get; init; }
27+
public string? Message { get; init; }
28+
}
29+
2330
public record FetchCO2MeasurementRequest
2431
{
2532
[JsonPropertyName("facility")]
@@ -69,18 +76,26 @@ public async Task TriggerTimeseriesUpload(TriggerTimeseriesUploadRequest uploadR
6976

7077
if (response.IsSuccessStatusCode)
7178
{
79+
var uploadResponse =
80+
await response.Content.ReadFromJsonAsync<TriggerTimeseriesUploadResponse>(
81+
useCamelCaseOption
82+
);
7283
logger.LogInformation(
73-
"Successfully uploaded datapoint with name: {Name} and description: {Description} to Timeseries.",
84+
"Successfully uploaded datapoint with name: {Name} and description: {Description} to Timeseries. TimeseriesId: {TimeseriesId}",
7485
uploadRequest.Name,
75-
uploadRequest.Description
86+
uploadRequest.Description,
87+
uploadResponse?.TimeseriesId
7688
);
7789
}
7890
else
7991
{
92+
var errorMessage = await response.Content.ReadAsStringAsync();
8093
logger.LogError(
81-
"Failed to upload datapoint with name: {Name} and description: {Description} to Timeseries.",
94+
"Failed to upload datapoint with name: {Name} and description: {Description} to Timeseries with statusCode: '{StatusCode}' and message: '{Message}'.",
8295
uploadRequest.Name,
83-
uploadRequest.Description
96+
uploadRequest.Description,
97+
response.StatusCode,
98+
errorMessage
8499
);
85100
}
86101
}

0 commit comments

Comments
 (0)