plain.observer 0.6.0__py3-none-any.whl → 0.6.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.

Potentially problematic release.


This version of plain.observer might be problematic. Click here for more details.

@@ -1,5 +1,17 @@
1
1
  # plain-observer changelog
2
2
 
3
+ ## [0.6.1](https://github.com/dropseed/plain/releases/plain-observer@0.6.1) (2025-09-09)
4
+
5
+ ### What's changed
6
+
7
+ - Log messages are now stored in their formatted form instead of as raw log records, improving display consistency and performance ([b646699](https://github.com/dropseed/plain/commit/b646699e46))
8
+ - Observer log handler now copies the formatter from the app logger to ensure consistent log formatting ([b646699](https://github.com/dropseed/plain/commit/b646699e46))
9
+ - Simplified log display template by removing redundant level display element ([b646699](https://github.com/dropseed/plain/commit/b646699e46))
10
+
11
+ ### Upgrade instructions
12
+
13
+ - No changes required
14
+
3
15
  ## [0.6.0](https://github.com/dropseed/plain/releases/plain-observer@0.6.0) (2025-09-09)
4
16
 
5
17
  ### What's changed
plain/observer/config.py CHANGED
@@ -46,6 +46,12 @@ class Config(PackageConfig):
46
46
 
47
47
  # Install the logging handler to capture logs during traces
48
48
  if observer_log_handler not in app_logger.handlers:
49
+ # Copy formatter from existing app_logger handler to match log formatting
50
+ for handler in app_logger.handlers:
51
+ if handler.formatter:
52
+ observer_log_handler.setFormatter(handler.formatter)
53
+ break
54
+
49
55
  app_logger.addHandler(observer_log_handler)
50
56
 
51
57
  @staticmethod
plain/observer/logging.py CHANGED
@@ -44,9 +44,10 @@ class ObserverLogHandler(logging.Handler):
44
44
  if trace_info["mode"] != ObserverMode.PERSIST.value:
45
45
  return
46
46
 
47
- # Store the log record with span context
47
+ # Store the formatted message with span context
48
48
  log_entry = {
49
- "record": record,
49
+ "message": self.format(record),
50
+ "level": record.levelname,
50
51
  "span_id": span_id,
51
52
  "timestamp": datetime.fromtimestamp(record.created, tz=UTC),
52
53
  }
plain/observer/models.py CHANGED
@@ -500,14 +500,3 @@ class Log(models.Model):
500
500
  models.Index(fields=["timestamp"]),
501
501
  models.Index(fields=["trace"]),
502
502
  ]
503
-
504
- @classmethod
505
- def from_log_record(cls, *, record, trace, span):
506
- """Create a Log instance from a Python log record."""
507
- return cls(
508
- trace=trace,
509
- timestamp=datetime.fromtimestamp(record.created, tz=UTC),
510
- level=record.levelname,
511
- message=record.getMessage(),
512
- span=span,
513
- )
plain/observer/otel.py CHANGED
@@ -353,9 +353,11 @@ class ObserverSpanProcessor(SpanProcessor):
353
353
 
354
354
  log_models = []
355
355
  for log_entry in logs:
356
- log_model = Log.from_log_record(
357
- record=log_entry["record"],
356
+ log_model = Log(
358
357
  trace=trace,
358
+ timestamp=log_entry["timestamp"],
359
+ level=log_entry["level"],
360
+ message=log_entry["message"],
359
361
  span=span_id_to_model.get(log_entry["span_id"]),
360
362
  )
361
363
  log_models.append(log_model)
@@ -6,14 +6,10 @@
6
6
  </svg>
7
7
  </div>
8
8
  <span class="text-white/40 whitespace-nowrap tabular-nums" title="{{ log.timestamp|localtime }}">{{ log.timestamp|localtime|strftime("%-I:%M:%S %p") }}</span>
9
- <span class="font-mono px-1 py-0 text-xs font-medium rounded
9
+ <span data-level="{{ log.level }}" class="font-mono text-white/90 break-words
10
10
  data-[level='DEBUG']:text-stone-400
11
- data-[level='INFO']:text-blue-400
12
11
  data-[level='WARNING']:text-yellow-400
13
12
  data-[level='ERROR']:text-red-400
14
- data-[level='CRITICAL']:text-red-300
15
- text-stone-400 text-center flex-shrink-0"
16
- data-level="{{ log.level }}">{{ log.level }}</span>
17
- <span class="font-mono text-white/90 break-words">{{ log.message }}</span>
13
+ data-[level='CRITICAL']:text-red-300">{{ log.message }}</span>
18
14
  </div>
19
15
  </div>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plain.observer
3
- Version: 0.6.0
3
+ Version: 0.6.1
4
4
  Summary: On-page telemetry and observability tools for Plain.
5
5
  Author-email: Dave Gaeddert <dave.gaeddert@dropseed.dev>
6
6
  License-Expression: BSD-3-Clause
@@ -1,14 +1,14 @@
1
- plain/observer/CHANGELOG.md,sha256=4U52ESvo9PM9VfUCkDxzM9zzhrsXKRyYWrdtTtyB0lc,8300
1
+ plain/observer/CHANGELOG.md,sha256=pZEAYcaGjPvV3paHKXoM7Nw_vIYyEi4R3vd1yocEn8o,8968
2
2
  plain/observer/README.md,sha256=39RA17fgcyOkqeIWBOAg4Be6YZjoiDzK5PVOG-nseuY,988
3
3
  plain/observer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  plain/observer/admin.py,sha256=yvfkXD4kIosodEqkvJkqACIb6WOdNaHFRX_LGca5Aks,3391
5
5
  plain/observer/cli.py,sha256=Jh5OwTtKmV6TTymfS9xv1R_tQL1tgfKKUS__19Wcnbk,20647
6
- plain/observer/config.py,sha256=T037wB7VRzb3paG7OGbknXXj15Oh2zdMk17zvt0SKuI,2162
6
+ plain/observer/config.py,sha256=8c5aX2_rzVL4SSFO4Q0nMyUSqgpu3Zv3aJkeFZONOpM,2434
7
7
  plain/observer/core.py,sha256=ZHwQAXlqKa1BvHh3Xr6R0iOgkSNTEJ_Wg2lUlgMzWsE,2420
8
8
  plain/observer/default_settings.py,sha256=JN2jT2wfa6f80EqU0p4Ox_47xyxL-Ym5-_pftY7xj2U,197
9
- plain/observer/logging.py,sha256=M6Z3zm6RafPAPqYmBBdSFMPR8KbcgHiTWHOq9ptapD8,2731
10
- plain/observer/models.py,sha256=gncPcRV5txZiimJkdJVzD6XZ2xcz-C-Mg4CzciWygnA,17404
11
- plain/observer/otel.py,sha256=57utxfjhcu-7nO3yX03EghqkViJzoXtnY0yRKpypNLY,16068
9
+ plain/observer/logging.py,sha256=5_fcmUE0x2lg7968V4lhduaTbRLCr8w-ooRFo9BC1ms,2795
10
+ plain/observer/models.py,sha256=EJTUCDeJkG55XgTT1AUpYvEDU8KDgCVr1nexKKt4GQQ,17045
11
+ plain/observer/otel.py,sha256=h7LI7Nur8Y6XheriuNWPmeSFpf2Vsl94Sgxv02W8ZXY,16170
12
12
  plain/observer/toolbar.py,sha256=He7SqjED-7smLDWoomZ9df35qN4WcslNXi5eaO7X4lY,617
13
13
  plain/observer/urls.py,sha256=oLJoDjB7YMUx8z-MGql_xXSXkfacVKFp-aHNXaKzs38,376
14
14
  plain/observer/views.py,sha256=8KoBwXBj2q-mbuscA80h7nlglsOraTz-ScTzTQwLWP0,4949
@@ -23,11 +23,11 @@ plain/observer/templates/observer/trace.html,sha256=Hd92O1lX0xjvDR7cb79NFVeJhxaV
23
23
  plain/observer/templates/observer/trace_detail.html,sha256=86-YGCpg9gy31Pd2vDHB3LYRkJile-DsGD1Enjx9s5Y,943
24
24
  plain/observer/templates/observer/trace_share.html,sha256=HrYLti5BpX96-6Bm_37OObFvAJSYbZ3GZD-MwCi9hgA,525
25
25
  plain/observer/templates/observer/traces.html,sha256=auU9tYUan4P0En48VwfOKgKr7wRNSF7Jc7X-V--7fUE,24575
26
- plain/observer/templates/observer/partials/log.html,sha256=x70paLGDQyX0QCvOvJVebLSG5WABJGENuoWP9JcF7RE,1188
26
+ plain/observer/templates/observer/partials/log.html,sha256=Vpp0j-GLBfwTBFyZp_cv0jkOLpgxfd-8-RMBe6V4HbU,964
27
27
  plain/observer/templates/observer/partials/span.html,sha256=PaWZONsABwlS7mdKsJlYbhMSOzidq_WyOp6ifvFUgmM,18672
28
28
  plain/observer/templates/toolbar/observer.html,sha256=uaDKiWR7EYqC1kEXE-uHDlE7nfFEMR_zmOgvlKwQHJ4,1365
29
29
  plain/observer/templates/toolbar/observer_button.html,sha256=FMBJHKMGqpHWs-3Ei2PBCdVYZ_6vFw6-eKH_i4jQu-Q,1215
30
- plain_observer-0.6.0.dist-info/METADATA,sha256=11FTNxkvYor0PDIhmScV03BLcckpoXSXEkJOXsJqjmc,1386
31
- plain_observer-0.6.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
32
- plain_observer-0.6.0.dist-info/licenses/LICENSE,sha256=YZdq6Pz8ivjs97eSVLRmoGDI1hjEikX6N49DfM0DWio,1500
33
- plain_observer-0.6.0.dist-info/RECORD,,
30
+ plain_observer-0.6.1.dist-info/METADATA,sha256=WMOZIw-IltBu-VI2VdgU_HbdtqAyy_PSJwB4pT7KPto,1386
31
+ plain_observer-0.6.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
32
+ plain_observer-0.6.1.dist-info/licenses/LICENSE,sha256=YZdq6Pz8ivjs97eSVLRmoGDI1hjEikX6N49DfM0DWio,1500
33
+ plain_observer-0.6.1.dist-info/RECORD,,