コード例 #1
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))
コード例 #2
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))