USACE / cwms-data-api

Corps Water Management System RESTful Data Service
MIT License
11 stars 14 forks source link

Debugging messages can be difficult to understand #511

Open ktarbet opened 8 months ago

ktarbet commented 8 months ago

Here are some examples trying to save time-series data with an invalid identifier. In some cases debugging required going into the oracle table AT_LOG_MESSAGE. That is not practical for all users/developers.

Invalid ID attempted API Response Server Log Oracle/AT_LOG_MESSAGE
Hartwell.Energy-Sched.Inst.0.1Hour.Raw-source1 status code: 404 {"message":"Not Found.","incidentIdentifier":
"8589911861355292194", "details":{}}
INFO [http-nio-7000-exec-4]
cwms.cda.ApiServlet.lambda$init$10 8589911861355292194: Not Found.
cwms-data-api-data-api-1
cwms.cda.api.errors.NotFoundException: ORA-20998: ERROR: ORA-06512: at "CWMS_20.CWMS_TS", line 1999
ORA-20205: ERROR: Invalid Time Series Description: Hartwell.Energy-Sched.Inst.0.1Hour.Raw-source1 Inst/Cum parameter types cannot have non-zero duration
Hartwell.Storage.Inst.1Hour.0.Raw-source1 status code: 500 {"message":"Internal Error","incidentIdentifier":
"-5846316739419111664","details":{}
ORA-20006: INVALID_PARAM_ID: "Storage" is not a valid CWMS timeseries Parameter ORA-20006: INVALID_PARAM_ID: "Storage" is not a valid CWMS timeseries Parameter
rma-rripken commented 8 months ago

How did you match the ServerLog to the AT_LOG_MESSAGE ? Were those the only error messages or did they line up by time or was there another ID field that connected them?

ktarbet commented 8 months ago

I'm just looking at the last message in both places. Since I'm running in my Docker environment with no other users, it should be accurate.

rma-rripken commented 8 months ago

I believe its accurate - just curious if enough clues were there to automate what you manually did

MikeNeilson commented 8 months ago

It would be possible to automate that, but a royal pain. What's likely happening is that the database is logging a message but then a downstream query is looking for the data that would be saved and then gives a "NOT_FOUND" which is the PL/SQL error thrown when using select into.

The portion of the code that logs the AT_LOG_MESSAGE value should instead (or perhaps with a session setting we can set) raise the error immediately and shortcut further operations. I'll open a database ticket; not hard for any of us to make that change but Mike P might have some insight into doing it cleaning before we just barrel through everything.

ktarbet commented 8 months ago

If some automated tests were done from another language, such as python that would give a fresh, and realistic perspective for future scripting users, and perhaps easier to automate.