private void InitWithDefaultAWSWhitelist(Amazon.XRay.Recorder.Core.AWSXRayRecorder recorder) { using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(DefaultAwsWhitelistManifestResourceName)) { Init(recorder, stream); } }
/// <summary> /// Initializes provided instance of the <see cref="AWSXRayRecorder" /> class with /// the instance of <see cref="IConfiguration" />. /// </summary> /// <param name="configuration">Instance of <see cref="IConfiguration"/>.</param> /// <param name="recorder">Instance of <see cref="AWSXRayRecorder"/>.</param> public static void InitializeInstance(IConfiguration configuration, AWSXRayRecorder recorder) { XRayOptions xRayOptions = XRayConfiguration.GetXRayOptions(configuration); recorder.XRayOptions = xRayOptions; recorder = new AWSXRayRecorderBuilder().WithPluginsFromConfig(xRayOptions).Build(recorder); }
private void PopulateRecorder(AWSXRayRecorder recorder) { foreach (IPlugin plugin in _plugins) { IDictionary <string, object> pluginContext; if (plugin.TryGetRuntimeContext(out pluginContext)) { recorder.RuntimeContext.Add(plugin.ServiceName, pluginContext); recorder.Origin = plugin.Origin; } } recorder.ContextMissingStrategy = _contextMissingStrategy; if (_segmentEmitter != null) { recorder.Emitter = _segmentEmitter; } if (_samplingStrategy != null) { recorder.SamplingStrategy = _samplingStrategy; } if (_daemonAddress != null) { recorder.SetDaemonAddress(_daemonAddress); } if (_traceContext != null) { recorder.SetTraceContext(_traceContext); } }
/// <summary> /// Build a instance of <see cref="AWSXRayRecorder"/> with <see cref="XRayOptions"/> class. /// <param name="xRayOptions">An instance of <see cref="XRayOptions"/> class.</param> /// </summary> /// <returns>A new instance of <see cref="AWSXRayRecorder"/> class.</returns> public AWSXRayRecorder Build(XRayOptions xRayOptions) { var recorder = new AWSXRayRecorder(xRayOptions); PopulateRecorder(recorder); return(recorder); }
/// <summary> /// Build a instance of <see cref="AWSXRayRecorder"/> with existing configuration added to the builder. /// </summary> /// <returns>A new instance of <see cref="AWSXRayRecorder"/>.</returns> public AWSXRayRecorder Build() { var recorder = new AWSXRayRecorder(); PopulateRecorder(recorder); return(recorder); }
/// <summary> /// Initializes provided instance of the <see cref="AWSXRayRecorder" /> class with /// the instance of <see cref="IConfiguration" />. /// </summary> /// <param name="configuration">Instance of <see cref="IConfiguration"/>.</param> /// <param name="recorder">Instance of <see cref="AWSXRayRecorder"/>.</param> public static void InitializeInstance(IConfiguration configuration, AWSXRayRecorder recorder) { XRayOptions xRayOptions = XRayConfiguration.GetXRayOptions(configuration); recorder.XRayOptions = xRayOptions; var recorderBuilder = GetBuilder(xRayOptions); recorder = recorderBuilder.Build(recorder); Instance = recorder; }
/// <summary> /// Sets provided instance of the <see cref="AWSXRayRecorder" /> to AWSXRayRecorder.Instance /// </summary> /// <param name="recorder">Instance of <see cref="AWSXRayRecorder"/>.</param> public static void InitializeInstance(AWSXRayRecorder recorder) { if (recorder != null) { _logger.DebugFormat("Using custom X-Ray recorder."); Instance = recorder; IsCustomRecorder = true; } else { _logger.DebugFormat("Provided X-Ray recorder is null, using defaul recorder."); } }
private void Init(Amazon.XRay.Recorder.Core.AWSXRayRecorder recorder, Stream stream) { _recorder = recorder; using (var reader = new StreamReader(stream)) { try { AWSServiceHandlerManifest = JsonMapper.ToObject <AWSServiceHandlerManifest>(reader); } catch (JsonException e) { _logger.Error(e, "Failed to load AWSServiceHandlerManifest."); } } }
/// <summary> /// Initializes provided instance of the <see cref="AWSXRayRecorder" /> class with /// the instance of <see cref="IConfiguration" />. /// </summary> /// <param name="configuration">Instance of <see cref="IConfiguration"/>.</param> /// <param name="recorder">Instance of <see cref="AWSXRayRecorder"/>.</param> public static void InitializeInstance(IConfiguration configuration = null, AWSXRayRecorder recorder = null) { XRayOptions xRayOptions = XRayConfiguration.GetXRayOptions(configuration); var recorderBuilder = GetBuilder(xRayOptions); if (recorder != null) { recorder.XRayOptions = xRayOptions; recorder = recorderBuilder.Build(recorder); } else { recorder = recorderBuilder.Build(xRayOptions); } Instance = recorder; }
/// <summary> /// Initializes provided instance of the <see cref="AWSXRayRecorder" /> class with /// the instance of <see cref="IConfiguration" />. /// </summary> /// <param name="configuration">Instance of <see cref="IConfiguration"/>.</param> /// <param name="recorder">Instance of <see cref="AWSXRayRecorder"/>.</param> public static void InitializeInstance(IConfiguration configuration = null, AWSXRayRecorder recorder = null) { XRayOptions xRayOptions = XRayConfiguration.GetXRayOptions(configuration); var recorderBuilder = GetBuilder(xRayOptions); if (recorder != null) { _logger.DebugFormat("Using custom X-Ray recorder."); recorder.XRayOptions = xRayOptions; recorder = recorderBuilder.Build(recorder); } else { _logger.DebugFormat("Using default X-Ray recorder."); recorder = recorderBuilder.Build(xRayOptions); } Instance = recorder; }
private void PopulateRecorder(AWSXRayRecorder recorder) { foreach (IPlugin plugin in _plugins) { IDictionary <string, object> pluginContext; if (plugin.TryGetRuntimeContext(out pluginContext)) { recorder.RuntimeContext.Add(plugin.ServiceName, pluginContext); recorder.Origin = plugin.Origin; } } if (_samplingStrategy != null) { recorder.SamplingStrategy = _samplingStrategy; } recorder.ContextMissingStrategy = _contextMissingStrategy; }
/// <summary> /// Configures a instance of <see cref="AWSXRayRecorder"/> with existing configuration added to the builder. /// </summary> /// <param name="recorder">An instance of <see cref="AWSXRayRecorder"/>.</param> /// <returns>A new instance of <see cref="AWSXRayRecorder"/>.</returns> public AWSXRayRecorder Build(AWSXRayRecorder recorder) { PopulateRecorder(recorder); return(recorder); }
/// <summary> /// Sets provided instance of the <see cref="AWSXRayRecorder" /> to AWSXRayRecorder.Instance /// </summary> /// <param name="recorder">Instance of <see cref="AWSXRayRecorder"/>.</param> public static void InitializeInstance(AWSXRayRecorder recorder) { Instance = recorder; IsCustomRecorder = true; }