コード例 #1
0
    def get(self, app_name, unique_hash):
        import cgi

        app, app_name = self._global(app_name)

        exception_group = LoggingService.get_exception_group(unique_hash)

        lh_memberships = LighthouseService.get_project_memberships(
                                    app['lighthouse_project_id']
                         )

        members = []
        for member in lh_memberships:
            members.append(
                    {
                        'name': member['membership']['user']['name'],
                        'id': member['membership']['user']['id']
                    }
            )

        self._data['exception_group'] = exception_group
        self._data['unique_hash'] = unique_hash
        self._data['htmlTitle'] = 'OnErrorLog - Create Lighthouse Ticket'
        self._data['section_title'] = '%s : %s' % (app['application'], self._data['exception_group']['message'][0:60])
        self._data['cgi'] = cgi
        self._data['members'] = members

        self.write(self.render_view('../Views/lighthouse.html', self._data))
コード例 #2
0
    def get(self, app_name, unique_hash):

        self.tree_dict = {}

        app, app_name = self._global(app_name)

        exception_group = LoggingService.get_exception_group(unique_hash)
        exceptions = LoggingService.gex_exceptions_in_group(unique_hash)

        stats_data = {'today': [], 'previous': []}

        stats = LoggingService.get_statistics_for_exception_group(exception_group['_id'])
        for i, s in enumerate(stats):
            stats_data['today'].append([i, s['count']])

        stats = LoggingService.get_statistics_for_exception_group(exception_group['_id'], days_back=1)
        for i, s in enumerate(stats):
            stats_data['previous'].append([i, s['count']])

        self._data['stats_data'] = stats_data
        self._data['exception_group'] = exception_group
        self._data['exceptions'] = exceptions
        self._data['unique_hash'] = unique_hash
        self._data['get_severity_string'] = LoggingService.get_severity_string
        self._data['section_title'] = '%s : %s' % (app['application'], self._data['exception_group']['message'][0:60])
        self._data['htmlTitle'] = 'OnErrorLog - Dashboard'
        self._data['cgi'] = cgi

        self.write(self.render_view('../Views/details.html', self._data))
コード例 #3
0
ファイル: DashboardHandler.py プロジェクト: vpetro/OnErrorLog
    def get(self, app_name, unique_hash):

        self.tree_dict = {}

        app, app_name = self._global(app_name)

        import cgi
        from github import github

        gh = None
        if (
            "github_account" in app
            and app["github_account"]
            and "github_repository" in app
            and app["github_repository"]
        ):
            if "github_token" in app and app["github_token"] and "github_username" in app and app["github_username"]:
                gh = github.GitHub(app["github_username"], app["github_token"])
            else:
                gh = github.GitHub()

        exception_group = LoggingService.get_exception_group(unique_hash)
        exceptions = LoggingService.gex_exceptions_in_group(unique_hash)

        if gh:
            sha = gh.commits.forBranch(app["github_account"], app["github_repository"])[0].id

            for s in exception_group["stacktrace"]:
                sections = s["filename"].split("/")
                path = []
                url = self._find_github_url(
                    sections, gh, app["github_account"], app["github_repository"], path=path, sha=sha
                )

                if url:
                    s["url"] = "%s#L%s" % (url, s["line_number"])

        stats_data = {"today": [], "previous": []}

        stats = LoggingService.get_statistics_for_exception_group(exception_group["_id"])
        for i, s in enumerate(stats):
            stats_data["today"].append([i, s["count"]])

        stats = LoggingService.get_statistics_for_exception_group(exception_group["_id"], days_back=1)
        for i, s in enumerate(stats):
            stats_data["previous"].append([i, s["count"]])

        self._data["stats_data"] = stats_data
        self._data["exception_group"] = exception_group
        self._data["exceptions"] = exceptions
        self._data["unique_hash"] = unique_hash
        self._data["get_severity_string"] = LoggingService.get_severity_string
        self._data["section_title"] = "%s : %s" % (app["application"], self._data["exception_group"]["message"][0:60])
        self._data["htmlTitle"] = "OnErrorLog - Dashboard"
        self._data["cgi"] = cgi

        self.write(self.render_view("../Views/details.html", self._data))
コード例 #4
0
    def post(self, app_name, unique_hash):
        lighthouse_title = self.get_argument('lighthouse_title', None)
        lighthouse_member = self.get_argument('lighthouse_member', None)
        lighthouse_body = self.get_argument('lighthouse_body', None)

        app, app_name = self._global(app_name)

        ticket_url = LighthouseService.create_ticket(app['lighthouse_project_id'], lighthouse_title, lighthouse_body, user_id=lighthouse_member)

        exception_group = LoggingService.get_exception_group(unique_hash)

        exception_groups = Database.Instance().exception_groups()
        exception_group['lighthouse_url'] = ticket_url
        exception_groups.save(exception_group)

        self.redirect('/%s/details/%s' % (app_name, unique_hash))
コード例 #5
0
ファイル: DashboardHandler.py プロジェクト: vpetro/OnErrorLog
    def get(self, app_name, unique_hash):
        import cgi

        app, app_name = self._global(app_name)

        exception_group = LoggingService.get_exception_group(unique_hash)

        lh_memberships = LighthouseService.get_project_memberships(app["lighthouse_project_id"])

        members = []
        for member in lh_memberships:
            members.append({"name": member["membership"]["user"]["name"], "id": member["membership"]["user"]["id"]})

        self._data["exception_group"] = exception_group
        self._data["unique_hash"] = unique_hash
        self._data["htmlTitle"] = "OnErrorLog - Create Lighthouse Ticket"
        self._data["section_title"] = "%s : %s" % (app["application"], self._data["exception_group"]["message"][0:60])
        self._data["cgi"] = cgi
        self._data["members"] = members

        self.write(self.render_view("../Views/lighthouse.html", self._data))
コード例 #6
0
ファイル: DashboardHandler.py プロジェクト: vpetro/OnErrorLog
    def get(self, app_name):

        global ITEMS_PER_PAGE

        app, app_name = self._global(app_name)

        # Check if the Archive All flag was passed
        archive_all = self.get_argument("archive_all", None)
        if archive_all == "True":
            LoggingService.archive_all_exception_group(app["_id"])
            self.redirect("/dashboard/%s" % app_name)

        # Check if there are any exceptions to archive, if so
        exception = self.get_arguments("exception", None)
        if exception:
            for ex in exception:
                LoggingService.archive_exception_group(ex)

        # Get Severity
        severity = None
        log_choice = self.get_argument("log_choice", None)
        if log_choice is None or log_choice == "specific":
            severity = int(self.get_argument("severity_level", 1))

        # Get Page and Offset
        page = int(self.get_argument("page", 1))
        start = (page * ITEMS_PER_PAGE) - ITEMS_PER_PAGE

        # Get Exceptions
        keyword = self.get_argument("keyword", "")

        # Sorting Variables
        sort = self.get_argument("sort", "last_seen_on")
        sort_direction = int(self.get_argument("sort_direction", -1))

        lso_new_sort = -1
        cnt_new_sort = -1

        if sort == "last_seen_on":
            if sort_direction == -1:
                lso_new_sort = 1
        else:
            if sort_direction == -1:
                cnt_new_sort = 1

        if not keyword and app:
            self._data["exceptions"] = LoggingService.get_exceptions_groups(
                self._data["user"]["_id"],
                app["_id"],
                severity=severity,
                start=start,
                sort=sort,
                sort_direction=sort_direction,
            )

            total_count = self._data["exceptions"].count()
        elif keyword:
            from Packages.mongodbsearch import mongodbsearch
            from pymongo import Connection

            self._data["exceptions"] = []

            mongo_search = mongodbsearch.mongodb_search(Connection()["onerrorlog"])
            conditions = {"key": str(self._data["user"]["_id"]), "application": str(app["_id"])}

            if severity is not None:
                conditions["severity"] = severity

            documents, _, total_count = mongo_search.search(
                keyword, conditions=conditions, fields=["unique_hash, _id"], start=start, scoring=("last_save_date", -1)
            )

            for doc in documents:
                self._data["exceptions"].append(LoggingService.get_exception_group(doc["_id"]))
        else:
            self._data["exceptions"] = []
            total_count = 0

        if app:

            stats_data = {"today": [], "previous": []}

            stats = LoggingService.get_statistics_for_application(app["_id"], severity=severity)
            for i, s in enumerate(stats):
                stats_data["today"].append([i, s["count"]])

            stats = LoggingService.get_statistics_for_application(app["_id"], days_back=1, severity=severity)
            for i, s in enumerate(stats):
                stats_data["previous"].append([i, s["count"]])

            self._data["stats_data"] = stats_data
            self._data["log_choice"] = log_choice
            self._data["severity"] = severity
            self._data["get_severity_string"] = LoggingService.get_severity_string
            self._data["keyword"] = keyword
            self._data["total_count"] = total_count
            self._data["lso_new_sort"] = lso_new_sort
            self._data["cnt_new_sort"] = cnt_new_sort
            self._data["cgi"] = cgi

            self._compute_paging(page, total_count, app_name)

            self._data["section_title"] = "Dashboard : %s : %s" % (
                self._data["user"]["company_name"],
                app["application"],
            )
            self._data["application_name"] = app["application"]
            self._data["htmlTitle"] = "OnErrorLog - Dashboard"
            self.write(self.render_view("../Views/dashboard.html", self._data))

        else:
            self._data["section_title"] = "Getting Started"
            self._data["htmlTitle"] = "OnErrorLog - Getting Started"
            self.write(self.render_view("../Views/gettingstarted.html", self._data))
コード例 #7
0
    def get(self, app_name):

        global ITEMS_PER_PAGE

        app, app_name = self._global(app_name)

        #Check if the Archive All flag was passed
        archive_all = self.get_argument('archive_all', None)
        if archive_all == 'True':
            LoggingService.archive_all_exception_group(app['_id'])
            self.redirect('/dashboard/%s' % app_name)

        #Check if there are any exceptions to archive, if so
        exception = self.get_arguments('exception', None)
        if exception:
            for ex in exception:
                LoggingService.archive_exception_group(ex)

        #Get Severity
        severity = None
        log_choice = self.get_argument('log_choice', "all")
        if log_choice is None or log_choice == 'specific':
            severity = int(self.get_argument('severity_level', 1))

        #Get Page and Offset
        page = int(self.get_argument('page', 1))
        start = (page * ITEMS_PER_PAGE) - ITEMS_PER_PAGE

        #Get Exceptions
        keyword = self.get_argument('keyword', '')

        #Sorting Variables
        sort = self.get_argument('sort', 'last_seen_on')
        sort_direction = int(self.get_argument('sort_direction', -1))

        lso_new_sort = -1
        cnt_new_sort = -1

        if sort == 'last_seen_on':
            if sort_direction == -1:
                lso_new_sort = 1
        else:
            if sort_direction == -1:
                cnt_new_sort = 1

        if not keyword and app:
            self._data['exceptions'] = LoggingService.get_exceptions_groups(
                                    self._data['user']['_id'],
                                    app['_id'], severity=severity,
                                    start=start,
                                    sort=sort,
                                    sort_direction=sort_direction)

            total_count = self._data['exceptions'].count()
        elif keyword:
            from Packages.mongodbsearch import mongodbsearch
            from pymongo import Connection

            self._data['exceptions'] = []

            mongo_search = mongodbsearch.mongodb_search(Connection()['onerrorlog'])
            conditions = {'key': str(self._data['user']['_id']),
                          'application': str(app['_id']),
                         }

            if severity is not None:
                conditions['severity'] = severity

            documents, _, total_count = mongo_search.search(keyword,
                                                            conditions=conditions,
                                                            fields=['unique_hash, _id'],
                                                            start=start,
                                                            scoring=('last_save_date', -1))

            for doc in documents:
                self._data['exceptions'].append(LoggingService.get_exception_group(doc['_id']))
        else:
            self._data['exceptions'] = []
            total_count = 0

        if app:

            stats_data = {'today': [], 'previous': []}

            stats = LoggingService.get_statistics_for_application(app['_id'], severity=severity)
            for i, s in enumerate(stats):
                stats_data['today'].append([i, s['count']])

            stats = LoggingService.get_statistics_for_application(app['_id'], days_back=1, severity=severity)
            for i, s in enumerate(stats):
                stats_data['previous'].append([i, s['count']])

            self._data['stats_data'] = stats_data
            self._data['log_choice'] = log_choice
            self._data['severity'] = severity
            self._data['get_severity_string'] = LoggingService.get_severity_string
            self._data['keyword'] = keyword
            self._data['total_count'] = total_count
            self._data['lso_new_sort'] = lso_new_sort
            self._data['cnt_new_sort'] = cnt_new_sort
            self._data['cgi'] = cgi

            self._compute_paging(page, total_count, app_name)

            self._data['section_title'] = 'Dashboard : %s : %s' % (self._data['user']['company_name'], app['application'])
            self._data['application_name'] = app['application']
            self._data['htmlTitle'] = 'OnErrorLog - Dashboard'
            self.write(self.render_view('../Views/dashboard.html', self._data))

        else:
            self._data['section_title'] = 'Getting Started'
            self._data['htmlTitle'] = 'OnErrorLog - Getting Started'
            self.write(self.render_view('../Views/gettingstarted.html', self._data))