DylanB95EST | 7c94323 | 2021-09-22 10:38:21 +0100 | [diff] [blame] | 1 | .. This work is licensed under a Creative Commons Attribution 4.0 International License. |
| 2 | .. http://creativecommons.org/licenses/by/4.0 |
DylanB95EST | b130fd3 | 2022-04-04 13:09:22 +0100 | [diff] [blame] | 3 | .. Copyright (C) 2021-2022 Nordix Foundation |
DylanB95EST | 7c94323 | 2021-09-22 10:38:21 +0100 | [diff] [blame] | 4 | |
| 5 | .. DO NOT CHANGE THIS LABEL FOR RELEASE NOTES - EVEN THOUGH IT GIVES A WARNING |
| 6 | .. _adminGuide: |
| 7 | |
| 8 | |
| 9 | CPS Admin Guide |
| 10 | ############### |
| 11 | |
DylanB95EST | 7c94323 | 2021-09-22 10:38:21 +0100 | [diff] [blame] | 12 | .. toctree:: |
| 13 | :maxdepth: 1 |
| 14 | |
sourabh_sourabh | 8cbd81a | 2022-02-01 14:56:02 +0530 | [diff] [blame] | 15 | Logging Configuration |
| 16 | ===================== |
| 17 | |
| 18 | .. note:: |
| 19 | Default logging level of "logging.level.org.onap.cps" is set to "INFO". |
| 20 | |
| 21 | .. code-block:: bash |
| 22 | |
| 23 | logging: |
| 24 | level: |
| 25 | org: |
| 26 | springframework: INFO |
| 27 | onap: |
| 28 | cps: INFO |
| 29 | |
| 30 | CPS Log pattern |
| 31 | --------------- |
| 32 | |
Cédric Ollivier | 490b20d | 2023-03-15 21:40:48 +0100 | [diff] [blame] | 33 | .. code-block:: |
sourabh_sourabh | 8cbd81a | 2022-02-01 14:56:02 +0530 | [diff] [blame] | 34 | |
| 35 | <pattern> |
emaclee | b176de2 | 2022-08-31 15:53:10 +0100 | [diff] [blame] | 36 | { |
lukegleeson | 4a34fa5 | 2022-09-19 15:31:59 +0100 | [diff] [blame] | 37 | "logTimeStamp" : "%timestamp", // 2022-01-28 18:39:17.768 |
| 38 | "logLevel": "%level", // DEBUG |
| 39 | "principalId": "%userId", // cpsuser |
| 40 | "serviceName": "${springAppName}", // cps-application |
| 41 | "message":"%message", // Execution time ... |
| 42 | "processId": "${PID}", //11128 |
| 43 | "threadName": "%thread", //tp1901272535-29 |
emaclee | b176de2 | 2022-08-31 15:53:10 +0100 | [diff] [blame] | 44 | "class": "%logger{40}", .// o.onap.cps.aop.CpsLoggingAspectService |
emaclee | b176de2 | 2022-08-31 15:53:10 +0100 | [diff] [blame] | 45 | } |
sourabh_sourabh | 8cbd81a | 2022-02-01 14:56:02 +0530 | [diff] [blame] | 46 | </pattern> |
| 47 | |
| 48 | Change logging level |
| 49 | -------------------- |
| 50 | |
sourabh_sourabh | 8cbd81a | 2022-02-01 14:56:02 +0530 | [diff] [blame] | 51 | - Curl command 1. Check current log level of "logging.level.org.onap.cps" if it is set to it's default value (INFO) |
| 52 | |
Cédric Ollivier | 490b20d | 2023-03-15 21:40:48 +0100 | [diff] [blame] | 53 | .. code-block:: bash |
sourabh_sourabh | 8cbd81a | 2022-02-01 14:56:02 +0530 | [diff] [blame] | 54 | |
mpriyank | 02b2d2a | 2023-10-25 12:23:10 +0100 | [diff] [blame] | 55 | curl --location --request GET 'http://{cps-service-name:cps-port}/actuator/loggers/org.onap.cps' \ |
sourabh_sourabh | 8cbd81a | 2022-02-01 14:56:02 +0530 | [diff] [blame] | 56 | --header 'Content-Type: application/json; charset=utf-8' |
| 57 | |
| 58 | Response body : HTTP Status 200 |
| 59 | |
| 60 | { |
| 61 | "configuredLevel": "INFO", |
| 62 | "effectiveLevel": "INFO" |
| 63 | } |
| 64 | |
emaclee | b176de2 | 2022-08-31 15:53:10 +0100 | [diff] [blame] | 65 | |
sourabh_sourabh | 8cbd81a | 2022-02-01 14:56:02 +0530 | [diff] [blame] | 66 | - Curl command 2. Change logging level of "logging.level.org.onap.cps" to "DEBUG" |
| 67 | |
| 68 | .. note:: |
| 69 | Below-mentioned endpoint will change the log level at runtime. After executing the curl command "effectiveLevel" will set and applied immediately without restarting CPS service. |
| 70 | |
Cédric Ollivier | 490b20d | 2023-03-15 21:40:48 +0100 | [diff] [blame] | 71 | .. code-block:: bash |
sourabh_sourabh | 8cbd81a | 2022-02-01 14:56:02 +0530 | [diff] [blame] | 72 | |
mpriyank | 02b2d2a | 2023-10-25 12:23:10 +0100 | [diff] [blame] | 73 | curl --location --request POST 'http://{cps-service-name:cps-port}/actuator/loggers/org.onap.cps' \ |
sourabh_sourabh | 8cbd81a | 2022-02-01 14:56:02 +0530 | [diff] [blame] | 74 | --header 'Content-Type: application/json; charset=utf-8' \ |
| 75 | --data-raw '{ |
| 76 | "configuredLevel": "DEBUG" |
| 77 | }' |
| 78 | |
| 79 | Response body : HTTP Status 204 |
| 80 | |
| 81 | - Curl command 3. Verify if log level of "logging.level.org.onap.cps" is changed from 'INFO' to 'DEBUG' |
| 82 | |
Cédric Ollivier | 490b20d | 2023-03-15 21:40:48 +0100 | [diff] [blame] | 83 | .. code-block:: bash |
sourabh_sourabh | 8cbd81a | 2022-02-01 14:56:02 +0530 | [diff] [blame] | 84 | |
mpriyank | 02b2d2a | 2023-10-25 12:23:10 +0100 | [diff] [blame] | 85 | curl --location --request GET 'http://{cps-service-name:cps-port}/actuator/loggers/org.onap.cps' \ |
sourabh_sourabh | 8cbd81a | 2022-02-01 14:56:02 +0530 | [diff] [blame] | 86 | --header 'Content-Type: application/json; charset=utf-8' |
| 87 | |
| 88 | Response body : HTTP Status 200 |
| 89 | |
| 90 | { |
| 91 | "configuredLevel": "DEBUG", |
| 92 | "effectiveLevel": "DEBUG" |
| 93 | } |
| 94 | |
emaclee | b176de2 | 2022-08-31 15:53:10 +0100 | [diff] [blame] | 95 | |
sourabh_sourabh | 8cbd81a | 2022-02-01 14:56:02 +0530 | [diff] [blame] | 96 | Location of log files |
| 97 | --------------------- |
| 98 | By default, Spring Boot will only log to the console and will not write log files. |
| 99 | |
| 100 | .. image:: images/cps-service-console.JPG |
| 101 | :width: 700 |
| 102 | :alt: CPS service console |
| 103 | |
| 104 | Measure Execution Time of CPS Service |
| 105 | ------------------------------------- |
| 106 | |
| 107 | .. note:: |
| 108 | Make sure effective log level of "logging.level.org.onap.cps" is 'DEBUG'. This can be verified by executing curl command 3. |
| 109 | |
| 110 | Execute CPS service that you want to calculate total elapsed time and log as shown below |
| 111 | |
Cédric Ollivier | 490b20d | 2023-03-15 21:40:48 +0100 | [diff] [blame] | 112 | .. code-block:: |
sourabh_sourabh | 8cbd81a | 2022-02-01 14:56:02 +0530 | [diff] [blame] | 113 | |
| 114 | 2022-01-28 18:39:17.679 DEBUG [cps-application,e17da1571e518c59,e17da1571e518c59] 11128 --- [tp1901272535-29] o.onap.cps.aop.CpsLoggingAspectService : Execution time of : DataspaceRepository.getByName() with argument[s] = [test42] having result = org.onap.cps.spi.entities.DataspaceEntity@68ded236 :: 205 ms |
| 115 | |
| 116 | 2022-01-28 18:39:17.726 DEBUG [cps-application,e17da1571e518c59,e17da1571e518c59] 11128 --- [tp1901272535-29] o.onap.cps.aop.CpsLoggingAspectService : Execution time of : AnchorRepository.getByDataspaceAndName() with argument[s] = [org.onap.cps.spi.entities.DataspaceEntity@68ded236, bookstore] having result = org.onap.cps.spi.entities.AnchorEntity@71c47fb1 :: 46 ms |
| 117 | |
| 118 | 2022-01-28 18:39:17.768 DEBUG [cps-application,e17da1571e518c59,e17da1571e518c59] 11128 --- [tp1901272535-29] o.onap.cps.aop.CpsLoggingAspectService : Execution time of : CpsAdminPersistenceServiceImpl.getAnchor() with argument[s] = [test42, bookstore] having result = Anchor(name=bookstore, dataspaceName=test42, schemaSetName=bookstore) :: 299 ms |
| 119 | |
| 120 | 2022-01-28 18:39:17.768 DEBUG [cps-application,e17da1571e518c59,e17da1571e518c59] 11128 --- [tp1901272535-29] o.onap.cps.aop.CpsLoggingAspectService : Execution time of : CpsAdminServiceImpl.getAnchor() with argument[s] = [test42, bookstore] having result = Anchor(name=bookstore, dataspaceName=test42, schemaSetName=bookstore) :: 305 ms |
| 121 | |
| 122 | 2022-01-28 18:39:17.843 DEBUG [cps-application,e17da1571e518c59,e17da1571e518c59] 11128 --- [tp1901272535-29] o.onap.cps.aop.CpsLoggingAspectService : Execution time of : AdminRestController.getAnchor() with argument[s] = [test42, bookstore] having result = <200 OK OK,class AnchorDetails { |
| 123 | name: bookstore |
| 124 | dataspaceName: test42 |
| 125 | schemaSetName: bookstore |
| 126 | },[]> :: 419 ms |
| 127 | |
| 128 | .. warning:: |
| 129 | Revert logging level of "logging.level.org.onap.cps" to 'INFO' again to prevent unnecessary logging and impacts on performance. |
| 130 | |
ToineSiebelink | 3920785 | 2021-10-21 12:11:25 +0100 | [diff] [blame] | 131 | .. Below Label is used by documentation for other CPS components to link here, do not remove even if it gives a warning |
| 132 | .. _cps_common_logging: |
| 133 | |
DylanB95EST | 7c94323 | 2021-09-22 10:38:21 +0100 | [diff] [blame] | 134 | Logging & Diagnostics |
| 135 | ===================== |
lukegleeson | a0f97c1 | 2021-09-28 12:24:07 +0100 | [diff] [blame] | 136 | |
| 137 | General Guidelines |
| 138 | ------------------ |
emaclee | b176de2 | 2022-08-31 15:53:10 +0100 | [diff] [blame] | 139 | |
lukegleeson | a0f97c1 | 2021-09-28 12:24:07 +0100 | [diff] [blame] | 140 | CPS-Core logs are sent to `STDOUT` in order to leverage the Kubernetes logging architecture. |
| 141 | |
| 142 | These logs are available using the following command: |
| 143 | |
| 144 | .. code:: bash |
| 145 | |
| 146 | kubectl logs <cps-core-pod> |
| 147 | |
| 148 | The default configuration for CPS logs is the INFO level. |
| 149 | |
| 150 | This architecture also makes all logs ready to be sent to an Elastic-search Log-stash and Kibana (ELK) stack or similar. |
| 151 | |
| 152 | Enabling tracing for all executed sql statements is done by changing hibernate |
| 153 | loggers log level |
| 154 | |
| 155 | Logger configuration is provided as a chart resource : |
| 156 | |
mpriyank | b673b54 | 2022-11-09 09:36:24 +0000 | [diff] [blame] | 157 | +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ |
| 158 | | cps-component-service-name | logback.xml location | |
| 159 | +================================+===============================================================================================================================================+ |
| 160 | | cps-core | `logback-spring.xml <https://github.com/onap/oom/blob/master/kubernetes/cps/components/cps-core/resources/config/logback-spring.xml>`__ | |
| 161 | +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ |
| 162 | | cps-temporal | `logback.xml <https://github.com/onap/oom/blob/master/kubernetes/cps/components/cps-temporal/resources/config/logback.xml>`__ | |
| 163 | +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ |
| 164 | | ncmp-dmi-plugin | Not yet applicable to DMI-Plugin | |
| 165 | +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ |
lukegleeson | a0f97c1 | 2021-09-28 12:24:07 +0100 | [diff] [blame] | 166 | |
ToineSiebelink | 3920785 | 2021-10-21 12:11:25 +0100 | [diff] [blame] | 167 | .. Below Label is used by documentation for other CPS components to link here, do not remove even if it gives a warning |
| 168 | .. _cps_common_monitoring: |
| 169 | |
lukegleeson | a0f97c1 | 2021-09-28 12:24:07 +0100 | [diff] [blame] | 170 | Monitoring |
| 171 | ========== |
| 172 | Once CPS-Core is deployed, information related to the running instance of the application is available |
| 173 | |
| 174 | .. code:: |
| 175 | |
mpriyank | 02b2d2a | 2023-10-25 12:23:10 +0100 | [diff] [blame] | 176 | http://<cps-component-service-name>:8080/actuator/info/ |
lukegleeson | a0f97c1 | 2021-09-28 12:24:07 +0100 | [diff] [blame] | 177 | |
| 178 | Health |
| 179 | ------ |
| 180 | |
| 181 | Cps-Core health status and state can be checked using the following endpoint. |
| 182 | This also includes both the liveliness state and readiness state. |
| 183 | |
| 184 | .. code:: |
| 185 | |
mpriyank | 02b2d2a | 2023-10-25 12:23:10 +0100 | [diff] [blame] | 186 | http://<cps-component-service-name>:8080/actuator/health/ |
lukegleeson | a0f97c1 | 2021-09-28 12:24:07 +0100 | [diff] [blame] | 187 | |
| 188 | Metrics |
| 189 | ------- |
| 190 | |
| 191 | Prometheus Metrics can be checked at the following endpoint |
| 192 | |
| 193 | .. code:: |
| 194 | |
mpriyank | 02b2d2a | 2023-10-25 12:23:10 +0100 | [diff] [blame] | 195 | http://<cps-component-service-name>:8080/actuator/prometheus |
DylanB95EST | b130fd3 | 2022-04-04 13:09:22 +0100 | [diff] [blame] | 196 | |
| 197 | Naming Validation |
| 198 | ----------------- |
| 199 | |
lukegleeson | 4a34fa5 | 2022-09-19 15:31:59 +0100 | [diff] [blame] | 200 | As part of the Kohn 3.1.0 release, CPS has added validation to the names of the following components: |
DylanB95EST | b130fd3 | 2022-04-04 13:09:22 +0100 | [diff] [blame] | 201 | |
| 202 | - Dataspace names |
| 203 | - Schema Set names |
| 204 | - Anchor names |
| 205 | - Cm-Handle identifiers |
| 206 | |
| 207 | The following characters along with spaces are no longer valid for naming of these components. |
| 208 | |
| 209 | .. code:: |
| 210 | |
| 211 | !"#$%&'()*+,./\:;<=>?@[]^`{|}~ |