Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 6 additions & 71 deletions cassandra/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,6 @@
from cassandra.timestamps import MonotonicTimestampGenerator
from cassandra.util import _resolve_contact_points_to_string_map, Version, maybe_add_timeout_to_query

from cassandra.datastax.insights.reporter import MonitorReporter
from cassandra.datastax.insights.util import version_supports_insights

from cassandra.datastax.graph import (graph_object_row_factory, GraphOptions, GraphSON1Serializer,
GraphProtocol, GraphSON2Serializer, GraphStatement, SimpleGraphStatement,
graph_graphson2_row_factory, graph_graphson3_row_factory,
Expand Down Expand Up @@ -1077,34 +1074,6 @@ def default_retry_policy(self, policy):
documentation for :meth:`Session.timestamp_generator`.
"""

monitor_reporting_enabled = False
"""
A boolean indicating if monitor reporting, which sends gathered data to
Insights when running against DSE 6.8 and higher.
"""

monitor_reporting_interval = 30
"""
A boolean indicating if monitor reporting, which sends gathered data to
Insights when running against DSE 6.8 and higher.
"""

client_id = None
"""
A UUID that uniquely identifies this Cluster object to Insights. This will
be generated automatically unless the user provides one.
"""

application_name = ''
"""
A string identifying this application to Insights.
"""

application_version = ''
"""
A string identifiying this application's version to Insights
"""

cloud = None
"""
A dict of the cloud configuration. Example::
Expand Down Expand Up @@ -1256,11 +1225,6 @@ def __init__(self,
no_compact=False,
ssl_context=None,
endpoint_factory=None,
application_name=None,
application_version=None,
monitor_reporting_enabled=True,
monitor_reporting_interval=30,
client_id=None,
cloud=None,
scylla_cloud=None,
shard_aware_options=None,
Expand Down Expand Up @@ -1531,8 +1495,6 @@ def __init__(self,
self.connect_timeout = connect_timeout
self.prepare_on_all_hosts = prepare_on_all_hosts
self.reprepare_on_up = reprepare_on_up
self.monitor_reporting_enabled = monitor_reporting_enabled
self.monitor_reporting_interval = monitor_reporting_interval
self.shard_aware_options = ShardAwareOptions(opts=shard_aware_options)

if (client_routes_config is not None
Expand Down Expand Up @@ -1568,21 +1530,14 @@ def __init__(self,
schema_metadata_enabled, token_metadata_enabled,
schema_meta_page_size=schema_metadata_page_size)

if client_id is None:
self.client_id = uuid.uuid4()
if application_name is not None:
self.application_name = application_name
if application_version is not None:
self.application_version = application_version

def _resolve_hostnames(self):
raw_contact_points = []
for cp in [cp for cp in self.contact_points if not isinstance(cp, EndPoint)]:
raw_contact_points.append(cp if isinstance(cp, tuple) else (cp, self.port))

self.endpoints_resolved = [cp for cp in self.contact_points if isinstance(cp, EndPoint)]
self._endpoint_map_for_insights = {repr(ep): '{ip}:{port}'.format(ip=ep.address, port=ep.port)
for ep in self.endpoints_resolved}
endpoint_map = {repr(ep): '{ip}:{port}'.format(ip=ep.address, port=ep.port)
for ep in self.endpoints_resolved}
strs_resolved_map = _resolve_contact_points_to_string_map(raw_contact_points)
self.endpoints_resolved.extend(list(chain(
*[
Expand All @@ -1591,14 +1546,14 @@ def _resolve_hostnames(self):
]
)))

self._endpoint_map_for_insights.update(
endpoint_map.update(
{key: ['{ip}:{port}'.format(ip=ip, port=port) for ip, port in value]
for key, value in strs_resolved_map.items() if value is not None}
)

if self.contact_points and (not self.endpoints_resolved):
# only want to raise here if the user specified CPs but resolution failed
raise UnresolvableContactPoints(self._endpoint_map_for_insights)
raise UnresolvableContactPoints(endpoint_map)

def _create_thread_pool_executor(self, **kwargs):
"""
Expand Down Expand Up @@ -2469,7 +2424,6 @@ class Session(object):
keyspace = None
is_shutdown = False
session_id = None
_monitor_reporter = None

_row_factory = staticmethod(named_tuple_factory)
@property
Expand Down Expand Up @@ -2656,8 +2610,7 @@ def default_serial_consistency_level(self, cl):

session_id = None
"""
A UUID that uniquely identifies this Session to Insights. This will be
generated automatically.
A UUID that uniquely identifies this Session. This will be generated automatically.
"""

_lock = None
Expand Down Expand Up @@ -2715,22 +2668,7 @@ def __init__(self, cluster, hosts, keyspace=None):
raise Exception(
"column_encryption_policy is temporary disabled, until https://github.com/scylladb/python-driver/issues/365 is sorted out")

if self.cluster.monitor_reporting_enabled:
cc_host = self.cluster.get_control_connection_host()
valid_insights_version = (cc_host and version_supports_insights(cc_host.dse_version))
if valid_insights_version:
self._monitor_reporter = MonitorReporter(
interval_sec=self.cluster.monitor_reporting_interval,
session=self,
)
else:
if cc_host:
log.debug('Not starting MonitorReporter thread for Insights; '
'not supported by server version {v} on '
'ControlConnection host {c}'.format(v=cc_host.release_version, c=cc_host))

log.debug('Started Session with client_id {} and session_id {}'.format(self.cluster.client_id,
self.session_id))
log.debug('Started Session with session_id {}'.format(self.session_id))

def execute(self, query, parameters=None, timeout=_NOT_SET, trace=False,
custom_payload=None, execution_profile=EXEC_PROFILE_DEFAULT,
Expand Down Expand Up @@ -3293,9 +3231,6 @@ def shutdown(self):
future.cancel()
wait_futures(self._initial_connect_futures)

if self._monitor_reporter:
self._monitor_reporter.stop()

for pool in tuple(self._pools.values()):
pool.shutdown()

Expand Down
13 changes: 0 additions & 13 deletions cassandra/datastax/insights/__init__.py

This file was deleted.

122 changes: 0 additions & 122 deletions cassandra/datastax/insights/registry.py

This file was deleted.

Loading
Loading