platzky 1.0.0__py3-none-any.whl → 1.0.1__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.
platzky/config.py CHANGED
@@ -75,6 +75,7 @@ class TelemetryConfig(StrictBaseModel):
75
75
  service_instance_id: Service instance ID (auto-generated if not provided)
76
76
  flush_on_request: Flush spans after each request (default: True, may impact latency)
77
77
  flush_timeout_ms: Timeout in milliseconds for per-request flush (default: 5000)
78
+ instrument_logging: Enable automatic logging instrumentation (default: True)
78
79
  """
79
80
 
80
81
  enabled: bool = Field(default=False, alias="enabled")
@@ -85,6 +86,7 @@ class TelemetryConfig(StrictBaseModel):
85
86
  service_instance_id: t.Optional[str] = Field(default=None, alias="service_instance_id")
86
87
  flush_on_request: bool = Field(default=True, alias="flush_on_request")
87
88
  flush_timeout_ms: int = Field(default=5000, alias="flush_timeout_ms", gt=0)
89
+ instrument_logging: bool = Field(default=True, alias="instrument_logging")
88
90
 
89
91
  @field_validator("endpoint")
90
92
  @classmethod
platzky/telemetry.py CHANGED
@@ -22,6 +22,7 @@ def setup_telemetry(app: "Engine", telemetry_config: TelemetryConfig) -> Optiona
22
22
 
23
23
  Configures and initializes OpenTelemetry tracing with OTLP and/or console exporters.
24
24
  Automatically instruments Flask to capture HTTP requests and trace information.
25
+ Optionally instruments logging to add trace context to log records.
25
26
 
26
27
  Args:
27
28
  app: Engine instance (Flask-based application)
@@ -51,6 +52,7 @@ def setup_telemetry(app: "Engine", telemetry_config: TelemetryConfig) -> Optiona
51
52
  from opentelemetry import trace
52
53
  from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
53
54
  from opentelemetry.instrumentation.flask import FlaskInstrumentor
55
+ from opentelemetry.instrumentation.logging import LoggingInstrumentor
54
56
  from opentelemetry.sdk.resources import Resource
55
57
  from opentelemetry.sdk.trace import TracerProvider
56
58
  from opentelemetry.sdk.trace.export import (
@@ -107,6 +109,13 @@ def setup_telemetry(app: "Engine", telemetry_config: TelemetryConfig) -> Optiona
107
109
 
108
110
  trace.set_tracer_provider(provider)
109
111
  FlaskInstrumentor().instrument_app(app)
112
+
113
+ # Instrument logging to add trace context to log records
114
+ # Note: set_logging_format=False to avoid modifying existing log formats
115
+ # Users can access trace context in their custom formatters via log record attributes
116
+ if telemetry_config.instrument_logging:
117
+ LoggingInstrumentor().instrument(set_logging_format=False)
118
+
110
119
  app.telemetry_instrumented = True
111
120
 
112
121
  # Optionally flush spans after each request (may impact latency)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: platzky
3
- Version: 1.0.0
3
+ Version: 1.0.1
4
4
  Summary: Not only blog engine
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -28,6 +28,7 @@ Requires-Dist: myst-parser (>=4.0.0,<5.0.0) ; extra == "docs"
28
28
  Requires-Dist: opentelemetry-api (>=1.27.0,<2.0.0) ; extra == "telemetry"
29
29
  Requires-Dist: opentelemetry-exporter-otlp-proto-grpc (>=1.27.0,<2.0.0) ; extra == "telemetry"
30
30
  Requires-Dist: opentelemetry-instrumentation-flask (>=0.48b0,<0.49) ; extra == "telemetry"
31
+ Requires-Dist: opentelemetry-instrumentation-logging (>=0.48b0,<0.49) ; extra == "telemetry"
31
32
  Requires-Dist: opentelemetry-sdk (>=1.27.0,<2.0.0) ; extra == "telemetry"
32
33
  Requires-Dist: pydantic (>=2.7.1,<3.0.0)
33
34
  Requires-Dist: pygithub (>=2.6.1,<3.0.0)
@@ -7,7 +7,7 @@ platzky/admin/templates/module.html,sha256=WuQZxKQDD4INl-QF2uiKHf9Fmf2h7cEW9RLe1
7
7
  platzky/blog/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
8
  platzky/blog/blog.py,sha256=L9IYWxnLo1v1h_wLF-0HyG1Y4RSGg7maEMnYxhTgG5Y,2971
9
9
  platzky/blog/comment_form.py,sha256=4lkNJ_S_2DZmJBbz-NPDqahvy2Zz5AGNH2spFeGIop4,513
10
- platzky/config.py,sha256=N5cQjV8Jh_fETw9jXE-UOcC-bSlC3l_04yMMtRwXKXw,7365
10
+ platzky/config.py,sha256=NFnW-cjieWgER-uRko1Hbuh6cyGKCFQcq6ihDNSyjQk,7529
11
11
  platzky/db/README.md,sha256=IO-LoDsd4dLBZenaz423EZjvEOQu_8m2OC0G7du170w,1753
12
12
  platzky/db/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
13
  platzky/db/db.py,sha256=0h5rGCBO_N1wBqJRl5EoiW_bFDpNIvmNwuA0hJi89jw,3060
@@ -28,7 +28,7 @@ platzky/plugin/plugin_loader.py,sha256=MeQ8LNbrOomwXgc1ISHuyhjZd2mzYKen70eDShWs-
28
28
  platzky/seo/seo.py,sha256=N_MmAA4KJZmmrDUh0hYNtD8ycOwpNKow4gVSAv8V3N4,2631
29
29
  platzky/static/blog.css,sha256=TrppzgQbj4UtuTufDCdblyNTVAqgIbhD66Cziyv_xnY,7893
30
30
  platzky/static/styles.css,sha256=U5ddGIK-VcGRJZ3BdOpMp0pR__k6rNEMsuQXkP4tFQ0,686
31
- platzky/telemetry.py,sha256=NQuueK-uwZDdnpWaOTFSMvzRWWg6Yu4jPOMPYdMidNY,4524
31
+ platzky/telemetry.py,sha256=iXYvEt0Uw5Hx8lAxyr45dpQ_SiE2NxmJkoSx-JSRJyM,5011
32
32
  platzky/templates/404.html,sha256=EheoLSWylOscLH8FmcMA4c6Jw14i5HkSvE_GXzGIrUo,78
33
33
  platzky/templates/base.html,sha256=clvWlVOxNLqSQxBpPao3qnKKzkU2q48Apf1WbHJgYfE,4003
34
34
  platzky/templates/blog.html,sha256=aPl-DzLX85bHv7tN8UjlABR086PUJ9IGlGbIBioFHGA,1281
@@ -41,7 +41,7 @@ platzky/templates/post.html,sha256=GSgjIZsOQKtNx3cEbquSjZ5L4whPnG6MzRyoq9k4B8Q,1
41
41
  platzky/templates/robots.txt,sha256=2_j2tiYtYJnzZUrANiX9pvBxyw5Dp27fR_co18BPEJ0,116
42
42
  platzky/templates/sitemap.xml,sha256=iIJZ91_B5ZuNLCHsRtsGKZlBAXojOTP8kffqKLacgvs,578
43
43
  platzky/www_handler.py,sha256=pF6Rmvem1sdVqHD7z3RLrDuG-CwAqfGCti50_NPsB2w,725
44
- platzky-1.0.0.dist-info/METADATA,sha256=NSQ3OIyrJ4NQsdu3QRIo-c4jQQ9mM0HoqwmQK2EPvKc,2463
45
- platzky-1.0.0.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
46
- platzky-1.0.0.dist-info/licenses/LICENSE,sha256=wCdfk-qEosi6BDwiBulMfKMi0hxp1UXV0DdjLrRm788,1077
47
- platzky-1.0.0.dist-info/RECORD,,
44
+ platzky-1.0.1.dist-info/METADATA,sha256=lkAvxX2DdR4HSpfYr7A5TXnStXzv0O4ZqFqhDIwrD_c,2556
45
+ platzky-1.0.1.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
46
+ platzky-1.0.1.dist-info/licenses/LICENSE,sha256=wCdfk-qEosi6BDwiBulMfKMi0hxp1UXV0DdjLrRm788,1077
47
+ platzky-1.0.1.dist-info/RECORD,,