Coverage for .tox/coverage/lib/python3.13/site-packages/wuttatell/app.py: 100%
11 statements
« prev ^ index » next coverage.py v7.16.1, created at 2026-09-21 19:19 -0500
« prev ^ index » next coverage.py v7.16.1, created at 2026-09-21 19:19 -0500
1# -*- coding: utf-8; -*-
2################################################################################
3#
4# WuttaTell -- Telemetry submission for Wutta Framework
5# Copyright © 2025-2026 Lance Edgar
6#
7# This file is part of Wutta Framework.
8#
9# Wutta Framework is free software: you can redistribute it and/or modify it
10# under the terms of the GNU General Public License as published by the Free
11# Software Foundation, either version 3 of the License, or (at your option) any
12# later version.
13#
14# Wutta Framework is distributed in the hope that it will be useful, but
15# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17# more details.
18#
19# You should have received a copy of the GNU General Public License along with
20# Wutta Framework. If not, see <http://www.gnu.org/licenses/>.
21#
22################################################################################
23"""
24App Provider
25"""
27import logging
29from wuttjamaican.app import AppProvider
31log = logging.getLogger(__name__)
34class WuttaTellAppProvider(AppProvider):
35 """
36 The :term:`app provider` for WuttaTell.
38 This adds the :meth:`get_telemetry_handler()` method for the
39 :term:`app handler`.
40 """
42 def get_telemetry_handler(self, **kwargs):
43 """
44 Get the configured telemetry handler.
46 :rtype: :class:`~wuttatell.telemetry.TelemetryHandler`
47 """
48 if "telemetry" not in self.app.handlers:
49 spec = self.config.get(
50 f"{self.appname}.telemetry.handler",
51 default="wuttatell.telemetry:TelemetryHandler",
52 )
53 log.debug("telemetry handler spec is %s", spec)
54 factory = self.app.load_object(spec)
55 self.app.handlers["telemetry"] = factory(self.config, **kwargs)
56 return self.app.handlers["telemetry"]