Skip to content

Commit c948fa1

Browse files
committed
CASSPYTHON-24 Remove Insights support
patch by Bret McGuire; reviewed by Bret McGuire and Brad Schoening
1 parent 8b39688 commit c948fa1

11 files changed

Lines changed: 12 additions & 1151 deletions

File tree

‎cassandra/cluster.py‎

Lines changed: 8 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,8 @@
3131
import logging
3232
from warnings import warn
3333
from random import random
34-
import re
3534
import queue
3635
import socket
37-
import sys
3836
import time
3937
from threading import Lock, RLock, Thread, Event
4038
import uuid
@@ -83,9 +81,6 @@
8381
from cassandra.timestamps import MonotonicTimestampGenerator
8482
from cassandra.util import _resolve_contact_points_to_string_map, Version
8583

86-
from cassandra.datastax.insights.reporter import MonitorReporter
87-
from cassandra.datastax.insights.util import version_supports_insights
88-
8984
from cassandra.datastax.graph import (graph_object_row_factory, GraphOptions, GraphSON1Serializer,
9085
GraphProtocol, GraphSON2Serializer, GraphStatement, SimpleGraphStatement,
9186
graph_graphson2_row_factory, graph_graphson3_row_factory,
@@ -950,34 +945,6 @@ def default_retry_policy(self, policy):
950945
documentation for :meth:`Session.timestamp_generator`.
951946
"""
952947

953-
monitor_reporting_enabled = True
954-
"""
955-
A boolean indicating if monitor reporting, which sends gathered data to
956-
Insights when running against DSE 6.8 and higher.
957-
"""
958-
959-
monitor_reporting_interval = 30
960-
"""
961-
A boolean indicating if monitor reporting, which sends gathered data to
962-
Insights when running against DSE 6.8 and higher.
963-
"""
964-
965-
client_id = None
966-
"""
967-
A UUID that uniquely identifies this Cluster object to Insights. This will
968-
be generated automatically unless the user provides one.
969-
"""
970-
971-
application_name = ''
972-
"""
973-
A string identifying this application to Insights.
974-
"""
975-
976-
application_version = ''
977-
"""
978-
A string identifying this application's version to Insights
979-
"""
980-
981948
cloud = None
982949
"""
983950
A dict of the cloud configuration. Example::
@@ -1096,11 +1063,6 @@ def __init__(self,
10961063
no_compact=False,
10971064
ssl_context=None,
10981065
endpoint_factory=None,
1099-
application_name=None,
1100-
application_version=None,
1101-
monitor_reporting_enabled=True,
1102-
monitor_reporting_interval=30,
1103-
client_id=None,
11041066
cloud=None,
11051067
column_encryption_policy=None):
11061068
"""
@@ -1159,8 +1121,6 @@ def __init__(self,
11591121
raw_contact_points.append(cp if isinstance(cp, tuple) else (cp, port))
11601122

11611123
self.endpoints_resolved = [cp for cp in self.contact_points if isinstance(cp, EndPoint)]
1162-
self._endpoint_map_for_insights = {repr(ep): '{ip}:{port}'.format(ip=ep.address, port=ep.port)
1163-
for ep in self.endpoints_resolved}
11641124

11651125
strs_resolved_map = _resolve_contact_points_to_string_map(raw_contact_points)
11661126
self.endpoints_resolved.extend(list(chain(
@@ -1170,14 +1130,14 @@ def __init__(self,
11701130
]
11711131
)))
11721132

1173-
self._endpoint_map_for_insights.update(
1174-
{key: ['{ip}:{port}'.format(ip=ip, port=port) for ip, port in value]
1175-
for key, value in strs_resolved_map.items() if value is not None}
1176-
)
1177-
11781133
if contact_points and (not self.endpoints_resolved):
11791134
# only want to raise here if the user specified CPs but resolution failed
1180-
raise UnresolvableContactPoints(self._endpoint_map_for_insights)
1135+
endpoint_map = {repr(ep): '{ip}:{port}'.format(ip=ep.address, port=ep.port) for ep in self.endpoints_resolved}
1136+
endpoint_map.update(
1137+
{key: ['{ip}:{port}'.format(ip=ip, port=port) for ip, port in value]
1138+
for key, value in strs_resolved_map.items() if value is not None}
1139+
)
1140+
raise UnresolvableContactPoints(endpoint_map)
11811141

11821142
self.compression = compression
11831143

@@ -1301,8 +1261,6 @@ def __init__(self,
13011261
self.connect_timeout = connect_timeout
13021262
self.prepare_on_all_hosts = prepare_on_all_hosts
13031263
self.reprepare_on_up = reprepare_on_up
1304-
self.monitor_reporting_enabled = monitor_reporting_enabled
1305-
self.monitor_reporting_interval = monitor_reporting_interval
13061264

13071265
self._listeners = set()
13081266
self._listener_lock = Lock()
@@ -1352,13 +1310,6 @@ def __init__(self,
13521310
self.status_event_refresh_window,
13531311
schema_metadata_enabled, token_metadata_enabled)
13541312

1355-
if client_id is None:
1356-
self.client_id = uuid.uuid4()
1357-
if application_name is not None:
1358-
self.application_name = application_name
1359-
if application_version is not None:
1360-
self.application_version = application_version
1361-
13621313
def register_user_type(self, keyspace, user_type, klass):
13631314
"""
13641315
Registers a class to use to represent a particular user-defined type.
@@ -2473,8 +2424,7 @@ def default_serial_consistency_level(self, cl):
24732424

24742425
session_id = None
24752426
"""
2476-
A UUID that uniquely identifies this Session to Insights. This will be
2477-
generated automatically.
2427+
A UUID that uniquely identifies this Session. This will be generated automatically.
24782428
"""
24792429

24802430
_lock = None
@@ -2527,22 +2477,7 @@ def __init__(self, cluster, hosts, keyspace=None):
25272477
except AttributeError:
25282478
log.info("Unable to set column encryption policy for session")
25292479

2530-
if self.cluster.monitor_reporting_enabled:
2531-
cc_host = self.cluster.get_control_connection_host()
2532-
valid_insights_version = (cc_host and version_supports_insights(cc_host.dse_version))
2533-
if valid_insights_version:
2534-
self._monitor_reporter = MonitorReporter(
2535-
interval_sec=self.cluster.monitor_reporting_interval,
2536-
session=self,
2537-
)
2538-
else:
2539-
if cc_host:
2540-
log.debug('Not starting MonitorReporter thread for Insights; '
2541-
'not supported by server version {v} on '
2542-
'ControlConnection host {c}'.format(v=cc_host.release_version, c=cc_host))
2543-
2544-
log.debug('Started Session with client_id {} and session_id {}'.format(self.cluster.client_id,
2545-
self.session_id))
2480+
log.debug('Started Session with session_id {}'.format(self.session_id))
25462481

25472482
def execute(self, query, parameters=None, timeout=_NOT_SET, trace=False,
25482483
custom_payload=None, execution_profile=EXEC_PROFILE_DEFAULT,

‎cassandra/datastax/insights/__init__.py‎

Lines changed: 0 additions & 15 deletions
This file was deleted.

‎cassandra/datastax/insights/registry.py‎

Lines changed: 0 additions & 124 deletions
This file was deleted.

0 commit comments

Comments
 (0)