|
Post by nanzhou on Jan 27, 2022 23:55:48 GMT
Hello everyone, I have a question on Query Parameters.
Is it valid for a Redfish Service to implement Query Parameters (e.g. $expand) for only a set of Resources, but not all Resources?
I did find in the Spec, a service should return 400 Bad Request status code with the QueryNotSupportedOnResource message for any implemented query parameters that are not supported on a resource in the request.
The intuition is that on OpenBMC community, each resource has different aggregation logics. For example, for $expand on sensor collections, there are efficient ways to query all properties of sensors of a chassis in a single round trip of DBus transactions, which saves a lot time; but for other resources, we might not have an efficient way to implement $expand.
I understand that we can implement a very naive way of handling $expand: before sending back a GET response, we just hold it on and walk through all the members (use sth like a querying queue), and return back the aggregation result. But this only saves HTTP round trips, which doesn't help a lot.
What's the official answer to this? Can a service say it supports $expand in ProtocolFeaturesSupported but only implements $expand in a certain set of resources, and return QueryNotSupportedOnResource otherwise?
Look forward to your reply!
|
|
|
Post by mraineri on Jan 28, 2022 2:03:52 GMT
It's perfectly acceptable to support a query parameter like $expand on some resources and not on other resources. We don't have methods at the moment for showing these restrictions beyond the standard messages you've pointed out. Essentially a client to try a request (after inspecting ProtocolFeaturesSupported), and then the service failing the request on the particular resource that doesn't support it.
So, you can show $expand support in ProtocolFeatureSupported, and return QueryNotSupportedOnResource on the particular resources where $expand is not supported.
|
|
|
Post by nanzhou on Jan 28, 2022 4:06:56 GMT
Thanks. That makes sense.
|
|
|
Post by jautor on Jan 28, 2022 18:51:42 GMT
Yes, there could certainly be cases, especially in aggregators or other multi-provider architectures, where the support for expand or other optional protocol features or query options won't exist for every resource. And while the hope is that in general, the query parameters are supported for all resources, that isn't a requirement.
Note that saving the HTTP(S) round trips can make a difference if a client is making requests across a number of services, but there is certainly a tipping point there.
Jeff
|
|
|
Post by edtanous on Mar 24, 2022 23:07:06 GMT
> Essentially a client to try a request (after inspecting ProtocolFeaturesSupported), and then the service failing the request on the particular resource that doesn't support it.
Per the spec: "Services shall return... The HTTP 501 Not Implemented status code for any unsupported query parameters that start with $ "
This means that a service that doesn't support $expand is required to give an error response, which means that for a generic client that supports multiple implementations, it must first query a given node with $expand, look for the failure, then query without expand, and implement the expand client-side. This adds an additional round trip time to the "slow" case, and has a case where a client is essentially required to cause an error to be returned, which is non-ideal for logging. More importantly, that logic is kinda rough to implement in a client library.
If this is the case where particular collections can make decisions about implementing certain params, I wonder if we'd be better off making the $ parameter and non $ parameter cases the same in the spec:
ie, "... Shall ignore unknown or unsupported query parameters." and just take out any mention of "begin with $".
That way, the client can run a query with expand, if the resource doesn't return the expanded results, the client can determine that pretty easily by looking at the returned results without an extra round trip, and switch to client-side expand. In a perfect world, we could also add "QueryParameterIgnored" to the base registry for the client to key off of so it doesn't even need to look at the tree, and require implementations return that on ignored params.
|
|
|
Post by mraineri on Mar 25, 2022 12:43:23 GMT
The problem is rooted in the fact this behavior was inherited from OData. All of the query parameters beginning with "$" came from OData, and we wanted to preserve the semantics to allow Redfish services to be OData conformant. OData defines all "OData query parameters" to begin with "$", and points to the usage of 501 when a client attempts to use a query parameter that isn't supported.
|
|
|
Post by edtanous on Mar 25, 2022 21:08:07 GMT
Ah, that's an unfortunate series of events, but makes sense.
|
|