hostess-python 0.1.0__py3-none-any.whl → 0.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: hostess-python
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: Hostess SDK for Python — native API Insights for FastAPI and beyond.
5
5
  Project-URL: Homepage, https://hostess.sh
6
6
  Project-URL: Repository, https://github.com/howl-cloud/hostess-python
@@ -36,6 +36,7 @@ Requires-Python: >=3.9
36
36
  Requires-Dist: opentelemetry-api>=1.27.0
37
37
  Requires-Dist: opentelemetry-sdk>=1.27.0
38
38
  Provides-Extra: fastapi
39
+ Requires-Dist: opentelemetry-distro>=0.48b0; extra == 'fastapi'
39
40
  Requires-Dist: opentelemetry-exporter-otlp-proto-http>=1.27.0; extra == 'fastapi'
40
41
  Requires-Dist: opentelemetry-instrumentation-fastapi>=0.48b0; extra == 'fastapi'
41
42
  Description-Content-Type: text/markdown
@@ -0,0 +1,9 @@
1
+ hostess_sdk/__init__.py,sha256=MgnQ13cclXwFRPoVnzxVpqpVt6tMaTMlexwsAwz486Q,598
2
+ hostess_sdk/fastapi.py,sha256=XGcB9zgOIhg1yl0X2iPfMZuHSRxVsIYhVe1yOttRUa4,4929
3
+ hostess_sdk/_otel/__init__.py,sha256=9w2DP9j128BGfoDp_szyLaL65j5g55TrK-2u7f5YI0Y,3724
4
+ hostess_sdk/_otel/marker.py,sha256=qVFnlCLEIqeB4S-eUHOYbko8mmQ-gdE-TXTC-BWkOUE,2780
5
+ hostess_python-0.2.0.dist-info/METADATA,sha256=mvKWDY4E6ek7n2WQ-nncf4GY-pc0crzqh6SZxD0Tmhc,4137
6
+ hostess_python-0.2.0.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
7
+ hostess_python-0.2.0.dist-info/entry_points.txt,sha256=LHTywwcB6Q_zISwBf2prc-iGgjxaoZhiau502NAGDqM,82
8
+ hostess_python-0.2.0.dist-info/licenses/LICENSE,sha256=eGflFTCTA2JY5LjhbvOqDh1cO_ZfjocMJ_L7KxNe7YU,1073
9
+ hostess_python-0.2.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.30.1
2
+ Generator: hatchling 1.32.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [opentelemetry_post_instrument]
2
+ hostess_sdk = hostess_sdk.fastapi:post_instrument
hostess_sdk/fastapi.py CHANGED
@@ -7,10 +7,6 @@ Usage::
7
7
 
8
8
  app = FastAPI()
9
9
  instrument(app)
10
-
11
- The helper is deliberately thin: it preconfigures battle-tested OpenTelemetry
12
- FastAPI instrumentation to push to the Hostess collector, and emits the marker
13
- heartbeat. It adds no routes to the application.
14
10
  """
15
11
 
16
12
  from __future__ import annotations
@@ -98,6 +94,44 @@ def instrument(
98
94
  return app
99
95
 
100
96
 
97
+ def post_instrument() -> None:
98
+ """Hostess-specific init after ``opentelemetry-instrument`` has run.
99
+
100
+ Additive: starts the marker heartbeat. Does not install FastAPI
101
+ instrumentation or replace the global TracerProvider. Idempotent with
102
+ ``instrument(app)`` — if both run, the marker starts once. Fail-silent
103
+ and a no-op when disabled or when no collector endpoint is resolved.
104
+ """
105
+ if not is_enabled(None):
106
+ logger.debug("hostess: instrumentation disabled; skipping post-instrument")
107
+ return
108
+
109
+ endpoint = resolve_endpoint(None)
110
+ if endpoint is None:
111
+ logger.debug("hostess: no OTLP endpoint resolved; post-instrument is a no-op")
112
+ return
113
+
114
+ sdk_version, framework_version = _versions()
115
+ resource = build_resource(
116
+ service_name=None,
117
+ sdk_version=sdk_version,
118
+ framework=_FRAMEWORK,
119
+ framework_version=framework_version,
120
+ )
121
+
122
+ try:
123
+ start_marker_heartbeat(
124
+ resource=resource,
125
+ base_endpoint=endpoint,
126
+ language=_LANGUAGE,
127
+ framework=_FRAMEWORK,
128
+ sdk_version=sdk_version,
129
+ framework_version=framework_version,
130
+ )
131
+ except Exception: # never break the host app over telemetry setup
132
+ logger.debug("hostess: post-instrument setup failed; continuing", exc_info=True)
133
+
134
+
101
135
  def _instrument_fastapi(app: "FastAPI", exclude_paths: Optional[Iterable[str]]) -> None:
102
136
  from opentelemetry.instrumentation.fastapi import FastAPIInstrumentor
103
137
 
@@ -1,8 +0,0 @@
1
- hostess_sdk/__init__.py,sha256=MgnQ13cclXwFRPoVnzxVpqpVt6tMaTMlexwsAwz486Q,598
2
- hostess_sdk/fastapi.py,sha256=NxLRQUH5K44WOB8Hhox-_VjDJxQsvHAIJZf2Xp2U7ZY,3782
3
- hostess_sdk/_otel/__init__.py,sha256=9w2DP9j128BGfoDp_szyLaL65j5g55TrK-2u7f5YI0Y,3724
4
- hostess_sdk/_otel/marker.py,sha256=qVFnlCLEIqeB4S-eUHOYbko8mmQ-gdE-TXTC-BWkOUE,2780
5
- hostess_python-0.1.0.dist-info/METADATA,sha256=X9baUeG5rTmdGV0XleHVLuwp3ayhH3035EY83gq1-BM,4073
6
- hostess_python-0.1.0.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
7
- hostess_python-0.1.0.dist-info/licenses/LICENSE,sha256=eGflFTCTA2JY5LjhbvOqDh1cO_ZfjocMJ_L7KxNe7YU,1073
8
- hostess_python-0.1.0.dist-info/RECORD,,