private void OnServerConfigurationUpdated(ServerConfigurationUpdatedEvent serverConfigurationUpdatedEvent) { try { _serverConfiguration = serverConfigurationUpdatedEvent.Configuration; UpdateAndPublishConfiguration(ConfigurationUpdateSource.Server); } catch (Exception exception) { Log.Error($"Unable to parse the Configuration data from the server so no server side configuration was applied: {exception}"); } }
private void OnServerConfigurationUpdated(ServerConfigurationUpdatedEvent serverConfigurationUpdatedEvent) { var instrumentation = serverConfigurationUpdatedEvent.Configuration.Instrumentation; if (instrumentation != null && !instrumentation.IsEmpty()) { if (_configuration.CustomInstrumentationEditorEnabled) { try { foreach (var instrumentationSet in instrumentation) { _instrumentationService.AddOrUpdateLiveInstrumentation(instrumentationSet.Name, instrumentationSet.Config); } Log.InfoFormat("Applying live instrumentation from Custom Instrumentation Editor."); // We want to apply custom instrumentation regardless of whether or not any was received on // this connect because we may have received instrumentation on a previous connect. _instrumentationService.ApplyInstrumentation(); } catch (Exception ex) { Log.Error(ex); } } else { Log.WarnFormat("Live instrumentation received from server Custom Instrumentation Editor not applied due to configuration."); var liveInstrumentationCleared = _instrumentationService.ClearLiveInstrumentation(); if (liveInstrumentationCleared) { Log.Info("Clearing out existing live instrumentation because the configuration was previously enabled, but it is now disabled."); _instrumentationService.ApplyInstrumentation(); } } } }