plain.observer 0.24.0__tar.gz
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.
- plain_observer-0.24.0/.gitignore +21 -0
- plain_observer-0.24.0/LICENSE +28 -0
- plain_observer-0.24.0/PKG-INFO +80 -0
- plain_observer-0.24.0/README.md +1 -0
- plain_observer-0.24.0/plain/observer/CHANGELOG.md +462 -0
- plain_observer-0.24.0/plain/observer/README.md +67 -0
- plain_observer-0.24.0/plain/observer/__init__.py +0 -0
- plain_observer-0.24.0/plain/observer/admin.py +127 -0
- plain_observer-0.24.0/plain/observer/assets/observer/observer.css +72 -0
- plain_observer-0.24.0/plain/observer/assets/observer/observer.js +72 -0
- plain_observer-0.24.0/plain/observer/cli.py +490 -0
- plain_observer-0.24.0/plain/observer/config.py +69 -0
- plain_observer-0.24.0/plain/observer/core.py +172 -0
- plain_observer-0.24.0/plain/observer/default_settings.py +8 -0
- plain_observer-0.24.0/plain/observer/logging.py +85 -0
- plain_observer-0.24.0/plain/observer/migrations/0001_initial.py +95 -0
- plain_observer-0.24.0/plain/observer/migrations/0002_trace_share_created_at_trace_share_id_trace_summary_and_more.py +58 -0
- plain_observer-0.24.0/plain/observer/migrations/0003_span_plainobserv_span_id_e7ade3_idx.py +22 -0
- plain_observer-0.24.0/plain/observer/migrations/0004_trace_app_name_trace_app_version.py +23 -0
- plain_observer-0.24.0/plain/observer/migrations/0005_log_log_plainobserv_trace_i_fcfb7d_idx_and_more.py +65 -0
- plain_observer-0.24.0/plain/observer/migrations/0006_remove_log_logger.py +16 -0
- plain_observer-0.24.0/plain/observer/migrations/0007_remove_trace_plainobserv_share_i_754f3c_idx_and_more.py +24 -0
- plain_observer-0.24.0/plain/observer/migrations/__init__.py +0 -0
- plain_observer-0.24.0/plain/observer/models.py +518 -0
- plain_observer-0.24.0/plain/observer/otel.py +455 -0
- plain_observer-0.24.0/plain/observer/skills/plain-optimize/SKILL.md +45 -0
- plain_observer-0.24.0/plain/observer/templates/observer/partials/log.html +15 -0
- plain_observer-0.24.0/plain/observer/templates/observer/partials/span.html +303 -0
- plain_observer-0.24.0/plain/observer/templates/observer/trace.html +125 -0
- plain_observer-0.24.0/plain/observer/templates/observer/trace_detail.html +26 -0
- plain_observer-0.24.0/plain/observer/templates/observer/traces.html +325 -0
- plain_observer-0.24.0/plain/observer/templates/toolbar/observer.html +42 -0
- plain_observer-0.24.0/plain/observer/templates/toolbar/observer_button.html +29 -0
- plain_observer-0.24.0/plain/observer/toolbar.py +25 -0
- plain_observer-0.24.0/plain/observer/urls.py +11 -0
- plain_observer-0.24.0/plain/observer/views.py +128 -0
- plain_observer-0.24.0/pyproject.toml +25 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
.venv
|
|
2
|
+
/.env
|
|
3
|
+
*.egg-info
|
|
4
|
+
*.py[co]
|
|
5
|
+
__pycache__
|
|
6
|
+
*.DS_Store
|
|
7
|
+
|
|
8
|
+
/*.code-workspace
|
|
9
|
+
|
|
10
|
+
# Test apps
|
|
11
|
+
plain*/tests/.plain
|
|
12
|
+
|
|
13
|
+
# Agent scratch files
|
|
14
|
+
/scratch
|
|
15
|
+
|
|
16
|
+
# Plain temp dirs
|
|
17
|
+
.plain
|
|
18
|
+
|
|
19
|
+
.vscode
|
|
20
|
+
/.claude
|
|
21
|
+
/.benchmarks
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025, Dropseed, LLC
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: plain.observer
|
|
3
|
+
Version: 0.24.0
|
|
4
|
+
Summary: On-page telemetry and observability tools for Plain.
|
|
5
|
+
Author-email: Dave Gaeddert <dave.gaeddert@dropseed.dev>
|
|
6
|
+
License-Expression: BSD-3-Clause
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Requires-Python: >=3.13
|
|
9
|
+
Requires-Dist: opentelemetry-sdk>=1.34.1
|
|
10
|
+
Requires-Dist: plain-admin<1.0.0
|
|
11
|
+
Requires-Dist: plain<1.0.0
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
|
|
14
|
+
# plain.observer
|
|
15
|
+
|
|
16
|
+
**On-page telemetry and observability tools for Plain.**
|
|
17
|
+
|
|
18
|
+
- [Installation](#installation)
|
|
19
|
+
- [Content Security Policy (CSP)](#content-security-policy-csp)
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
Install the `plain.observer` package from [PyPI](https://pypi.org/project/plain.observer/):
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
uv add plain.observer
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Add `plain.observer` to your `INSTALLED_PACKAGES`:
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
# app/settings.py
|
|
33
|
+
INSTALLED_PACKAGES = [
|
|
34
|
+
# ...
|
|
35
|
+
"plain.observer",
|
|
36
|
+
]
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Include the observer URLs in your URL configuration:
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
# app/urls.py
|
|
43
|
+
from plain.observer.urls import ObserverRouter
|
|
44
|
+
from plain.urls import Router, include
|
|
45
|
+
|
|
46
|
+
class AppRouter(Router):
|
|
47
|
+
namespace = ""
|
|
48
|
+
urls = [
|
|
49
|
+
# ...
|
|
50
|
+
include("observer/", ObserverRouter),
|
|
51
|
+
]
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Run migrations to create the necessary database tables:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
plain migrate
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
After installation, Observer will automatically integrate with your application's toolbar (if using `plain.admin`). You can access the web interface at `/observer/traces/` or use the CLI commands to analyze traces.
|
|
61
|
+
|
|
62
|
+
## Content Security Policy (CSP)
|
|
63
|
+
|
|
64
|
+
If you're using a Content Security Policy (CSP), the Observer toolbar panel requires `frame-ancestors 'self'` to display trace information in an iframe.
|
|
65
|
+
|
|
66
|
+
Without this directive, the toolbar panel will fail to load with a CSP error: `"Refused to frame... because an ancestor violates the following Content Security Policy directive: 'frame-ancestors 'none'"`.
|
|
67
|
+
|
|
68
|
+
Example CSP configuration:
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
DEFAULT_RESPONSE_HEADERS = {
|
|
72
|
+
"Content-Security-Policy": (
|
|
73
|
+
"default-src 'self'; "
|
|
74
|
+
"script-src 'self' 'nonce-{request.csp_nonce}'; "
|
|
75
|
+
"style-src 'self' 'nonce-{request.csp_nonce}'; "
|
|
76
|
+
"frame-ancestors 'self'; " # Required for Observer toolbar
|
|
77
|
+
# ... other directives
|
|
78
|
+
),
|
|
79
|
+
}
|
|
80
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
plain/observer/README.md
|
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
# plain-observer changelog
|
|
2
|
+
|
|
3
|
+
## [0.24.0](https://github.com/dropseed/plain/releases/plain-observer@0.24.0) (2026-01-13)
|
|
4
|
+
|
|
5
|
+
### What's changed
|
|
6
|
+
|
|
7
|
+
- Replaced AGENTS.md with a structured SKILL.md file providing a step-by-step performance optimization workflow for AI agents ([b592c32](https://github.com/dropseed/plain/commit/b592c32cb9))
|
|
8
|
+
|
|
9
|
+
### Upgrade instructions
|
|
10
|
+
|
|
11
|
+
- No changes required
|
|
12
|
+
|
|
13
|
+
## [0.23.2](https://github.com/dropseed/plain/releases/plain-observer@0.23.2) (2025-12-22)
|
|
14
|
+
|
|
15
|
+
### What's changed
|
|
16
|
+
|
|
17
|
+
- Fixed HTMX URL handling in traces template to use explicit named URLs instead of relative paths for improved reliability when observer is mounted at non-root paths ([6096411](https://github.com/dropseed/plain/commit/6096411765299a9ffa5c4af4b93eb15fedb97c82))
|
|
18
|
+
|
|
19
|
+
### Upgrade instructions
|
|
20
|
+
|
|
21
|
+
- No changes required
|
|
22
|
+
|
|
23
|
+
## [0.23.1](https://github.com/dropseed/plain/releases/plain-observer@0.23.1) (2025-12-12)
|
|
24
|
+
|
|
25
|
+
### What's changed
|
|
26
|
+
|
|
27
|
+
- Added CSP nonce support to the observer.js script tag in trace templates for improved Content Security Policy compatibility ([2961042](https://github.com/dropseed/plain/commit/2961042e1cb50e851499a9fef989664934d530fd))
|
|
28
|
+
|
|
29
|
+
### Upgrade instructions
|
|
30
|
+
|
|
31
|
+
- No changes required
|
|
32
|
+
|
|
33
|
+
## [0.23.0](https://github.com/dropseed/plain/releases/plain-observer@0.23.0) (2025-12-09)
|
|
34
|
+
|
|
35
|
+
### What's changed
|
|
36
|
+
|
|
37
|
+
- The trace sharing feature has been removed, including the share URL generation and public shared trace view ([5fba11a](https://github.com/dropseed/plain/commit/5fba11a7748ba2f6309c167be44501a79141e7a4))
|
|
38
|
+
- Added a "Copy JSON" button to the trace detail view that fetches and copies the trace data as formatted JSON to the clipboard ([44a9d62](https://github.com/dropseed/plain/commit/44a9d62ad7c9a1ea7d4b9e1b6ca56316dd9d7375))
|
|
39
|
+
- The "Clear Traces" action now deletes all traces instead of only unshared ones ([5fba11a](https://github.com/dropseed/plain/commit/5fba11a7748ba2f6309c167be44501a79141e7a4))
|
|
40
|
+
|
|
41
|
+
### Upgrade instructions
|
|
42
|
+
|
|
43
|
+
- No changes required
|
|
44
|
+
|
|
45
|
+
## [0.22.0](https://github.com/dropseed/plain/releases/plain-observer@0.22.0) (2025-12-04)
|
|
46
|
+
|
|
47
|
+
### What's changed
|
|
48
|
+
|
|
49
|
+
- Improved type annotations in OTel sampler to use proper `Attributes` type from OpenTelemetry ([ac1eeb0](https://github.com/dropseed/plain/commit/ac1eeb0ea05b26dfc7e32c50f2a5a5bc7e098ceb))
|
|
50
|
+
- Added explicit foreign key ID field annotations for `Log` model to improve type safety ([ac1eeb0](https://github.com/dropseed/plain/commit/ac1eeb0ea05b26dfc7e32c50f2a5a5bc7e098ceb))
|
|
51
|
+
|
|
52
|
+
### Upgrade instructions
|
|
53
|
+
|
|
54
|
+
- No changes required
|
|
55
|
+
|
|
56
|
+
## [0.21.0](https://github.com/dropseed/plain/releases/plain-observer@0.21.0) (2025-11-24)
|
|
57
|
+
|
|
58
|
+
### What's changed
|
|
59
|
+
|
|
60
|
+
- Updated views to use `AuthView` and `HTMXView` base classes instead of mixins for improved type safety ([569afd6](https://github.com/dropseed/plain/commit/569afd606d9eb0c4d805b17487ee4a26477b3fb9))
|
|
61
|
+
- Updated request data access to use `request.form_data` instead of `request.data` for form submissions ([90332a9](https://github.com/dropseed/plain/commit/90332a9c21364644732159a539d362a7108214ac))
|
|
62
|
+
|
|
63
|
+
### Upgrade instructions
|
|
64
|
+
|
|
65
|
+
- No changes required
|
|
66
|
+
|
|
67
|
+
## [0.20.0](https://github.com/dropseed/plain/releases/plain-observer@0.20.0) (2025-11-21)
|
|
68
|
+
|
|
69
|
+
### What's changed
|
|
70
|
+
|
|
71
|
+
- Internal model field type updated from `ForeignKey` to `ForeignKeyField` to align with the Plain framework naming conventions ([8010204](https://github.com/dropseed/plain/commit/8010204b360a170433ee081385d2311a1631805c))
|
|
72
|
+
|
|
73
|
+
### Upgrade instructions
|
|
74
|
+
|
|
75
|
+
- No changes required
|
|
76
|
+
|
|
77
|
+
## [0.19.1](https://github.com/dropseed/plain/releases/plain-observer@0.19.1) (2025-11-17)
|
|
78
|
+
|
|
79
|
+
### What's changed
|
|
80
|
+
|
|
81
|
+
- QuerySet type annotations no longer use `ClassVar`, reverting to direct annotations for improved compatibility ([1c624ff](https://github.com/dropseed/plain/commit/1c624ff29ebc750650c051094041a242c06b759d))
|
|
82
|
+
|
|
83
|
+
### Upgrade instructions
|
|
84
|
+
|
|
85
|
+
- No changes required
|
|
86
|
+
|
|
87
|
+
## [0.19.0](https://github.com/dropseed/plain/releases/plain-observer@0.19.0) (2025-11-14)
|
|
88
|
+
|
|
89
|
+
### What's changed
|
|
90
|
+
|
|
91
|
+
- Models now use explicit reverse relationship descriptors (e.g., `Trace.spans`, `Trace.logs`) instead of `related_name` parameters, providing better type hints and IDE support ([a4b6309](https://github.com/dropseed/plain/commit/a4b630969dbbfa5189d357647fd06a2207929b7c))
|
|
92
|
+
- Removed unnecessary type ignore comments that are no longer needed with explicit reverse descriptors ([a4b6309](https://github.com/dropseed/plain/commit/a4b630969dbbfa5189d357647fd06a2207929b7c))
|
|
93
|
+
|
|
94
|
+
### Upgrade instructions
|
|
95
|
+
|
|
96
|
+
- No changes required
|
|
97
|
+
|
|
98
|
+
## [0.18.0](https://github.com/dropseed/plain/releases/plain-observer@0.18.0) (2025-11-13)
|
|
99
|
+
|
|
100
|
+
### What's changed
|
|
101
|
+
|
|
102
|
+
- QuerySet type annotations now use `ClassVar` for improved type checking and IDE support ([c3b00a6](https://github.com/dropseed/plain/commit/c3b00a693c5869ce4861ea1eb5b953ccd1a77ef8))
|
|
103
|
+
|
|
104
|
+
### Upgrade instructions
|
|
105
|
+
|
|
106
|
+
- No changes required
|
|
107
|
+
|
|
108
|
+
## [0.17.0](https://github.com/dropseed/plain/releases/plain-observer@0.17.0) (2025-11-13)
|
|
109
|
+
|
|
110
|
+
### What's changed
|
|
111
|
+
|
|
112
|
+
- Model fields now use type stubs (from `plain.models.types`) with proper type annotations for improved IDE support and type checking ([c8f40fc](https://github.com/dropseed/plain/commit/c8f40fc75aeb8f6a69f44cbe4a62b08bda45a425))
|
|
113
|
+
- Removed unnecessary type casts in CLI code that are no longer needed with proper field type annotations ([c8f40fc](https://github.com/dropseed/plain/commit/c8f40fc75aeb8f6a69f44cbe4a62b08bda45a425))
|
|
114
|
+
|
|
115
|
+
### Upgrade instructions
|
|
116
|
+
|
|
117
|
+
- No changes required
|
|
118
|
+
|
|
119
|
+
## [0.16.0](https://github.com/dropseed/plain/releases/plain-observer@0.16.0) (2025-11-12)
|
|
120
|
+
|
|
121
|
+
### What's changed
|
|
122
|
+
|
|
123
|
+
- Fixed type checking errors and warnings by adding type ignore comments for ORM operations that are inherently difficult to type ([f4dbcef](https://github.com/dropseed/plain/commit/f4dbcefa929058be517cb1d4ab35bd73a89f26b8))
|
|
124
|
+
|
|
125
|
+
### Upgrade instructions
|
|
126
|
+
|
|
127
|
+
- No changes required
|
|
128
|
+
|
|
129
|
+
## [0.15.0](https://github.com/dropseed/plain/releases/plain-observer@0.15.0) (2025-11-03)
|
|
130
|
+
|
|
131
|
+
### What's changed
|
|
132
|
+
|
|
133
|
+
- The `plain observer diagnose` command has been removed ([fdb9e80](https://github.com/dropseed/plain/commit/fdb9e8010386b45e843676119e929a566e3612f4))
|
|
134
|
+
- CLI command descriptions updated for consistency and brevity ([fdb9e80](https://github.com/dropseed/plain/commit/fdb9e8010386b45e843676119e929a566e3612f4))
|
|
135
|
+
- Updated AGENTS.md to reflect removal of diagnose command ([786b7a0](https://github.com/dropseed/plain/commit/786b7a0ca156392b301125b653e88874f3e727b8))
|
|
136
|
+
|
|
137
|
+
### Upgrade instructions
|
|
138
|
+
|
|
139
|
+
- No changes required
|
|
140
|
+
|
|
141
|
+
## [0.14.0](https://github.com/dropseed/plain/releases/plain-observer@0.14.0) (2025-10-29)
|
|
142
|
+
|
|
143
|
+
### What's changed
|
|
144
|
+
|
|
145
|
+
- Updated CSP configuration example in documentation to use the new `DEFAULT_RESPONSE_HEADERS` format with string templates instead of callable functions ([5199383](https://github.com/dropseed/plain/commit/519938312835b73dfd9be8c93abae6e896094fc2))
|
|
146
|
+
|
|
147
|
+
### Upgrade instructions
|
|
148
|
+
|
|
149
|
+
- No changes required
|
|
150
|
+
|
|
151
|
+
## [0.13.0](https://github.com/dropseed/plain/releases/plain-observer@0.13.0) (2025-10-29)
|
|
152
|
+
|
|
153
|
+
### What's changed
|
|
154
|
+
|
|
155
|
+
- Inline JavaScript and CSS extracted to separate asset files for Content Security Policy (CSP) compatibility ([784f3dd](https://github.com/dropseed/plain/commit/784f3dd972))
|
|
156
|
+
- Added CSP nonce support to inline scripts for improved security ([784f3dd](https://github.com/dropseed/plain/commit/784f3dd972))
|
|
157
|
+
- Added comprehensive CSP configuration documentation in README, including required `frame-ancestors 'self'` directive for toolbar panel ([784f3dd](https://github.com/dropseed/plain/commit/784f3dd972))
|
|
158
|
+
- Span and log indentation now uses CSS classes with data attributes instead of inline styles ([784f3dd](https://github.com/dropseed/plain/commit/784f3dd972))
|
|
159
|
+
- Timeline bar positioning now uses CSS custom properties set via JavaScript instead of inline styles ([784f3dd](https://github.com/dropseed/plain/commit/784f3dd972))
|
|
160
|
+
- Copy share URL button now uses data attributes and event delegation instead of inline onclick handlers ([784f3dd](https://github.com/dropseed/plain/commit/784f3dd972))
|
|
161
|
+
- Toolbar iframe now uses HTML attributes instead of inline styles ([784f3dd](https://github.com/dropseed/plain/commit/784f3dd972))
|
|
162
|
+
|
|
163
|
+
### Upgrade instructions
|
|
164
|
+
|
|
165
|
+
- No changes required
|
|
166
|
+
|
|
167
|
+
## [0.12.0](https://github.com/dropseed/plain/releases/plain-observer@0.12.0) (2025-10-24)
|
|
168
|
+
|
|
169
|
+
### What's changed
|
|
170
|
+
|
|
171
|
+
- Admin viewsets now use `presets` instead of `displays` for predefined queryset filters ([0ecc60f](https://github.com/dropseed/plain/commit/0ecc60f19e))
|
|
172
|
+
- Removed `logger` field from Log admin interface for simplified display ([ae43138](https://github.com/dropseed/plain/commit/ae43138863))
|
|
173
|
+
- Removed `/admin/.*` from default ignored URL patterns, allowing admin pages to be traced ([daadf1a](https://github.com/dropseed/plain/commit/daadf1a53d))
|
|
174
|
+
|
|
175
|
+
### Upgrade instructions
|
|
176
|
+
|
|
177
|
+
- If you have custom admin viewsets using the `displays` attribute, rename it to `presets`
|
|
178
|
+
- If you reference the `display` property in custom admin code (e.g., `self.display`), rename it to `self.preset`
|
|
179
|
+
|
|
180
|
+
## [0.11.2](https://github.com/dropseed/plain/releases/plain-observer@0.11.2) (2025-10-20)
|
|
181
|
+
|
|
182
|
+
### What's changed
|
|
183
|
+
|
|
184
|
+
- Package configuration migrated from `tool.uv.dev-dependencies` to the standard `dependency-groups.dev` format ([1b43a3a](https://github.com/dropseed/plain/commit/1b43a3a272))
|
|
185
|
+
|
|
186
|
+
### Upgrade instructions
|
|
187
|
+
|
|
188
|
+
- No changes required
|
|
189
|
+
|
|
190
|
+
## [0.11.1](https://github.com/dropseed/plain/releases/plain-observer@0.11.1) (2025-10-10)
|
|
191
|
+
|
|
192
|
+
### What's changed
|
|
193
|
+
|
|
194
|
+
- Trace list items now update the URL when clicked, allowing direct linking to specific traces ([9f29b68](https://github.com/dropseed/plain/commit/9f29b68a87))
|
|
195
|
+
- Improved trace sidebar layout by moving the timestamp to the bottom right and creating better visual hierarchy ([9f29b68](https://github.com/dropseed/plain/commit/9f29b68a87))
|
|
196
|
+
- Updated diagnose command prompt text to be less personal in tone ([c82d67b](https://github.com/dropseed/plain/commit/c82d67bfcf))
|
|
197
|
+
|
|
198
|
+
### Upgrade instructions
|
|
199
|
+
|
|
200
|
+
- No changes required
|
|
201
|
+
|
|
202
|
+
## [0.11.0](https://github.com/dropseed/plain/releases/plain-observer@0.11.0) (2025-10-08)
|
|
203
|
+
|
|
204
|
+
### What's changed
|
|
205
|
+
|
|
206
|
+
- Observer can now be enabled in DEBUG mode using an `Observer` HTTP header (e.g., `Observer: persist` or `Observer: summary`), which takes precedence over cookies ([cba149a](https://github.com/dropseed/plain/commit/cba149a40e))
|
|
207
|
+
- Added validation for observer mode values that raises helpful errors in DEBUG mode when invalid values are provided ([cba149a](https://github.com/dropseed/plain/commit/cba149a40e))
|
|
208
|
+
- Refactored `Observer` class to accept cookies and headers as constructor parameters, with new `from_request()` and `from_otel_context()` factory methods for improved testability ([cba149a](https://github.com/dropseed/plain/commit/cba149a40e))
|
|
209
|
+
- Added AGENTS.md file with helpful commands for AI agents working with Plain Observer ([cba149a](https://github.com/dropseed/plain/commit/cba149a40e))
|
|
210
|
+
|
|
211
|
+
### Upgrade instructions
|
|
212
|
+
|
|
213
|
+
- No changes required
|
|
214
|
+
|
|
215
|
+
## [0.10.1](https://github.com/dropseed/plain/releases/plain-observer@0.10.1) (2025-10-08)
|
|
216
|
+
|
|
217
|
+
### What's changed
|
|
218
|
+
|
|
219
|
+
- Fixed content negotiation priority in trace detail and shared views to prefer HTML over JSON by default ([00212835aa](https://github.com/dropseed/plain/commit/00212835aa))
|
|
220
|
+
|
|
221
|
+
### Upgrade instructions
|
|
222
|
+
|
|
223
|
+
- No changes required
|
|
224
|
+
|
|
225
|
+
## [0.10.0](https://github.com/dropseed/plain/releases/plain-observer@0.10.0) (2025-10-07)
|
|
226
|
+
|
|
227
|
+
### What's changed
|
|
228
|
+
|
|
229
|
+
- Model configuration now uses `model_options` descriptor instead of `class Meta` for improved consistency with Plain framework patterns ([17a378d](https://github.com/dropseed/plain/commit/17a378dcfb))
|
|
230
|
+
- Custom QuerySet classes are now defined as descriptors on the model class instead of being configured in Meta ([2578301](https://github.com/dropseed/plain/commit/2578301819))
|
|
231
|
+
- Internal model metadata split into separate `model_options` and `_model_meta` attributes for better organization ([73ba469](https://github.com/dropseed/plain/commit/73ba469ba0))
|
|
232
|
+
|
|
233
|
+
### Upgrade instructions
|
|
234
|
+
|
|
235
|
+
- No changes required
|
|
236
|
+
|
|
237
|
+
## [0.9.1](https://github.com/dropseed/plain/releases/plain-observer@0.9.1) (2025-10-06)
|
|
238
|
+
|
|
239
|
+
### What's changed
|
|
240
|
+
|
|
241
|
+
- Added comprehensive type annotations throughout the package for improved IDE support and type checking ([ffb8624](https://github.com/dropseed/plain/commit/ffb8624d6f))
|
|
242
|
+
- Package has been validated with 100% type coverage and added to the type validation script ([ffb8624](https://github.com/dropseed/plain/commit/ffb8624d6f))
|
|
243
|
+
|
|
244
|
+
### Upgrade instructions
|
|
245
|
+
|
|
246
|
+
- No changes required
|
|
247
|
+
|
|
248
|
+
## [0.9.0](https://github.com/dropseed/plain/releases/plain-observer@0.9.0) (2025-09-30)
|
|
249
|
+
|
|
250
|
+
### What's changed
|
|
251
|
+
|
|
252
|
+
- Settings renamed from `APP_NAME` to `NAME` and `APP_VERSION` to `VERSION` for consistency with Plain conventions ([4c5f216](https://github.com/dropseed/plain/commit/4c5f2166c1))
|
|
253
|
+
- Trace detail and shared views now use `request.get_preferred_type()` for improved content negotiation ([b105ba4](https://github.com/dropseed/plain/commit/b105ba4dd0))
|
|
254
|
+
|
|
255
|
+
### Upgrade instructions
|
|
256
|
+
|
|
257
|
+
- No changes required
|
|
258
|
+
|
|
259
|
+
## [0.8.0](https://github.com/dropseed/plain/releases/plain-observer@0.8.0) (2025-09-30)
|
|
260
|
+
|
|
261
|
+
### What's changed
|
|
262
|
+
|
|
263
|
+
- The toolbar panel class has been renamed from `ToolbarPanel` to `ToolbarItem` for better clarity and consistency ([79654db](https://github.com/dropseed/plain/commit/79654db))
|
|
264
|
+
- The `template_name` attribute has been renamed to `panel_template_name` in toolbar items ([79654db](https://github.com/dropseed/plain/commit/79654db))
|
|
265
|
+
- The registration decorator has been renamed from `register_toolbar_panel` to `register_toolbar_item` ([79654db](https://github.com/dropseed/plain/commit/79654db))
|
|
266
|
+
|
|
267
|
+
### Upgrade instructions
|
|
268
|
+
|
|
269
|
+
- If you have custom toolbar panels, rename your class from inheriting `ToolbarPanel` to `ToolbarItem`
|
|
270
|
+
- If you use the `template_name` attribute in your toolbar items, rename it to `panel_template_name`
|
|
271
|
+
- If you use the `@register_toolbar_panel` decorator, change it to `@register_toolbar_item`
|
|
272
|
+
|
|
273
|
+
## [0.7.0](https://github.com/dropseed/plain/releases/plain-observer@0.7.0) (2025-09-12)
|
|
274
|
+
|
|
275
|
+
### What's changed
|
|
276
|
+
|
|
277
|
+
- Model manager renamed from `objects` to `query` throughout the codebase for consistency with Plain framework conventions ([037a239](https://github.com/dropseed/plain/commit/037a239ef4))
|
|
278
|
+
- Updated internal QuerySet configuration to use `queryset_class` instead of `manager_class` in model Meta ([bbaee93](https://github.com/dropseed/plain/commit/bbaee93839))
|
|
279
|
+
- Simplified manager initialization by removing explicit `objects` assignment in favor of Meta configuration ([6b60a00](https://github.com/dropseed/plain/commit/6b60a00731))
|
|
280
|
+
|
|
281
|
+
### Upgrade instructions
|
|
282
|
+
|
|
283
|
+
- Replace any direct usage of `Trace.objects` with `Trace.query` in your code
|
|
284
|
+
- Replace any direct usage of `Span.objects` with `Span.query` in your code
|
|
285
|
+
- Replace any direct usage of `Log.objects` with `Log.query` in your code
|
|
286
|
+
|
|
287
|
+
## [0.6.2](https://github.com/dropseed/plain/releases/plain-observer@0.6.2) (2025-09-09)
|
|
288
|
+
|
|
289
|
+
### What's changed
|
|
290
|
+
|
|
291
|
+
- Improved traces sidebar layout by simplifying the display structure and making better use of space ([da789d19](https://github.com/dropseed/plain/commit/da789d1926))
|
|
292
|
+
|
|
293
|
+
### Upgrade instructions
|
|
294
|
+
|
|
295
|
+
- No changes required
|
|
296
|
+
|
|
297
|
+
## [0.6.1](https://github.com/dropseed/plain/releases/plain-observer@0.6.1) (2025-09-09)
|
|
298
|
+
|
|
299
|
+
### What's changed
|
|
300
|
+
|
|
301
|
+
- 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))
|
|
302
|
+
- Observer log handler now copies the formatter from the app logger to ensure consistent log formatting ([b646699](https://github.com/dropseed/plain/commit/b646699e46))
|
|
303
|
+
- Simplified log display template by removing redundant level display element ([b646699](https://github.com/dropseed/plain/commit/b646699e46))
|
|
304
|
+
|
|
305
|
+
### Upgrade instructions
|
|
306
|
+
|
|
307
|
+
- No changes required
|
|
308
|
+
|
|
309
|
+
## [0.6.0](https://github.com/dropseed/plain/releases/plain-observer@0.6.0) (2025-09-09)
|
|
310
|
+
|
|
311
|
+
### What's changed
|
|
312
|
+
|
|
313
|
+
- Added comprehensive log capture and display during trace recording, with logs shown in a unified timeline alongside spans ([9bfe938](https://github.com/dropseed/plain/commit/9bfe938f64))
|
|
314
|
+
- Added new Log model with admin interface for managing captured log entries ([9bfe938](https://github.com/dropseed/plain/commit/9bfe938f64))
|
|
315
|
+
- Observer now automatically enables debug logging during trace recording to capture more detailed information ([731196](https://github.com/dropseed/plain/commit/731196086f))
|
|
316
|
+
- Added app_name and app_version fields to trace records for better application identification ([2870636](https://github.com/dropseed/plain/commit/2870636944))
|
|
317
|
+
- Added span count display in trace detail views ([4d22c10](https://github.com/dropseed/plain/commit/4d22c1058d))
|
|
318
|
+
- Enhanced database query counting to only include queries with actual query text, providing more accurate metrics ([3d102d3](https://github.com/dropseed/plain/commit/3d102d3796))
|
|
319
|
+
- Improved trace limit cleanup logic to properly maintain the configured trace limit ([e9d124b](https://github.com/dropseed/plain/commit/e9d124bccd))
|
|
320
|
+
- Added source code location attributes support for spans with file path, line number, and function information ([da36a17](https://github.com/dropseed/plain/commit/da36a17dab))
|
|
321
|
+
- Updated Python version requirement to 3.13 minimum ([d86e307](https://github.com/dropseed/plain/commit/d86e307efb))
|
|
322
|
+
|
|
323
|
+
### Upgrade instructions
|
|
324
|
+
|
|
325
|
+
- No changes required
|
|
326
|
+
|
|
327
|
+
## [0.5.0](https://github.com/dropseed/plain/releases/plain-observer@0.5.0) (2025-09-03)
|
|
328
|
+
|
|
329
|
+
### What's changed
|
|
330
|
+
|
|
331
|
+
- Extended observer summary mode cookie duration from 1 day to 1 week for improved user experience ([bbe8a8a](https://github.com/dropseed/plain/commit/bbe8a8ad54))
|
|
332
|
+
- Changed admin navigation icon for Spans from "diagram-3" to "activity" ([2aac07d](https://github.com/dropseed/plain/commit/2aac07de4e))
|
|
333
|
+
|
|
334
|
+
### Upgrade instructions
|
|
335
|
+
|
|
336
|
+
- No changes required
|
|
337
|
+
|
|
338
|
+
## [0.4.0](https://github.com/dropseed/plain/releases/plain-observer@0.4.0) (2025-08-27)
|
|
339
|
+
|
|
340
|
+
### What's changed
|
|
341
|
+
|
|
342
|
+
- Toolbar functionality has been moved to a new `plain.toolbar` package, with observer-specific toolbar code now in a dedicated `toolbar.py` file ([e49d54b](https://github.com/dropseed/plain/commit/e49d54bfea))
|
|
343
|
+
|
|
344
|
+
### Upgrade instructions
|
|
345
|
+
|
|
346
|
+
- No changes required
|
|
347
|
+
|
|
348
|
+
## [0.3.7](https://github.com/dropseed/plain/releases/plain-observer@0.3.7) (2025-08-22)
|
|
349
|
+
|
|
350
|
+
### What's changed
|
|
351
|
+
|
|
352
|
+
- Improved admin interface code organization by reordering navigation icon and model field declarations ([5a6479a](https://github.com/dropseed/plain/commit/5a6479ac79))
|
|
353
|
+
|
|
354
|
+
### Upgrade instructions
|
|
355
|
+
|
|
356
|
+
- No changes required
|
|
357
|
+
|
|
358
|
+
## [0.3.6](https://github.com/dropseed/plain/releases/plain-observer@0.3.6) (2025-07-31)
|
|
359
|
+
|
|
360
|
+
### What's changed
|
|
361
|
+
|
|
362
|
+
- Added database index on `span_id` field in the Span model for improved query performance ([f836542](https://github.com/dropseed/plain/commit/f836542df6))
|
|
363
|
+
- Database tracing is now suppressed when querying for span links to prevent recursive tracing loops ([f836542](https://github.com/dropseed/plain/commit/f836542df6))
|
|
364
|
+
|
|
365
|
+
### Upgrade instructions
|
|
366
|
+
|
|
367
|
+
- No changes required
|
|
368
|
+
|
|
369
|
+
## [0.3.5](https://github.com/dropseed/plain/releases/plain-observer@0.3.5) (2025-07-30)
|
|
370
|
+
|
|
371
|
+
### What's changed
|
|
372
|
+
|
|
373
|
+
- Improved observer toolbar button text clarity for empty states - "Recording" now shows as "Recording (no summary)" and "Summary" shows as "No summary" ([143c2a6](https://github.com/dropseed/plain/commit/143c2a61a7))
|
|
374
|
+
- Fixed observer auto-enable functionality by adding POST handler for summary mode actions ([cc415e0](https://github.com/dropseed/plain/commit/cc415e0af7))
|
|
375
|
+
|
|
376
|
+
### Upgrade instructions
|
|
377
|
+
|
|
378
|
+
- No changes required
|
|
379
|
+
|
|
380
|
+
## [0.3.4](https://github.com/dropseed/plain/releases/plain-observer@0.3.4) (2025-07-30)
|
|
381
|
+
|
|
382
|
+
### What's changed
|
|
383
|
+
|
|
384
|
+
- Fixed URL configuration examples in installation documentation to use `ObserverRouter` instead of string path ([f55ac7d](https://github.com/dropseed/plain/commit/f55ac7d491))
|
|
385
|
+
- Enhanced README with table of contents, PyPI installation link, and post-installation usage instructions ([4ebecd1](https://github.com/dropseed/plain/commit/4ebecd1856))
|
|
386
|
+
|
|
387
|
+
### Upgrade instructions
|
|
388
|
+
|
|
389
|
+
- No changes required
|
|
390
|
+
|
|
391
|
+
## [0.3.3](https://github.com/dropseed/plain/releases/plain-observer@0.3.3) (2025-07-25)
|
|
392
|
+
|
|
393
|
+
### What's changed
|
|
394
|
+
|
|
395
|
+
- Added `--print` option to the `plain observer diagnose` command to print prompts without running agents ([9721331](https://github.com/dropseed/plain/commit/9721331e40))
|
|
396
|
+
- The `plain observer diagnose` command now uses the shared `prompt_agent` utility for better consistency ([de1fa72](https://github.com/dropseed/plain/commit/de1fa7253a))
|
|
397
|
+
- Added comprehensive installation instructions to the README including package installation, URL configuration, and migration steps ([950939b](https://github.com/dropseed/plain/commit/950939b619))
|
|
398
|
+
|
|
399
|
+
### Upgrade instructions
|
|
400
|
+
|
|
401
|
+
- No changes required
|
|
402
|
+
|
|
403
|
+
## [0.3.2](https://github.com/dropseed/plain/releases/plain-observer@0.3.2) (2025-07-25)
|
|
404
|
+
|
|
405
|
+
### What's changed
|
|
406
|
+
|
|
407
|
+
- The diagnose agent command now instructs the AI to examine the codebase before making suggestions ([f5ae388](https://github.com/dropseed/plain/commit/f5ae388833))
|
|
408
|
+
|
|
409
|
+
### Upgrade instructions
|
|
410
|
+
|
|
411
|
+
- No changes required
|
|
412
|
+
|
|
413
|
+
## [0.3.1](https://github.com/dropseed/plain/releases/plain-observer@0.3.1) (2025-07-23)
|
|
414
|
+
|
|
415
|
+
### What's changed
|
|
416
|
+
|
|
417
|
+
- Added delete actions to the admin interface for both Traces and Spans, allowing bulk deletion of selected items ([0d85670](https://github.com/dropseed/plain/commit/0d85670412))
|
|
418
|
+
- Added bootstrap icons to admin navigation (activity icon for Traces, diagram-3 icon for Spans) ([9e9f8b0](https://github.com/dropseed/plain/commit/9e9f8b0e2c))
|
|
419
|
+
|
|
420
|
+
### Upgrade instructions
|
|
421
|
+
|
|
422
|
+
- No changes required
|
|
423
|
+
|
|
424
|
+
## [0.3.0](https://github.com/dropseed/plain/releases/plain-observer@0.3.0) (2025-07-22)
|
|
425
|
+
|
|
426
|
+
### What's changed
|
|
427
|
+
|
|
428
|
+
- Database models now use the new `PrimaryKeyField` instead of `BigAutoField` for primary keys ([4b8fa6a](https://github.com/dropseed/plain/commit/4b8fa6aef1))
|
|
429
|
+
- Admin interface updated to use `id` instead of `pk` for ordering and references ([4b8fa6a](https://github.com/dropseed/plain/commit/4b8fa6aef1))
|
|
430
|
+
|
|
431
|
+
### Upgrade instructions
|
|
432
|
+
|
|
433
|
+
- No changes required
|
|
434
|
+
|
|
435
|
+
## [0.2.0](https://github.com/dropseed/plain/releases/plain-observer@0.2.0) (2025-07-21)
|
|
436
|
+
|
|
437
|
+
### What's changed
|
|
438
|
+
|
|
439
|
+
- Added comprehensive CLI commands for trace management including `plain observer traces`, `plain observer trace <id>`, and `plain observer spans` ([90f916b](https://github.com/dropseed/plain/commit/90f916b676))
|
|
440
|
+
- Added trace sharing functionality allowing traces to be shared via public URLs ([90f916b](https://github.com/dropseed/plain/commit/90f916b676))
|
|
441
|
+
- Added `plain observer diagnose` command with JSON and URL output options for troubleshooting ([71936e88a5](https://github.com/dropseed/plain/commit/71936e88a5))
|
|
442
|
+
- Improved trace detail UI with better formatting and navigation ([90f916b](https://github.com/dropseed/plain/commit/90f916b676))
|
|
443
|
+
- Removed the custom trace detail UI from the admin interface, now uses standard admin detail view ([0c277fc](https://github.com/dropseed/plain/commit/0c277fc076))
|
|
444
|
+
- Enhanced raw agent prompt output styling ([684f208](https://github.com/dropseed/plain/commit/684f2087fc))
|
|
445
|
+
|
|
446
|
+
### Upgrade instructions
|
|
447
|
+
|
|
448
|
+
- No changes required
|
|
449
|
+
|
|
450
|
+
## [0.1.0](https://github.com/dropseed/plain/releases/plain-observer@0.1.0) (2025-07-19)
|
|
451
|
+
|
|
452
|
+
### What's changed
|
|
453
|
+
|
|
454
|
+
- Initial release of plain-observer package providing OpenTelemetry-based observability and monitoring for Plain applications ([b0224d0](https://github.com/dropseed/plain/commit/b0224d0418))
|
|
455
|
+
- Added real-time trace monitoring with summary and persist modes via signed cookies ([b0224d0](https://github.com/dropseed/plain/commit/b0224d0418))
|
|
456
|
+
- Added admin interface for viewing detailed trace information and spans ([b0224d0](https://github.com/dropseed/plain/commit/b0224d0418))
|
|
457
|
+
- Added toolbar integration showing performance summaries for current requests ([b0224d0](https://github.com/dropseed/plain/commit/b0224d0418))
|
|
458
|
+
- Observer can now combine with existing OpenTelemetry trace providers instead of replacing them ([7e55779](https://github.com/dropseed/plain/commit/7e55779548))
|
|
459
|
+
|
|
460
|
+
### Upgrade instructions
|
|
461
|
+
|
|
462
|
+
- No changes required
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# plain.observer
|
|
2
|
+
|
|
3
|
+
**On-page telemetry and observability tools for Plain.**
|
|
4
|
+
|
|
5
|
+
- [Installation](#installation)
|
|
6
|
+
- [Content Security Policy (CSP)](#content-security-policy-csp)
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
Install the `plain.observer` package from [PyPI](https://pypi.org/project/plain.observer/):
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
uv add plain.observer
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Add `plain.observer` to your `INSTALLED_PACKAGES`:
|
|
17
|
+
|
|
18
|
+
```python
|
|
19
|
+
# app/settings.py
|
|
20
|
+
INSTALLED_PACKAGES = [
|
|
21
|
+
# ...
|
|
22
|
+
"plain.observer",
|
|
23
|
+
]
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Include the observer URLs in your URL configuration:
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
# app/urls.py
|
|
30
|
+
from plain.observer.urls import ObserverRouter
|
|
31
|
+
from plain.urls import Router, include
|
|
32
|
+
|
|
33
|
+
class AppRouter(Router):
|
|
34
|
+
namespace = ""
|
|
35
|
+
urls = [
|
|
36
|
+
# ...
|
|
37
|
+
include("observer/", ObserverRouter),
|
|
38
|
+
]
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Run migrations to create the necessary database tables:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
plain migrate
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
After installation, Observer will automatically integrate with your application's toolbar (if using `plain.admin`). You can access the web interface at `/observer/traces/` or use the CLI commands to analyze traces.
|
|
48
|
+
|
|
49
|
+
## Content Security Policy (CSP)
|
|
50
|
+
|
|
51
|
+
If you're using a Content Security Policy (CSP), the Observer toolbar panel requires `frame-ancestors 'self'` to display trace information in an iframe.
|
|
52
|
+
|
|
53
|
+
Without this directive, the toolbar panel will fail to load with a CSP error: `"Refused to frame... because an ancestor violates the following Content Security Policy directive: 'frame-ancestors 'none'"`.
|
|
54
|
+
|
|
55
|
+
Example CSP configuration:
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
DEFAULT_RESPONSE_HEADERS = {
|
|
59
|
+
"Content-Security-Policy": (
|
|
60
|
+
"default-src 'self'; "
|
|
61
|
+
"script-src 'self' 'nonce-{request.csp_nonce}'; "
|
|
62
|
+
"style-src 'self' 'nonce-{request.csp_nonce}'; "
|
|
63
|
+
"frame-ancestors 'self'; " # Required for Observer toolbar
|
|
64
|
+
# ... other directives
|
|
65
|
+
),
|
|
66
|
+
}
|
|
67
|
+
```
|
|
File without changes
|