line / promgen

Promgen is a configuration file generator for Prometheus
https://line.github.io/promgen/
MIT License
1.04k stars 150 forks source link

Prometheus rules seems not generating correctly. #401

Closed konghui closed 1 year ago

konghui commented 1 year ago

Hi: I use docker-compose starting Promgen. After I create a service, project, exporter , rules and farms. The rules seems not generating correctly. I found that the celery didn't receive any jobs. When I turn on the debug. I saw many exceptions about django template render fails. Attachments is the log or the web and worker. It seems the variables pass to the django template is insufficiently. The version I was used is the code on the master branch. worker.log web.log

kfdm commented 1 year ago

Ran out of time today to finish testing, but maybe some of the fixes in #402 will help. I'm not sure why it would be throwing errors in templates though 🤔 What kind of settings are you using ?

The issue of celery not retrieving jobs, is probably a result of the queue names not being correct. Updated the default queue to prometheus,celery to match the container name prometheus.

konghui commented 1 year ago

Thanks very much, It works. I found the exception because turn on the debug log. The option DEBUG=1 only turn on the little debug level logs. If you add this on the settings.py. You will find the error logs which I was find.

LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'handlers': {
        'console': {
            'class': 'logging.StreamHandler',
        },
    },
    'root': {
        'handlers': ['console'],
        'level': "DEBUG" if os.getenv('DEBUG') == "1" else "INFO",
    },
    'loggers': {
        'django': {
            'handlers': ['console'],
            'level': "DEBUG" if os.getenv('DEBUG') == "1" else "INFO",
            'propagate': False,
        },
    },
}