Azure / azure-sdk-for-go

This repository is for active development of the Azure SDK for Go. For consumers of the SDK we recommend visiting our public developer docs at:
https://docs.microsoft.com/azure/developer/go/
MIT License
1.64k stars 838 forks source link

func (client *ProactiveDetectionConfigurationsClient) List return an array with each item properties are nil #23464

Open AmitOttenheimer opened 1 month ago

AmitOttenheimer commented 1 month ago

Hey, I am using the function: func (client *ProactiveDetectionConfigurationsClient) List(ctx context.Context, resourceGroupName string, resourceName string, ...) (ProactiveDetectionConfigurationsClientListResponse, error) and I am receiving the array with the proper item number but each item has every property set to the default value, I saw that the problem was inside the function: func (client ProactiveDetectionConfigurationsClient) listHandleResponse(resp http.Response) (ProactiveDetectionConfigurationsClientListResponse, error)

with in the UnmarshalAsJSON

I am using this version: v1.2.0

thank you very much!

jhendrixMSFT commented 1 month ago

Can you please elaborate on the problem with the call to UnmarshalAsJSON?

AmitOttenheimer commented 1 month ago

yes. i saw that the body is being returned as expected, the configuration is accurate and the there is a call to the UnmarshalAsJSON function to return the json data as an object but the UnmarshalAsJSON function return the array with each item properties set to be nil

AmitOttenheimer commented 3 days ago

Hey @jhendrixMSFT Is there any update ?

jhendrixMSFT commented 2 days ago

Can you please provide a sample body that's failing to incorrectly unmarshal? Logging will make this easier, although you'll need to explicitly enable logging request/response bodies.

github-actions[bot] commented 2 days ago

Hi @AmitOttenheimer. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.

AmitOttenheimer commented 2 days ago

Hey, this is sample body that is failing to unmarshal:

[
  {
    "name": "slowpageloadtime",
    "ruleDefinitions": {
      "Name": "slowpageloadtime",
      "DisplayName": "Slow page load time",
      "Description": "Smart Detection rules notify you of performance anomaly issues.",
      "HelpUrl": "https://docs.microsoft.com/en-us/azure/application-insights/app-insights-proactive-performance-diagnostics",
      "IsHidden": false,
      "IsEnabledByDefault": true,
      "IsInPreview": false,
      "SupportsEmailNotifications": true
    },
    "enabled": true,
    "sendEmailsToSubscriptionOwners": true,
    "customEmails": [],
    "lastUpdatedTime": null
  },
  {
    "name": "slowserverresponsetime",
    "ruleDefinitions": {
      "Name": "slowserverresponsetime",
      "DisplayName": "Slow server response time",
      "Description": "Smart Detection rules notify you of performance anomaly issues.",
      "HelpUrl": "https://docs.microsoft.com/en-us/azure/application-insights/app-insights-proactive-performance-diagnostics",
      "IsHidden": false,
      "IsEnabledByDefault": true,
      "IsInPreview": false,
      "SupportsEmailNotifications": true
    },
    "enabled": true,
    "sendEmailsToSubscriptionOwners": true,
    "customEmails": [],
    "lastUpdatedTime": null
  },
  {
    "name": "longdependencyduration",
    "ruleDefinitions": {
      "Name": "longdependencyduration",
      "DisplayName": "Long dependency duration",
      "Description": "Smart Detection rules notify you of performance anomaly issues.",
      "HelpUrl": "https://docs.microsoft.com/en-us/azure/application-insights/app-insights-proactive-performance-diagnostics",
      "IsHidden": false,
      "IsEnabledByDefault": true,
      "IsInPreview": false,
      "SupportsEmailNotifications": true
    },
    "enabled": true,
    "sendEmailsToSubscriptionOwners": true,
    "customEmails": [],
    "lastUpdatedTime": null
  },
  {
    "name": "degradationinserverresponsetime",
    "ruleDefinitions": {
      "Name": "degradationinserverresponsetime",
      "DisplayName": "Degradation in server response time",
      "Description": "Smart Detection rules notify you of performance anomaly issues.",
      "HelpUrl": "https://docs.microsoft.com/en-us/azure/application-insights/app-insights-proactive-performance-diagnostics",
      "IsHidden": false,
      "IsEnabledByDefault": true,
      "IsInPreview": false,
      "SupportsEmailNotifications": true
    },
    "enabled": true,
    "sendEmailsToSubscriptionOwners": true,
    "customEmails": [],
    "lastUpdatedTime": null
  },
  {
    "name": "degradationindependencyduration",
    "ruleDefinitions": {
      "Name": "degradationindependencyduration",
      "DisplayName": "Degradation in dependency duration",
      "Description": "Smart Detection rules notify you of performance anomaly issues.",
      "HelpUrl": "https://docs.microsoft.com/en-us/azure/application-insights/app-insights-proactive-performance-diagnostics",
      "IsHidden": false,
      "IsEnabledByDefault": true,
      "IsInPreview": false,
      "SupportsEmailNotifications": true
    },
    "enabled": true,
    "sendEmailsToSubscriptionOwners": true,
    "customEmails": [],
    "lastUpdatedTime": null
  },
  {
    "name": "extension_traceseveritydetector",
    "ruleDefinitions": {
      "Name": "extension_traceseveritydetector",
      "DisplayName": "Degradation in trace severity ratio (preview)",
      "Description": "This detection rule automatically analyzes the trace logs emitted from your application, and can warn you about unusual patterns in the severity of your trace telemetry.",
      "HelpUrl": "https://github.com/Microsoft/ApplicationInsights-Home/blob/master/SmartDetection/degradation-in-trace-severity-ratio.md",
      "IsHidden": false,
      "IsEnabledByDefault": true,
      "IsInPreview": true,
      "SupportsEmailNotifications": false
    },
    "enabled": true,
    "sendEmailsToSubscriptionOwners": true,
    "customEmails": [],
    "lastUpdatedTime": null
  },
  {
    "name": "extension_exceptionchangeextension",
    "ruleDefinitions": {
      "Name": "extension_exceptionchangeextension",
      "DisplayName": "Abnormal rise in exception volume (preview)",
      "Description": "This detection rule automatically analyzes the exceptions thrown in your application, and can warn you about unusual patterns in your exception telemetry.",
      "HelpUrl": "https://github.com/Microsoft/ApplicationInsights-Home/blob/master/SmartDetection/abnormal-rise-in-exception-volume.md",
      "IsHidden": false,
      "IsEnabledByDefault": true,
      "IsInPreview": true,
      "SupportsEmailNotifications": false
    },
    "enabled": true,
    "sendEmailsToSubscriptionOwners": true,
    "customEmails": [],
    "lastUpdatedTime": null
  },
  {
    "name": "extension_memoryleakextension",
    "ruleDefinitions": {
      "Name": "extension_memoryleakextension",
      "DisplayName": "Potential memory leak detected (preview)",
      "Description": "This detection rule automatically analyzes the memory consumption of each process in your application, and can warn you about potential memory leaks or increased memory consumption.",
      "HelpUrl": "https://github.com/Microsoft/ApplicationInsights-Home/tree/master/SmartDetection/memory-leak.md",
      "IsHidden": false,
      "IsEnabledByDefault": true,
      "IsInPreview": true,
      "SupportsEmailNotifications": false
    },
    "enabled": true,
    "sendEmailsToSubscriptionOwners": true,
    "customEmails": [],
    "lastUpdatedTime": null
  },
  {
    "name": "extension_securityextensionspackage",
    "ruleDefinitions": {
      "Name": "extension_securityextensionspackage",
      "DisplayName": "Potential security issue detected (preview)",
      "Description": "This detection rule automatically analyzes the telemetry generated by your application and detects potential security issues.",
      "HelpUrl": "https://github.com/Microsoft/ApplicationInsights-Home/blob/master/SmartDetection/application-security-detection-pack.md",
      "IsHidden": false,
      "IsEnabledByDefault": true,
      "IsInPreview": true,
      "SupportsEmailNotifications": false
    },
    "enabled": true,
    "sendEmailsToSubscriptionOwners": true,
    "customEmails": [],
    "lastUpdatedTime": null
  },
  {
    "name": "extension_billingdatavolumedailyspikeextension",
    "ruleDefinitions": {
      "Name": "extension_billingdatavolumedailyspikeextension",
      "DisplayName": "Abnormal rise in daily data volume (preview)",
      "Description": "This detection rule automatically analyzes the billing data generated by your application, and can warn you about an unusual increase in your application's billing costs",
      "HelpUrl": "https://github.com/Microsoft/ApplicationInsights-Home/tree/master/SmartDetection/billing-data-volume-daily-spike.md",
      "IsHidden": false,
      "IsEnabledByDefault": true,
      "IsInPreview": true,
      "SupportsEmailNotifications": false
    },
    "enabled": true,
    "sendEmailsToSubscriptionOwners": true,
    "customEmails": [],
    "lastUpdatedTime": null
  }
]
jhendrixMSFT commented 1 day ago

Thanks, this was helpful.

The swagger definition for this type doesn't match what's sent over the wire. Specifically, the swagger specifies the fields as pascal-cased when they're actually camel-cased.

Interesting to note that this specific API is from 2015-05-01 so either it's been broken for many years, or it broke in the latest beta version of the service.

@lirenhe can you please follow up with the team that owns this swagger so they can investigate?

github-actions[bot] commented 1 day ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @azmonapplicationinsights.