예제 #1
0
        public Insight <InsightsStartupData> CreateMessage(IInternalCluster cluster, IInternalSession session)
        {
            var metadata = _metadataFactory.CreateInsightsMetadata(
                InsightsStartupMessageFactory.StartupMessageName, InsightsStartupMessageFactory.StartupV1MappingId, InsightType.Event);

            var driverInfo  = _infoProviders.DriverInfoProvider.GetInformation(cluster, session);
            var startupData = new InsightsStartupData
            {
                ClientId                    = cluster.Configuration.ClusterId.ToString(),
                SessionId                   = session.InternalSessionId.ToString(),
                DriverName                  = driverInfo.DriverName,
                DriverVersion               = driverInfo.DriverVersion,
                ApplicationName             = cluster.Configuration.ApplicationName,
                ApplicationVersion          = cluster.Configuration.ApplicationVersion,
                ApplicationNameWasGenerated = cluster.Configuration.ApplicationNameWasGenerated,
                ContactPoints               =
                    cluster.Metadata.ResolvedContactPoints.ToDictionary(
                        kvp => kvp.Key, kvp => kvp.Value.Select(ipEndPoint => ipEndPoint.ToString()).ToList()),
                DataCenters = _infoProviders.DataCentersInfoProvider.GetInformation(cluster, session),
                InitialControlConnection = cluster.Metadata.ControlConnection.EndPoint?.GetHostIpEndPointWithFallback().ToString(),
                LocalAddress             = cluster.Metadata.ControlConnection.LocalAddress?.ToString(),
                HostName               = _infoProviders.HostnameProvider.GetInformation(cluster, session),
                ProtocolVersion        = (byte)cluster.Metadata.ControlConnection.ProtocolVersion,
                ExecutionProfiles      = _infoProviders.ExecutionProfileInfoProvider.GetInformation(cluster, session),
                PoolSizeByHostDistance = _infoProviders.PoolSizeByHostDistanceInfoProvider.GetInformation(cluster, session),
                HeartbeatInterval      =
                    cluster
                    .Configuration
                    .GetOrCreatePoolingOptions(cluster.Metadata.ControlConnection.ProtocolVersion)
                    .GetHeartBeatInterval() ?? 0,
                Compression        = cluster.Configuration.ProtocolOptions.Compression,
                ReconnectionPolicy = _infoProviders.ReconnectionPolicyInfoProvider.GetInformation(cluster, session),
                Ssl = new SslInfo {
                    Enabled = cluster.Configuration.ProtocolOptions.SslOptions != null
                },
                AuthProvider           = _infoProviders.AuthProviderInfoProvider.GetInformation(cluster, session),
                OtherOptions           = _infoProviders.OtherOptionsInfoProvider.GetInformation(cluster, session),
                PlatformInfo           = _infoProviders.PlatformInfoProvider.GetInformation(cluster, session),
                ConfigAntiPatterns     = _infoProviders.ConfigAntiPatternsInfoProvider.GetInformation(cluster, session),
                PeriodicStatusInterval = cluster.Configuration.MonitorReportingOptions.StatusEventDelayMilliseconds / 1000
            };

            return(new Insight <InsightsStartupData>
            {
                Metadata = metadata,
                Data = startupData
            });
        }
        public Insight <InsightsStatusData> CreateMessage(IInternalCluster cluster, IInternalSession session)
        {
            var metadata = _insightsMetadataFactory.CreateInsightsMetadata(
                InsightsStatusMessageFactory.StatusMessageName, InsightsStatusMessageFactory.StatusV1MappingId, InsightType.Event);

            var data = new InsightsStatusData
            {
                ClientId          = cluster.Configuration.ClusterId.ToString(),
                SessionId         = session.InternalSessionId.ToString(),
                ControlConnection = cluster.Metadata.ControlConnection.EndPoint?.GetHostIpEndPointWithFallback().ToString(),
                ConnectedNodes    = _connectedNodesInfoProvider.GetInformation(cluster, session)
            };

            return(new Insight <InsightsStatusData>
            {
                Metadata = metadata,
                Data = data
            });
        }