feat: improve Soil Data Access metrics for soilDB usage #420
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a more granular "SDA Query application" header comment to SDA queries following Phil Anzel's proposal for CART application. Low-level queries via
SDA_query(), with no specific application context, already have the soilDB R package version included in the HTTP User-Agent header when POSTing queries.To prevent having to put boilerplate handling into the many functions that call
SDA_query(), I added simple logic to SDA_query itself to determine the calling environment. This will allow us to create comments that uniquely capture bare calls of SDA_query, user-defined functions, and functions defined in R packages. If we want to provide a great deal more specific info we may need to add custom handling, possibly via a new argument to pass query metadata to SDA_query.TODO:
Handling of highest-level functions that run many queries (e.g.
fetchLDM(),fetchSDA()) will result in several queries being generated each with their own comment. Some queries then may be associated with the top level fetch* function and some will be associated with lower-level get* or other internal functions.cc: @jneme910