-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Azure Search: Adding Service Statistics API #2773
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
f156bd9
c05ada6
6ad0570
d8d72d8
3111b3c
79c34b8
8bb30f1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| { | ||
| "parameters": { | ||
| "searchServiceName": "myservice", | ||
| "api-version": "2016-09-01-Preview" | ||
| }, | ||
| "responses": { | ||
| "200": { | ||
| "body": { | ||
| "counters": { | ||
| "documentCount": { | ||
| "usage": 7093, | ||
| "quota": 10000 | ||
| }, | ||
| "indexesCount": { | ||
| "usage": 3, | ||
| "quota": 3 | ||
| }, | ||
| "indexersCount": { | ||
| "usage": 3, | ||
| "quota": 3 | ||
| }, | ||
| "dataSourcesCount": { | ||
| "usage": 1, | ||
| "quota": 3 | ||
| }, | ||
| "storageSize": { | ||
| "usage": 914529, | ||
| "quota": 52428800 | ||
| }, | ||
| "synonymMaps": { | ||
| "usage": 2, | ||
| "quota": 3 | ||
| } | ||
| }, | ||
| "limits": { | ||
| "maxFieldsPerIndex": 1000, | ||
| "maxIndexerRunTime": "PT1M", | ||
| "maxFileExtractionSize": 16777216, | ||
| "maxFileContentCharactersToExtract": 32768 | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| { | ||
| "parameters": { | ||
| "searchServiceName": "myservice", | ||
| "api-version": "2016-09-01-Preview" | ||
| }, | ||
| "responses": { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| { | ||
| "parameters": { | ||
| "searchServiceName": "myservice", | ||
| "api-version": "2016-09-01-Preview" | ||
| }, | ||
| "responses": { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| { | ||
| "parameters": { | ||
| "searchServiceName": "myservice", | ||
| "$select": "name", | ||
| "api-version": "2016-09-01-Preview" | ||
| }, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| { | ||
| "parameters": { | ||
| "searchServiceName": "myservice", | ||
| "api-version": "2016-09-01-Preview" | ||
| }, | ||
| "responses": { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1094,6 +1094,35 @@ | |
| } | ||
| } | ||
| } | ||
| }, | ||
| "/servicestats": { | ||
| "get": { | ||
| "tags": [ | ||
| "Service" | ||
| ], | ||
| "operationId": "GetServiceStatistics", | ||
| "x-ms-examples": { | ||
| "SearchServiceGetServiceStatistics": { "$ref": "./examples/SearchServiceGetServiceStatistics.json" } | ||
| }, | ||
| "description": "Gets service level statistics for an Azure Search service.", | ||
| "parameters": [ | ||
| { | ||
| "$ref": "#/parameters/ClientRequestIdParameter" | ||
| }, | ||
| { | ||
| "$ref": "#/parameters/ApiVersionParameter" | ||
| } | ||
| ], | ||
| "x-ms-request-id": "request-id", | ||
| "responses": { | ||
| "200": { | ||
| "description": "", | ||
| "schema": { | ||
| "$ref": "#/definitions/ServiceStatistics" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "definitions": { | ||
|
|
@@ -3957,6 +3986,112 @@ | |
| } | ||
| }, | ||
| "description": "Response from a List SynonymMaps request. If successful, it includes the full definitions of all synonym maps." | ||
| }, | ||
| "ServiceStatistics": { | ||
| "properties": { | ||
| "counters": { | ||
| "$ref": "#/definitions/ServiceCounters", | ||
| "description": "Service level resource counters." | ||
| }, | ||
| "limits": { | ||
| "$ref": "#/definitions/ServiceLimits", | ||
| "description": "Service level general limits." | ||
| } | ||
| }, | ||
| "description": "Response from a get service statistics request. If successful, it includes service level counters and limits." | ||
| }, | ||
| "ServiceCounters": { | ||
| "properties": { | ||
| "documentCount": { | ||
| "x-ms-client-name": "documentCounter", | ||
| "$ref": "#/definitions/ResourceCounter", | ||
| "description": "Total number of documents across all indexes in the service." | ||
| }, | ||
| "indexesCount": { | ||
| "x-ms-client-name": "indexCounter", | ||
| "$ref": "#/definitions/ResourceCounter", | ||
| "description": "Total number of indexes." | ||
| }, | ||
| "indexersCount": { | ||
| "x-ms-client-name": "indexerCounter", | ||
| "$ref": "#/definitions/ResourceCounter", | ||
| "description": "Total number of indexers." | ||
| }, | ||
| "dataSourcesCount": { | ||
| "x-ms-client-name": "dataSourceCounter", | ||
| "$ref": "#/definitions/ResourceCounter", | ||
| "description": "Total number of data sources." | ||
| }, | ||
| "storageSize": { | ||
| "x-ms-client-name": "storageSizeCounter", | ||
| "$ref": "#/definitions/ResourceCounter", | ||
| "description": "Total size of used storage in bytes." | ||
| }, | ||
| "synonymMaps": { | ||
| "x-ms-client-name": "synonymMapCounter", | ||
| "$ref": "#/definitions/ResourceCounter", | ||
| "description": "Total number of synonym maps." | ||
| } | ||
| }, | ||
| "description": "Represents service-level resource counters and quotas." | ||
| }, | ||
| "ServiceLimits": { | ||
| "properties": { | ||
| "maxFieldsPerIndex": { | ||
| "type": "integer", | ||
| "format": "int32", | ||
| "x-nullable": true, | ||
| "description": "The maximum allowed fields per index." | ||
| }, | ||
| "maxIndexerRunTime": { | ||
| "type": "string", | ||
| "format": "duration", | ||
| "x-nullable": true, | ||
| "description": "The maximum time an indexer will run in a single execution. In the next run, indexing will resume at the point where it stopped." | ||
| }, | ||
| "maxFileExtractionSize": { | ||
| "type": "integer", | ||
| "format": "int64", | ||
| "x-nullable": true, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same question... Will the REST API ever return null for any of these limits? |
||
| "description": "When using a blob indexer, if the size in bytes of a blob's content is larger than this size, it results in an error." | ||
| }, | ||
| "maxFileContentCharactersToExtract": { | ||
| "type": "integer", | ||
| "format": "int32", | ||
| "x-nullable": true, | ||
| "description": "The maximum number of characters extracted from a blob when using a blob indexer. If a blob has more content, it is not indexed and a warning is added to the indexer execution result." | ||
| }, | ||
| "maxFieldNestingDepthPerIndex": { | ||
| "type": "integer", | ||
| "format": "int32", | ||
| "x-nullable": true, | ||
| "description": "The maximum depth which you can nest sub-fields in an index, including the top-level complex field. For example, a/b/c has a nesting depth of 3." | ||
| }, | ||
| "maxComplexCollectionFieldsPerIndex": { | ||
| "type": "integer", | ||
| "format": "int32", | ||
| "x-nullable": true, | ||
| "description": "The maximum number of fields of type Collection(Edm.ComplexType) allowed in an index." | ||
| } | ||
| }, | ||
| "description": "Represents various service level limits." | ||
| }, | ||
| "ResourceCounter": { | ||
| "properties": { | ||
| "usage": { | ||
| "type": "integer", | ||
| "format": "int64", | ||
| "x-nullable": false, | ||
| "description": "The resource usage amount." | ||
| }, | ||
| "quota": { | ||
| "type": "integer", | ||
| "format": "int64", | ||
| "x-nullable": true, | ||
| "description": "The resource amount quota." | ||
| } | ||
| }, | ||
| "description": "Represents a resource's usage and quota." | ||
| } | ||
| }, | ||
| "parameters": { | ||
|
|
@@ -4027,4 +4162,4 @@ | |
| "x-ms-parameter-location": "client" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -83,4 +83,19 @@ csharp: | |
| namespace: Microsoft.Azure.Search | ||
| clear-output-folder: true | ||
| output-folder: $(csharp-sdks-folder)/Search/DataPlane/Microsoft.Azure.Search.Service/Generated | ||
|
|
||
| directive: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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).
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @sergey-shandar signoff on that part 👍 |
||
| # TODO: remove this workaround once AutoRest fixes the incorrect code generation when using a parameterized host and both client and operation groups paths. | ||
| - from: source-file-csharp | ||
| where: $ | ||
| transform: > | ||
| if ( $.includes("class DataSourcesOperations") || $.includes("class IndexersOperations") || | ||
| $.includes("class IndexesOperations") || $.includes("class SynonymMapsOperations") ) | ||
|
|
||
| return $. | ||
| replace(/this.SearchServiceName/g,"Client.SearchServiceName"). | ||
| replace(/this.SearchDnsSuffix/g,"Client.SearchDnsSuffix"). | ||
| replace(/\"Client.SearchServiceName\"/g,"\"this.Client.SearchServiceName\""). | ||
| replace(/\"Client.SearchDnsSuffix\"/g,"\"this.Client.SearchDnsSuffix\""); | ||
| return $; | ||
| ``` | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this really be null?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If all the limits could be null, then what about
maxIndexerRunTime? Shouldn't it bex-nullabletoo for consistency?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.