private WorkItemStore GetWorkItemStore(WorkItemStoreFlags bypassRules) { var startTime = DateTime.UtcNow; var timer = System.Diagnostics.Stopwatch.StartNew(); WorkItemStore store; try { store = new WorkItemStore(MigrationClient.Config.AsTeamProjectConfig().Collection.ToString(), bypassRules); timer.Stop(); Telemetry.TrackDependency(new DependencyTelemetry("TfsObjectModel", MigrationClient.Config.AsTeamProjectConfig().Collection.ToString(), "GetWorkItemStore", null, startTime, timer.Elapsed, "200", true)); } catch (Exception ex) { timer.Stop(); Telemetry.TrackDependency(new DependencyTelemetry("TfsObjectModel", MigrationClient.Config.AsTeamProjectConfig().Collection.ToString(), "GetWorkItemStore", null, startTime, timer.Elapsed, "500", false)); Telemetry.TrackException(ex, new Dictionary <string, string> { { "CollectionUrl", MigrationClient.Config.AsTeamProjectConfig().Collection.ToString() } }, new Dictionary <string, double> { { "Time", timer.ElapsedMilliseconds } }); Log.Error(ex, "Unable to configure store"); throw; } return(store); }
public override void InnerConfigure(IMigrationClient migrationClient, bool bypassRules = true) { _config = MigrationClient.Config; _bypassRules = bypassRules ? WorkItemStoreFlags.BypassRules : WorkItemStoreFlags.None; _wistore = new WorkItemStore(MigrationClient.Config.Collection.ToString(), _bypassRules); _project = migrationClient.WorkItems.GetProject(); }
public WorkItemStoreContext(ITeamProjectContext teamProjectContext, WorkItemStoreFlags bypassRules) { var startTime = DateTime.UtcNow; var timer = System.Diagnostics.Stopwatch.StartNew(); this.teamProjectContext = teamProjectContext; this.bypassRules = bypassRules; try { wistore = new WorkItemStore(teamProjectContext.Collection, bypassRules); timer.Stop(); Telemetry.Current.TrackDependency("TeamService", "GetWorkItemStore", startTime, timer.Elapsed, true); } catch (Exception ex) { timer.Stop(); Telemetry.Current.TrackDependency("TeamService", "GetWorkItemStore", startTime, timer.Elapsed, false); Telemetry.Current.TrackException(ex, new Dictionary <string, string> { { "CollectionUrl", teamProjectContext.Collection.Uri.ToString() } }, new Dictionary <string, double> { { "Time", timer.ElapsedMilliseconds } }); Trace.TraceWarning($" [EXCEPTION] {ex}"); throw; } foundWis = new Dictionary <int, WorkItem>(); }
protected override void InnerConfigure(IMigrationClient migrationClient, bool bypassRules = true) { _config = MigrationClient.Config; _bypassRules = bypassRules ? WorkItemStoreFlags.BypassRules : WorkItemStoreFlags.None; _wistore = GetWorkItemStore(); _project = migrationClient.WorkItems.GetProject(); }
private WorkItemStore GetWorkItemStore(TfsTeamProjectCollection tfs, WorkItemStoreFlags bypassRules) { if (_Store is null) { var startTime = DateTime.UtcNow; var timer = System.Diagnostics.Stopwatch.StartNew(); try { _Store = new WorkItemStore(tfs, bypassRules); timer.Stop(); Telemetry.TrackDependency(new DependencyTelemetry("TfsObjectModel", _Options.Organisation, "GetWorkItemStore", null, startTime, timer.Elapsed, "200", true)); } catch (Exception ex) { timer.Stop(); Telemetry.TrackDependency(new DependencyTelemetry("TfsObjectModel", _Options.Organisation, "GetWorkItemStore", null, startTime, timer.Elapsed, "500", false)); Log.LogError(ex, "Unable to connect to {Organisation} Store", _Options.Organisation); throw; } } return(_Store); }