deepctl-telemetry 0.0.3__tar.gz → 0.0.5__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deepctl-telemetry
3
- Version: 0.0.3
3
+ Version: 0.0.5
4
4
  Summary: Opt-out phone-home telemetry for deepctl
5
5
  Author-email: Deepgram <devrel@deepgram.com>
6
6
  Maintainer-email: Deepgram <devrel@deepgram.com>
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "deepctl-telemetry"
7
- version = "0.0.3" # x-release-please-version
7
+ version = "0.0.5" # x-release-please-version
8
8
  description = "Opt-out phone-home telemetry for deepctl"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -10,4 +10,4 @@ __all__ = [
10
10
  "render_notice",
11
11
  ]
12
12
 
13
- __version__ = "0.0.3" # x-release-please-version
13
+ __version__ = "0.0.5" # x-release-please-version
@@ -64,9 +64,11 @@ def init_telemetry(config: Config) -> bool:
64
64
  environment="production",
65
65
  send_default_pii=False,
66
66
  auto_session_tracking=True,
67
- traces_sample_rate=0.0,
68
- profiles_sample_rate=0.0,
69
- max_breadcrumbs=20,
67
+ traces_sample_rate=1.0,
68
+ profiles_sample_rate=1.0,
69
+ enable_logs=True,
70
+ attach_stacktrace=True,
71
+ max_breadcrumbs=100,
70
72
  before_send=_scrub_event,
71
73
  )
72
74
 
@@ -78,6 +80,7 @@ def init_telemetry(config: Config) -> bool:
78
80
  )
79
81
  sentry_sdk.set_tag("cli.version", cli_version)
80
82
 
83
+ sentry_sdk.start_session()
81
84
  atexit.register(_flush_on_exit)
82
85
 
83
86
  _initialized = True
@@ -100,13 +103,46 @@ def _read_cli_version() -> str:
100
103
  return importlib.metadata.version("deepctl")
101
104
 
102
105
 
106
+ _MCP_NOISE_LOGGERS = frozenset(
107
+ {
108
+ "mcp.client.streamable_http",
109
+ "mcp.server.lowlevel.server",
110
+ }
111
+ )
112
+
113
+
114
+ def _is_mcp_transient_noise(event: Event) -> bool:
115
+ """Identify log events from the MCP SDK that are not actionable bugs.
116
+
117
+ `dg mcp` embeds the upstream `mcp` Python SDK, which logs to Sentry via
118
+ the logging integration whenever the upstream MCP server returns 5xx
119
+ (handled by the client) or the stdio peer closes mid-message (handled by
120
+ the server). Both are recovered internally. Surfacing them as Sentry
121
+ issues just creates triage cost for the DX team and hides real CLI bugs.
122
+
123
+ Any unhandled exception is kept regardless of logger.
124
+ """
125
+ if (event.get("logger") or "") not in _MCP_NOISE_LOGGERS:
126
+ return False
127
+ for exc in (event.get("exception") or {}).get("values") or []:
128
+ mechanism = exc.get("mechanism") or {}
129
+ if mechanism.get("handled") is False:
130
+ return False
131
+ return True
132
+
133
+
103
134
  def _scrub_event(event: Event, _hint: Hint) -> Event | None:
104
135
  """Drop request bodies, headers, and any user-identifying data.
105
136
 
106
137
  Sentry SDK already filters most PII via send_default_pii=False, but
107
138
  Auth tokens, project IDs, and file paths can still leak through
108
139
  breadcrumbs and exception messages. This is a defense-in-depth scrub.
140
+
141
+ Also drops known-noise events (see ``_is_mcp_transient_noise``).
109
142
  """
143
+ if _is_mcp_transient_noise(event):
144
+ return None
145
+
110
146
  request: dict[str, Any] = event.get("request") or {}
111
147
  if "headers" in request:
112
148
  request["headers"] = {}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deepctl-telemetry
3
- Version: 0.0.3
3
+ Version: 0.0.5
4
4
  Summary: Opt-out phone-home telemetry for deepctl
5
5
  Author-email: Deepgram <devrel@deepgram.com>
6
6
  Maintainer-email: Deepgram <devrel@deepgram.com>