Skip to content
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

additional log output: selected query parameters #304

Merged
merged 8 commits into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ Changelog
### Bug Fixes
* Fix bug which prevented some filters (which only work on ContributionView-based queries) to correctly work in contribution extraction endpoints ([#305])

### Other
* Add additional query metrics to log output: the used `filter`, `time` and some stats about the boundary parameter (type, bounding box and area) ([#304])

[#304]: https://github.com/GIScience/ohsome-api/pull/304
[#305]: https://github.com/GIScience/ohsome-api/issues/305


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.heigit.ohsome.ohsomeapi.Application;
import org.heigit.ohsome.ohsomeapi.inputprocessing.InputProcessor;
import org.heigit.ohsome.oshdb.util.geometry.Geo;
import org.heigit.ohsome.oshdb.util.geometry.OSHDBGeometryBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
Expand Down Expand Up @@ -31,6 +34,23 @@ public void afterCompletion(HttpServletRequest request, HttpServletResponse resp
requestUri = request.getRequestURL().toString();
}
logger.info("accessed URI: " + requestUri);
logger.info("query filter: "
+ request.getParameterMap().getOrDefault("filter", new String[] { "<none>" })[0]);
logger.info("query time: "
+ request.getParameterMap().getOrDefault("time", new String[] { "<none>" })[0]);
try {
var inputProcessor = new InputProcessor(request, false, false);
inputProcessor.processParameters();
var boundary = inputProcessor.getGeometry();
var envelope = boundary.getEnvelopeInternal();
var bbox = OSHDBGeometryBuilder.boundingBoxOf(envelope);
logger.info("query boundary type: "
+ inputProcessor.getProcessingData().getBoundaryType().toString());
logger.info("query boundary bbox: " + bbox.toString());
logger.info("query boundary area: " + String.format("%.2f", Geo.areaOf(boundary) / 1E6));
} catch (Exception e) {
logger.info("query boundary: <error while processing request params>");
}
logger.info("processing time: " + (System.currentTimeMillis() - startTime));
logger.info("response code: " + response.getStatus());
}
Expand Down