sai chandesh
sai chandesh

Reputation: 91

Integrate airbrake with Python

When I'm trying to integrate python logging with airbrake, I get following errors:

main.py

import pybrake
from config2.config import config

airbrake_handler = None

def filter_airbrake_msgs(notice):
    if config.environment in ['production', 'staging']:
        return notice
    return None


def config_airbrake():
    print(config.py_brake)

    notifier = pybrake.Notifier(
        project_id=config.py_brake.project_id,
        project_key=config.py_brake.project_key
    )

config_airbrake()

ENV=development python3 main.py

Error :

ERROR pybrake get_git_revision failed: [Errno 2] No such file or directory: '/user/xxx/xxx/xxx/.git/HEAD'

Upvotes: 0

Views: 148

Answers (1)

Vladimir Mihailenco
Vladimir Mihailenco

Reputation: 3382

That looks like a log message coming from https://github.com/airbrake/pybrake/blob/master/pybrake/git.py#L12. I see why it is confusing but it is actually harmless and you can ignore it. I've created an issue to remove that log message. And feel free to use Github issues for such questions in future.

Overall pybrake checks if directory stored in context.rootDirectory contains a Git folder. If there is a git folder there it tries to extract some info like git revision, checkout date etc. Otherwise it logs the first error.

Upvotes: 1

Related Questions