azure-sdk-for-net
azure-sdk-for-net copied to clipboard
Azure.AI.AnomalyDetector .NET SDK - Multivariate - Bad formatted dates return Pandas DataFrame error
Library name and version
Azure.AI.AnomalyDetector 3.0.0-preview.5
Describe the bug
When calling the LastDetectAnomalyAsync
method and passing in badly formatted date/time values you receive an error back from the API that does not explain the reason in an understandable way. It appears the internal implementation of the API is leaked back to the client as the error message is from the Pandas DataFrame library - NaTType does not support strftime
.
Detection error. Service request failed. Status: 400 (Bad Request) Content: {"code": "DetectionError", "message": "NaTType does not support strftime"} Headers: x-ms-error-code: REDACTED x-envoy-upstream-service-time: REDACTED apim-request-id: REDACTED Strict-Transport-Security: REDACTED X-Content-Type-Options: REDACTED Date: Tue, 20 Sep 2022 01:52:18 GMT Content-Length: 75 Content-Type: application/json
Expected behavior
A well-formatted and understandable error message is returned. For example: A badly formatted or invalid datetime value or values were supplied to the API
.
Actual behavior
You receive a Pandas error message NaTType does not support strftime
that may make no sense as a .NET developer (I had to search what it meant online).
Reproduction Steps
Assuming a multivariate model with two variables the below should result in the error / bad request.
var readingTimes = new List<string>() { "", "", ""};
var temperatureReadings = new List<float>() { 1.23f, 2.21f, 1.1f };
var humidityReadings = new List<float>() { 1.23f, 2.21f, 1.1f };
var variables = new List<VariableValues>()
{
new VariableValues("temperature", readingTimes, temperatureReadings),
new VariableValues("humidity", readingTimes, humidityReadings)
};
LastDetectionRequest request = new LastDetectionRequest(variables, 10);
LastDetectionResult result = await client.LastDetectAnomalyAsync(modelId, request);
Environment
IDE: VS Code on Windows 11, connected to WSL. Runtime execution happens inside Azure Functions runtime. Also happens when deployed to Azure Functions running on Consumption Plan inside Azure.
.NET SDK (reflecting any global.json): Version: 6.0.201 Commit: ef40e6aa06
Runtime Environment: OS Name: ubuntu OS Version: 20.04 OS Platform: Linux RID: ubuntu.20.04-x64 Base Path: /usr/share/dotnet/sdk/6.0.201/
Label prediction was below confidence level 0.6
for Model:ServiceLabels
: 'Service Bus:0.12029803,Tables:0.11686998,Azure.Core:0.104527004'
Thank you for your feedback. This has been routed to the support team for assistance.
@sjwaight We are looking into it and get back to you for any additional information.
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @yingqunpku, @bowgong.
Issue Details
Library name and version
Azure.AI.AnomalyDetector 3.0.0-preview.5
Describe the bug
When calling the LastDetectAnomalyAsync
method and passing in badly formatted date/time values you receive an error back from the API that does not explain the reason in an understandable way. It appears the internal implementation of the API is leaked back to the client as the error message is from the Pandas DataFrame library - NaTType does not support strftime
.
Detection error. Service request failed. Status: 400 (Bad Request) Content: {"code": "DetectionError", "message": "NaTType does not support strftime"} Headers: x-ms-error-code: REDACTED x-envoy-upstream-service-time: REDACTED apim-request-id: REDACTED Strict-Transport-Security: REDACTED X-Content-Type-Options: REDACTED Date: Tue, 20 Sep 2022 01:52:18 GMT Content-Length: 75 Content-Type: application/json
Expected behavior
A well-formatted and understandable error message is returned. For example: A badly formatted or invalid datetime value or values were supplied to the API
.
Actual behavior
You receive a Pandas error message NaTType does not support strftime
that may make no sense as a .NET developer (I had to search what it meant online).
Reproduction Steps
Assuming a multivariate model with two variables the below should result in the error / bad request.
var readingTimes = new List<string>() { "", "", ""};
var temperatureReadings = new List<float>() { 1.23f, 2.21f, 1.1f };
var humidityReadings = new List<float>() { 1.23f, 2.21f, 1.1f };
var variables = new List<VariableValues>()
{
new VariableValues("temperature", readingTimes, temperatureReadings),
new VariableValues("humidity", readingTimes, humidityReadings)
};
LastDetectionRequest request = new LastDetectionRequest(variables, 10);
LastDetectionResult result = await client.LastDetectAnomalyAsync(modelId, request);
Environment
IDE: VS Code on Windows 11, connected to WSL. Runtime execution happens inside Azure Functions runtime. Also happens when deployed to Azure Functions running on Consumption Plan inside Azure.
.NET SDK (reflecting any global.json): Version: 6.0.201 Commit: ef40e6aa06
Runtime Environment: OS Name: ubuntu OS Version: 20.04 OS Platform: Linux RID: ubuntu.20.04-x64 Base Path: /usr/share/dotnet/sdk/6.0.201/
Author: | sjwaight |
---|---|
Assignees: | SaurabhSharma-MSFT |
Labels: |
|
Milestone: | - |