当前位置: 首页>>代码示例>>C#>>正文


C# ITelemetry.Sanitize方法代码示例

本文整理汇总了C#中ITelemetry.Sanitize方法的典型用法代码示例。如果您正苦于以下问题:C# ITelemetry.Sanitize方法的具体用法?C# ITelemetry.Sanitize怎么用?C# ITelemetry.Sanitize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ITelemetry的用法示例。


在下文中一共展示了ITelemetry.Sanitize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Track

        internal void Track(ITelemetry telemetry)
        {
            if (!IsTelemetryInitialized)
            {
                CoreEventSource.Log.LogVerbose("HockeyClient configuration has not been initialized. Saving telemetry item to a queue.");
                queue.Enqueue(telemetry);
                if (queue.Count > MaxQueueSize)
                {
                    queue.Dequeue();
                }

                return;
            }

            // TALK TO YOUR TEAM MATES BEFORE CHANGING THIS.
            // This method needs to be public so that we can build and ship new telemetry types without having to ship core.
            // It is hidden from intellisense to prevent customer confusion.
            if (this.IsTelemetryEnabled())
            {
                string instrumentationKey = this.Context.InstrumentationKey;

                if (string.IsNullOrEmpty(instrumentationKey))
                {
                    instrumentationKey = TelemetryConfiguration.Active.InstrumentationKey;
                }

                if (string.IsNullOrEmpty(instrumentationKey))
                {
                    return;
                }

                var telemetryWithProperties = telemetry as ISupportProperties;
                if (telemetryWithProperties != null)
                {
                    if (this.Channel.DeveloperMode.HasValue && this.Channel.DeveloperMode.Value)
                    {
                        if (!telemetryWithProperties.Properties.ContainsKey("DeveloperMode"))
                        {
                            telemetryWithProperties.Properties.Add("DeveloperMode", "true");
                        }
                    }

                    Utils.CopyDictionary(this.Context.Properties, telemetryWithProperties.Properties);
                }

                telemetry.Context.Initialize(this.Context, instrumentationKey);
                foreach (ITelemetryInitializer initializer in TelemetryConfiguration.Active.TelemetryInitializers)
                {
                    try
                    {
                        initializer.Initialize(telemetry);
                    }
                    catch (Exception exception)
                    {
                        CoreEventSource.Log.LogError(string.Format(
                                                        CultureInfo.InvariantCulture,
                                                        "Exception while initializing {0}, exception message - {1}",
                                                        initializer.GetType().FullName,
                                                        exception.ToString()));
                    }
                }

                telemetry.Sanitize();
                this.Channel.Send(telemetry);
                this.WriteTelemetryToDebugOutput(telemetry);
            }
        }
开发者ID:bitstadium,项目名称:HockeySDK-Windows,代码行数:67,代码来源:HockeyClient.cs

示例2: Track

        public void Track(ITelemetry telemetry)
        {
            // TALK TO YOUR TEAM MATES BEFORE CHANGING THIS.
            // This method needs to be public so that we can build and ship new telemetry types without having to ship core.
            // It is hidden from intellisense to prevent customer confusion.
            if (this.IsEnabled())
            {
                string instrumentationKey = this.Context.InstrumentationKey;

                if (string.IsNullOrEmpty(instrumentationKey))
                {
                    instrumentationKey = this.configuration.InstrumentationKey;
                }

                if (string.IsNullOrEmpty(instrumentationKey))
                {
                    return;
                }

                this.Initialize(telemetry);

                if (string.IsNullOrEmpty(telemetry.Context.InstrumentationKey))
                {
                    return;
                }

                telemetry.Sanitize();

                this.Channel.Send(telemetry);

                if (System.Diagnostics.Debugger.IsAttached)
                {
                    this.WriteTelemetryToDebugOutput(telemetry);
                }
            }
        }
开发者ID:JoseCarlosMM,项目名称:ApplicationInsights-dotnet,代码行数:36,代码来源:TelemetryClient.cs

示例3: Track

        public void Track(ITelemetry telemetry)
        {
            // TALK TO YOUR TEAM MATES BEFORE CHANGING THIS.
            // This method needs to be public so that we can build and ship new telemetry types without having to ship core.
            // It is hidden from intellisense to prevent customer confusion.
            if (this.IsEnabled())
            {
                this.Initialize(telemetry);
                
                this.WriteTelemetryToDebugOutput(telemetry);
                
                if (string.IsNullOrEmpty(telemetry.Context.InstrumentationKey))
                {
                    return;
                }

                telemetry.Sanitize();

                if (telemetry.Timestamp == default(DateTimeOffset))
                {
                    telemetry.Timestamp = Clock.Instance.Time;
                }

                // invokes the Process in the first processor in the chain
                this.configuration.TelemetryProcessors.Process(telemetry);
            }
        }
开发者ID:iusafaro,项目名称:ApplicationInsights-dotnet,代码行数:27,代码来源:TelemetryClient.cs


注:本文中的ITelemetry.Sanitize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。