[19.0] endpoint_log: log endpoint calls in database with api_log

Abierto
#190 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
python
Área
api, backend

Línea de trabajo

Start with the open question of which repository should host the module, since that decides the dependency direction. Then read fastapi_log in OCA/rest-framework as the model for the bridge, and look at how ir.http._dispatch receives the functools.partial registered by endpoint_route_handler in web-api. Done means a maintainer has chosen the location and a bridge module logs endpoint calls to api.log, with the migration tracked in OCA/rest-framework#616.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Endpoints currently leave no database record of the calls they receive. The log() helper available to code snippets writes manual messages to ir.logging, and nothing records the request and response themselves.

OCA/rest-framework already provides a generic model for this. api_log stores the URL, method, sanitised headers, body, status, timing and stack trace in api.log, and its api.log_collection.mixin adds a log switch and a Logs button to any model. fastapi_log is the bridge for fastapi.endpoint. The 19.0 migration is OCA/rest-framework#616.

I'd like to contribute an endpoint_log bridge for endpoint.endpoint, and I have a working version for 19.0:

  • endpoint.endpoint inherits api.log_collection.mixin.
  • Logging hooks into ir.http._dispatch, which receives the functools.partial that endpoint_route_handler registers for each route. The endpoint record is resolved from it. The controller is not overridden, because routes call it by its dotted path.
  • Logs are written through a separate cursor, as in fastapi_log, so the logs of failed calls are kept.
  • api_log depends only on web, so the dependency stays light.

Question for maintainers: where should this module live?

  1. In web-api, depending on OCA/rest-framework for api_log.
  2. In rest-framework, next to fastapi_log, depending on web-api for endpoint.

I'd lean towards web-api, since the module is about endpoints, but I'm happy to go either way.

@qrtl QT7417

Assisted-by: Claude Opus 5.5

Lenguaje dominante
Python
Estrellas
49
Forks
124
Merge medio
4 d 13 h
PR fusionados (30 d)
11

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de OCA/web-api

Todos los issues de OCA/web-api

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.