Skip to content

Commit

Permalink
pr-fix: rename to original class to reduce code changes
Browse files Browse the repository at this point in the history
  • Loading branch information
stijnmoreels committed Aug 1, 2024
1 parent 3f47744 commit 5e2b926
Show file tree
Hide file tree
Showing 25 changed files with 102 additions and 102 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public AppInsightsClient(TestConfig config)
/// <summary>
/// Gets the tracked traces from the Azure Application Insights instance.
/// </summary>
public async Task<TraceResult[]> GetTracesAsync()
public async Task<EventsTraceResult[]> GetTracesAsync()
{
IReadOnlyCollection<LogsTableRow> rows =
await QueryLogsAsync("AppTraces | project Message, OperationId, ParentId, AppRoleName, Properties");
Expand All @@ -51,23 +51,23 @@ public async Task<TraceResult[]> GetTracesAsync()
string customDimensionsTxt = row[4].ToString();
var customDimensions = JsonConvert.DeserializeObject<Dictionary<string, string>>(customDimensionsTxt);

return new TraceResult(message, roleName, operation, customDimensions);
return new EventsTraceResult(message, roleName, operation, customDimensions);

}).ToArray();
}

/// <summary>
/// Gets the tracked metrics from the Azure Application Insights instance.
/// </summary>
public Task<MetricsResult[]> GetMetricsAsync(string metricName)
public Task<EventsMetricsResult[]> GetMetricsAsync(string metricName)
{
throw new NotImplementedException();
}

/// <summary>
/// Gets the tracked custom events from the Azure Application Insights instance.
/// </summary>
public async Task<CustomEventResult[]> GetCustomEventsAsync()
public async Task<EventsCustomEventResult[]> GetCustomEventsAsync()
{
IReadOnlyCollection<LogsTableRow> rows =
await QueryLogsAsync("AppEvents | project Name, AppRoleName, Properties");
Expand All @@ -80,15 +80,15 @@ public async Task<CustomEventResult[]> GetCustomEventsAsync()
var customDimensionsTxt = row[2].ToString();
var customDimensions = JsonConvert.DeserializeObject<Dictionary<string, string>>(customDimensionsTxt);

return new CustomEventResult(name, roleName, customDimensions);
return new EventsCustomEventResult(name, roleName, customDimensions);

}).ToArray();
}

/// <summary>
/// Gets the tracked requests from the Azure Application Insights instance.
/// </summary>
public async Task<RequestResult[]> GetRequestsAsync()
public async Task<EventsRequestResult[]> GetRequestsAsync()
{
IReadOnlyCollection<LogsTableRow> rows =
await QueryLogsAsync(
Expand All @@ -111,15 +111,15 @@ await QueryLogsAsync(
var customDimensionsTxt = row[9].ToString();
var customDimensions = JsonConvert.DeserializeObject<Dictionary<string, string>>(customDimensionsTxt);

return new RequestResult(id, name, source, url, success, resultCode, roleName, operation, customDimensions);
return new EventsRequestResult(id, name, source, url, success, resultCode, roleName, operation, customDimensions);

}).ToArray();
}

/// <summary>
/// Gets the tracked dependencies from the Azure Application Insights instance.
/// </summary>
public async Task<DependencyResult[]> GetDependenciesAsync()
public async Task<EventsDependencyResult[]> GetDependenciesAsync()
{
IReadOnlyCollection<LogsTableRow> rows =
await QueryLogsAsync("AppDependencies | project Id, Target, DependencyType, Name, Data, Success, ResultCode, AppRoleName, OperationId, ParentId, Properties");
Expand All @@ -145,15 +145,15 @@ public async Task<DependencyResult[]> GetDependenciesAsync()
var customDimensionsTxt = row[10].ToString();
var customDimensions = JsonConvert.DeserializeObject<Dictionary<string, string>>(customDimensionsTxt);

return new DependencyResult(id, type, target, data, success, resultCode, name, roleName, operation, customDimensions);
return new EventsDependencyResult(id, type, target, data, success, resultCode, name, roleName, operation, customDimensions);

}).ToArray();
}

/// <summary>
/// Gets the tracked exceptions from the Azure Application Insights instance.
/// </summary>
public async Task<ExceptionResult[]> GetExceptionsAsync()
public async Task<EventsExceptionResult[]> GetExceptionsAsync()
{
IReadOnlyCollection<LogsTableRow> rows =
await QueryLogsAsync("AppExceptions | project OuterMessage, OperationId, ParentId, AppRoleName, Properties");
Expand All @@ -170,7 +170,7 @@ public async Task<ExceptionResult[]> GetExceptionsAsync()
string customDimensionsTxt = row[4].ToString();
var customDimensions = JsonConvert.DeserializeObject<Dictionary<string, string>>(customDimensionsTxt);

return new ExceptionResult(message, operation, roleName, customDimensions);
return new EventsExceptionResult(message, operation, roleName, customDimensions);

}).ToArray();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public async Task Sink_WithConnectionString_WritesTelemetry()
// Assert
await RetryAssertUntilTelemetryShouldBeAvailableAsync(async client =>
{
TraceResult[] traces = await client.GetTracesAsync();
EventsTraceResult[] traces = await client.GetTracesAsync();
AssertX.Any(traces, trace =>
{
Assert.Equal(message, trace.Message);
Expand Down Expand Up @@ -71,7 +71,7 @@ public async Task Sink_WithConnectionStringWithServiceProvider_WritesTelemetry()
// Assert
await RetryAssertUntilTelemetryShouldBeAvailableAsync(async client =>
{
TraceResult[] traces = await client.GetTracesAsync();
EventsTraceResult[] traces = await client.GetTracesAsync();
AssertX.Any(traces, trace =>
{
Assert.Equal(message, trace.Message);
Expand All @@ -95,7 +95,7 @@ public async Task Sink_WithInstrumentationKey_WritesTelemetry()
// Assert
await RetryAssertUntilTelemetryShouldBeAvailableAsync(async client =>
{
TraceResult[] traces = await client.GetTracesAsync();
EventsTraceResult[] traces = await client.GetTracesAsync();
AssertX.Any(traces, trace =>
{
Assert.Equal(message, trace.Message);
Expand All @@ -122,7 +122,7 @@ public async Task Sink_WithInstrumentationKeyWithServiceProvider_WritesTelemetry
// Assert
await RetryAssertUntilTelemetryShouldBeAvailableAsync(async client =>
{
TraceResult[] traces = await client.GetTracesAsync();
EventsTraceResult[] traces = await client.GetTracesAsync();
AssertX.Any(traces, trace =>
{
Assert.Equal(message, trace.Message);
Expand Down Expand Up @@ -150,7 +150,7 @@ public async Task SinkWithCustomTransactionIdPropertyName_TrackNonRequest_Enrich
// Assert
await RetryAssertUntilTelemetryShouldBeAvailableAsync(async client =>
{
TraceResult[] result = await client.GetTracesAsync();
EventsTraceResult[] result = await client.GetTracesAsync();
AssertX.Any(result, trace =>
{
Assert.Equal(message, trace.Message);
Expand Down Expand Up @@ -180,7 +180,7 @@ public async Task SinkWithCustomOperationIdPropertyName_TrackNonRequest_EnrichCo
// Assert
await RetryAssertUntilTelemetryShouldBeAvailableAsync(async client =>
{
TraceResult[] result = await client.GetTracesAsync();
EventsTraceResult[] result = await client.GetTracesAsync();
AssertX.Any(result, trace =>
{
Assert.Equal(message, trace.Message);
Expand Down Expand Up @@ -217,7 +217,7 @@ public async Task SinkWithCustomTransactionIdPropertyName_TrackRequest_EnrichCor
// Assert
await RetryAssertUntilTelemetryShouldBeAvailableAsync(async client =>
{
RequestResult[] result = await client.GetRequestsAsync();
EventsRequestResult[] result = await client.GetRequestsAsync();
AssertX.Any(result, request =>
{
Assert.Equal(correlation.TransactionId, request.Operation.Id);
Expand Down Expand Up @@ -254,7 +254,7 @@ public async Task SinkWithCustomOperationIdPropertyName_TrackRequest_EnrichCorre
// Assert
await RetryAssertUntilTelemetryShouldBeAvailableAsync(async client =>
{
RequestResult[] result = await client.GetRequestsAsync();
EventsRequestResult[] result = await client.GetRequestsAsync();
AssertX.Any(result, request =>
{
Assert.Equal(correlation.TransactionId, request.Operation.Id);
Expand Down Expand Up @@ -291,7 +291,7 @@ public async Task SinkWithCustomOperationParentIdPropertyName_TrackRequest_Enric
// Assert
await RetryAssertUntilTelemetryShouldBeAvailableAsync(async client =>
{
RequestResult[] result = await client.GetRequestsAsync();
EventsRequestResult[] result = await client.GetRequestsAsync();
AssertX.Any(result, request =>
{
Assert.Equal(correlation.TransactionId, request.Operation.Id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public async Task LogRequest_WithRequestsOperationName_SinksToApplicationInsight

await RetryAssertUntilTelemetryShouldBeAvailableAsync(async client =>
{
RequestResult[] results = await client.GetRequestsAsync();
EventsRequestResult[] results = await client.GetRequestsAsync();
AssertX.Any(results, result =>
{
Assert.Equal("200", result.ResultCode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public async Task LogAzureKeyVaultDependency_SinksToApplicationInsights_ResultsI
// Assert
await RetryAssertUntilTelemetryShouldBeAvailableAsync(async client =>
{
DependencyResult[] results = await client.GetDependenciesAsync();
EventsDependencyResult[] results = await client.GetDependenciesAsync();
AssertX.Any(results, result =>
{
Assert.Equal(dependencyType, result.Type);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public async Task LogAzureSearchDependency_SinksToApplicationInsights_ResultsInA
// Assert
await RetryAssertUntilTelemetryShouldBeAvailableAsync(async client =>
{
DependencyResult[] results = await client.GetDependenciesAsync();
EventsDependencyResult[] results = await client.GetDependenciesAsync();
AssertX.Any(results, result =>
{
Assert.Equal(dependencyType, result.Type);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public async Task LogBlobStorageDependency_SinksToApplicationInsights_ResultsInB
// Assert
await RetryAssertUntilTelemetryShouldBeAvailableAsync(async client =>
{
DependencyResult[] results = await client.GetDependenciesAsync();
EventsDependencyResult[] results = await client.GetDependenciesAsync();
AssertX.Any(results, result =>
{
Assert.Equal(dependencyType, result.Type);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public async Task LogCosmosSqlDependency_SinksToApplicationInsights_ResultsInCos
// Assert
await RetryAssertUntilTelemetryShouldBeAvailableAsync(async client =>
{
DependencyResult[] results = await client.GetDependenciesAsync();
EventsDependencyResult[] results = await client.GetDependenciesAsync();
Assert.NotEmpty(results);
AssertX.Any(results, result =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public async Task LogDependency_SinksToApplicationInsights_ResultsInDependencyTe
// Assert
await RetryAssertUntilTelemetryShouldBeAvailableAsync(async client =>
{
DependencyResult[] results = await client.GetDependenciesAsync();
EventsDependencyResult[] results = await client.GetDependenciesAsync();
AssertX.Any(results, result =>
{
Assert.Equal(dependencyType, result.Type);
Expand Down Expand Up @@ -65,7 +65,7 @@ public async Task LogDependency_SinksToApplicationInsights_ResultsInDependencyTe
// Assert
await RetryAssertUntilTelemetryShouldBeAvailableAsync(async client =>
{
DependencyResult[] results = await client.GetDependenciesAsync();
EventsDependencyResult[] results = await client.GetDependenciesAsync();
AssertX.Any(results, result =>
{
Assert.Equal(dependencyType, result.Type);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public async Task LogCustomRequest_SinksToApplicationInsights_ResultsInCustomReq
// Assert
await RetryAssertUntilTelemetryShouldBeAvailableAsync(async client =>
{
RequestResult[] requests = await client.GetRequestsAsync();
EventsRequestResult[] requests = await client.GetRequestsAsync();
AssertX.Any(requests, result =>
{
Assert.Equal(operationName, result.Name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public async Task LogEventHubsDependency_SinksToApplicationInsights_ResultsInEve
// Assert
await RetryAssertUntilTelemetryShouldBeAvailableAsync(async client =>
{
DependencyResult[] results = await client.GetDependenciesAsync();
EventsDependencyResult[] results = await client.GetDependenciesAsync();
AssertX.Any(results, result =>
{
Assert.Equal(dependencyType, result.Type);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public async Task LogEventHubsRequest_SinksToApplicationInsights_ResultsInEventH
// Assert
await RetryAssertUntilTelemetryShouldBeAvailableAsync(async client =>
{
RequestResult[] requests = await client.GetRequestsAsync();
EventsRequestResult[] requests = await client.GetRequestsAsync();
AssertX.Any(requests, result =>
{
Assert.Equal(operationName, result.Name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public async Task LogCustomEvent_SinksToApplicationInsights_ResultsInEventTeleme
// Assert
await RetryAssertUntilTelemetryShouldBeAvailableAsync(async client =>
{
CustomEventResult[] results = await client.GetCustomEventsAsync();
EventsCustomEventResult[] results = await client.GetCustomEventsAsync();
AssertX.Any(results, ev =>
{
Assert.Equal(eventName, ev.Name);
Expand All @@ -54,7 +54,7 @@ public async Task LogEventWithComponentName_SinksToApplicationInsights_ResultsIn
// Assert
await RetryAssertUntilTelemetryShouldBeAvailableAsync(async client =>
{
TraceResult[] results = await client.GetTracesAsync();
EventsTraceResult[] results = await client.GetTracesAsync();
AssertX.Any(results, trace =>
{
Assert.Equal(message, trace.Message);
Expand All @@ -77,7 +77,7 @@ public async Task LogCustomEventWithVersion_SinksToApplicationInsights_ResultsIn
// Assert
await RetryAssertUntilTelemetryShouldBeAvailableAsync(async client =>
{
CustomEventResult[] events = await client.GetCustomEventsAsync();
EventsCustomEventResult[] events = await client.GetCustomEventsAsync();
AssertX.Any(events, ev =>
{
Assert.Equal(eventName, ev.Name);
Expand Down Expand Up @@ -106,7 +106,7 @@ public async Task LogEventWithCorrelationInfo_SinksToApplicationInsights_Results
// Assert
await RetryAssertUntilTelemetryShouldBeAvailableAsync(async client =>
{
TraceResult[] traceEvents = await client.GetTracesAsync();
EventsTraceResult[] traceEvents = await client.GetTracesAsync();
AssertX.Any(traceEvents, trace =>
{
Assert.Equal(message, trace.Message);
Expand Down Expand Up @@ -142,7 +142,7 @@ public async Task LogEventWithKubernetesInfo_SinksToApplicationInsights_ResultsI
// Assert
await RetryAssertUntilTelemetryShouldBeAvailableAsync(async client =>
{
TraceResult[] traceEvents = await client.GetTracesAsync();
EventsTraceResult[] traceEvents = await client.GetTracesAsync();
AssertX.Any(traceEvents, trace =>
{
Assert.Equal(message, trace.Message);
Expand Down
Loading

0 comments on commit 5e2b926

Please sign in to comment.