Azure Search: Adding Service Statistics API#2773
Azure Search: Adding Service Statistics API#2773sergey-shandar merged 7 commits intoAzure:masterfrom
Conversation
Automation for azure-sdk-for-goNothing to generate for azure-sdk-for-go |
Automation for azure-sdk-for-nodeNothing to generate for azure-sdk-for-node |
Automation for azure-sdk-for-pythonNothing to generate for azure-sdk-for-python |
Automation for azure-libraries-for-javaNothing to generate for azure-libraries-for-java |
|
FYI @brjohnstmsft |
brjohnstmsft
left a comment
There was a problem hiding this comment.
Let's make sure we're using x-nullable in the right places. Otherwise the changes look good to me.
| "description": "Total number of synonym maps." | ||
| }, | ||
| }, | ||
| "description": "Represents a service level resource counters and quotas." |
There was a problem hiding this comment.
nit: "Represents a service level..." -> "Represents service-level..."
| "maxFieldsPerIndex": { | ||
| "type": "integer", | ||
| "format": "int32", | ||
| "x-nullable": true, |
There was a problem hiding this comment.
All the limits could technically be null and while we could decide to prevent that by populating default values at the service side, I don't think we should.
There was a problem hiding this comment.
If all the limits could be null, then what about maxIndexerRunTime? Shouldn't it be x-nullable too for consistency?
There was a problem hiding this comment.
Are the limits null, or are there no limits? In general, if possible, it is preferable to not have semantically meaningful null values in your REST API.
In this case, what would be the difference in meaning between a null value being sent back from the service, and no maxFieldsPerIndex attribute being included in the response? If there isn't one, my suggestion to not send the key/value pair rather than sending a null value.
There was a problem hiding this comment.
Limits may be null if they don't apply, so I'm keeping them nullable, but I did take your suggestion for counters and removed the 'nullable' from resourceCounter.count.
There was a problem hiding this comment.
@johanste We discussed offline and I agree with Nati that the intent here is to model limits that don't apply ("unlimited") as null, or a missing property. They both end up the same in the client programming model (null property). I don't know offhand whether our REST API will just omit properties with null values, but in either case changing that behavior now would affect our REST API globally, so it's not something we're likely to do.
There was a problem hiding this comment.
Slight correction; the client side programming model will depend on which SDK you are using (if any). The swagger document describes the REST API on the network layer. Anybody who does not use our SDKs (or who are using the "raw" layer of the SDK - the one that doesn't deserialize responses into object models) will be exposed to the "value is null" vs. "key/value is missing" difference. Thus the general recommendation to stick to one way to express missing value (don't send key/value) unless there actually is a difference.
If you could double-check what the service actually does (quite a few will suppress/not send null values) and have the swagger express that, it would be great.
There was a problem hiding this comment.
I have corrected the server side behavior just yesterday, to reflect the following changes:
For ‘Counters’ – ‘usage’ property could never be null. If a certain counter is not applicable (although we don’t have that notion in the real world) we won’t send the counter at all.
For ‘Limits’ – limits with null values are not denoting 'unlimited', but rather the irrelevancy of this limit - this is because the way we use OData, which we are unlikely to change.
These behaviors are already reflected by this PR, so no additional commits are required to realize them.
| "maxFileExtractionSize": { | ||
| "type": "integer", | ||
| "format": "int64", | ||
| "x-nullable": true, |
There was a problem hiding this comment.
Same question... Will the REST API ever return null for any of these limits?
| clear-output-folder: true | ||
| output-folder: $(csharp-sdks-folder)/Search/DataPlane/Microsoft.Azure.Search.Service/Generated | ||
|
|
||
| directive: |
There was a problem hiding this comment.
nit: Let's leave a TODO here to remove this workaround when AutoRest fixes the root cause of the issue. Otherwise, updating this becomes an extra maintenance task whenever we want to add a new resource (e.g. -- skillsets).
|
@natinimni It looks like there's a missing or extra character in the spec file: Please ensure that |
brjohnstmsft
left a comment
There was a problem hiding this comment.
One more x-nullable case to look at
| "maxFieldsPerIndex": { | ||
| "type": "integer", | ||
| "format": "int32", | ||
| "x-nullable": true, |
There was a problem hiding this comment.
If all the limits could be null, then what about maxIndexerRunTime? Shouldn't it be x-nullable too for consistency?
|
Thanks @brjohnstmsft ! maxIndexerRunTime should indeed be nullable :) |
|
@sergey-shandar Are you taking over the review from @johanste? If so, can you please review as soon as possible, as this is blocking our next release? This release includes a fix for a bug that is affecting our customers, so time is of the essence. Thanks! |
|
@olydis are you aware about this Autorest issue? |
| @@ -0,0 +1,43 @@ | |||
| { | |||
| "parameters": { | |||
| "api-version": "2016-09-01-Preview" | |||
There was a problem hiding this comment.
@natinimni could you provide also searchServiceName parameter?
There was a problem hiding this comment.
Hi @sergey-shandar, similarly to all other Azure Search APIs, 'searchServiceName' is taken from the URL path (not a query parameters)...
There was a problem hiding this comment.
@sergey-shandar Please note that this is a data plane API, not an RP.
There was a problem hiding this comment.
Slight correction to what @natinimni said -- The search service name is in the host name, not the URL path (each tenant in Azure Search has their own unique endpoint). I'm not aware of any way to specify such parameters in the example files.
There was a problem hiding this comment.
@natinimni @brjohnstmsft I understand that this parameter is translated to a host name but it's still a parameter and it has to be in examples. AFAIK, there are no exceptions by how the parameter is represented on wire.
There was a problem hiding this comment.
For example
"parameters": {
"api-version": "2016-09-01-Preview",
"searchServiceName": "somevalue"
},There was a problem hiding this comment.
Thanks @sergey-shandar - I've added searchServiceName to all of out API examples, including this one.
|
@sergey-shandar What AutoRest issue are you referring to? |
…xample file. Since this may fail some server validation, only adding it here for now and will add it to the rest of the examples if it works
This checklist is used to make sure that common issues in a pull request are addressed. This will expedite the process of getting your pull request merged and avoid extra work on your part to fix issues discovered during the review process.
PR information
api-versionin the path should match theapi-versionin the spec).Quality of Swagger