Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only add AspNetCoreErrorDiagnosticsSubscriber if not present #1091

Merged
merged 3 commits into from
Jan 11, 2021

Conversation

russcam
Copy link
Contributor

@russcam russcam commented Dec 15, 2020

This commit only adds the AspNetCoreErrorDiagnosticsSubscriber if an instance is not already present in the subscribers.

This commit only adds the `AspNetCoreErrorDiagnosticsSubscriber` if an instance is not already present in the subscribers.
@codecov-io
Copy link

Codecov Report

Merging #1091 (c01860c) into master (8875c8a) will decrease coverage by 21.77%.
The diff coverage is 54.54%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master    #1091       +/-   ##
===========================================
- Coverage   79.02%   57.25%   -21.78%     
===========================================
  Files         149      149               
  Lines        7362     7364        +2     
===========================================
- Hits         5818     4216     -1602     
- Misses       1544     3148     +1604     
Impacted Files Coverage Δ
src/Elastic.Apm/Model/NoopSpan.cs 31.74% <33.33%> (-13.42%) ⬇️
src/Elastic.Apm/Model/NoopTransaction.cs 25.00% <40.00%> (-9.79%) ⬇️
...c/Elastic.Apm.AspNetCore/ApmMiddlewareExtension.cs 48.00% <100.00%> (-2.00%) ⬇️
src/Elastic.Apm/Helpers/ExceptionFilter.cs 0.00% <0.00%> (-100.00%) ⬇️
src/Elastic.Apm/Helpers/CascadePropertyFetcher.cs 0.00% <0.00%> (-100.00%) ⬇️
src/Elastic.Apm/Helpers/StringBuilderExtensions.cs 0.00% <0.00%> (-100.00%) ⬇️
...rc/Elastic.Apm/Helpers/AssertionFailedException.cs 0.00% <0.00%> (-100.00%) ⬇️
...rc/Elastic.Apm/Helpers/DbgInstanceNameGenerator.cs 0.00% <0.00%> (-100.00%) ⬇️
src/Elastic.Apm/Helpers/GrpcHelper.cs 0.00% <0.00%> (-95.84%) ⬇️
...dComm/CentralConfig/CentralConfigResponseParser.cs 1.21% <0.00%> (-95.13%) ⬇️
... and 75 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b363a80...c01860c. Read the comment docs.

@apmmachine
Copy link
Contributor

apmmachine commented Dec 15, 2020

💔 Tests Failed

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: Branch indexing

  • Start Time: 2021-01-11T02:20:13.677+0000

  • Duration: 70 min 45 sec

Test stats 🧪

Test Results
Failed 1
Passed 16605
Skipped 0
Total 16606

Test errors 1

Expand to view the tests failures

Initializing / Parallel / Windows .NET Core / Test / ErrorTests.Elastic.Apm.Tests.ErrorTests.ErrorOnEmptyTransaction – Elastic.Apm.Tests.ErrorTests
    Expand to view the error details

     Expected mockPayloadSender.FirstError.Context not to be <null> because error context should not be null. 
    

    Expand to view the stacktrace

     Expected mockPayloadSender.FirstError.Context not to be <null> because error context should not be null.
    Stack Trace:
       at FluentAssertions.Execution.XUnit2TestFramework.Throw(String message)
       at FluentAssertions.Execution.TestFrameworkProvider.Throw(String message)
       at FluentAssertions.Execution.DefaultAssertionStrategy.HandleFailure(String message)
       at FluentAssertions.Execution.AssertionScope.FailWith(Func`1 failReasonFunc)
       at FluentAssertions.Execution.AssertionScope.FailWith(String message, Object[] args)
       at FluentAssertions.Primitives.ReferenceTypeAssertions`2.NotBeNull(String because, Object[] becauseArgs)
       at Elastic.Apm.Tests.ErrorTests.<>c__DisplayClass1_0.<ErrorOnEmptyTransaction>b__0(ITransaction t) in C:\Users\jenkins\workspace\net_apm-agent-dotnet-mbp_PR-1091\apm-agent-dotnet\test\Elastic.Apm.Tests\ErrorTests.cs:line 98
       at Elastic.Apm.Api.Tracer.CaptureTransaction(String name, String type, Action`1 action, DistributedTracingData distributedTracingData) in C:\Users\jenkins\workspace\net_apm-agent-dotnet-mbp_PR-1091\apm-agent-dotnet\src\Elastic.Apm\Api\Tracer.cs:line 80
       at Elastic.Apm.Tests.ErrorTests.ErrorOnEmptyTransaction() in C:\Users\jenkins\workspace\net_apm-agent-dotnet-mbp_PR-1091\apm-agent-dotnet\test\Elastic.Apm.Tests\ErrorTests.cs:line 92
     
    

Steps errors 3

Expand to view the steps failures

Build
  • Took 1 min 31 sec . View more details on here
  • Description: .ci/windows/dotnet.bat
Test & coverage
  • Took 11 min 40 sec . View more details on here
  • Description: .ci/windows/test.bat
General Build Step
  • Took 0 min 0 sec . View more details on here
  • Description: [2021-01-11T02:50:12.341Z] Archiving artifacts script returned exit code 1

Log output

Expand to view the last 100 lines of log output

[2021-01-11T03:29:47.676Z]       Executed action method Elastic.Apm.Tests.MockApmServer.Controllers.IntakeV2EventsController.Post (Elastic.Apm.Tests.MockApmServer), returned result Microsoft.AspNetCore.Mvc.OkObjectResult in 2.8899ms.
[2021-01-11T03:29:47.676Z] info: Microsoft.AspNetCore.Mvc.Infrastructure.ObjectResultExecutor[1]
[2021-01-11T03:29:47.676Z]       Executing ObjectResult, writing value of type 'System.String'.
[2021-01-11T03:29:47.676Z] info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[2]
[2021-01-11T03:29:47.676Z]       Executed action Elastic.Apm.Tests.MockApmServer.Controllers.IntakeV2EventsController.Post (Elastic.Apm.Tests.MockApmServer) in 3.1544ms
[2021-01-11T03:29:47.676Z] info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
[2021-01-11T03:29:47.676Z]       Request finished in 3.4345ms 200 text/plain; charset=utf-8
[2021-01-11T03:29:47.676Z] info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
[2021-01-11T03:29:47.676Z]       Request starting HTTP/1.1 POST http://localhost:24466/intake/v2/events application/x-ndjson; charset=utf-8 3336
[2021-01-11T03:29:47.676Z] info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[3]
[2021-01-11T03:29:47.676Z]       Route matched with {action = "Post", controller = "IntakeV2Events"}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.IActionResult] Post() on controller Elastic.Apm.Tests.MockApmServer.Controllers.IntakeV2EventsController (Elastic.Apm.Tests.MockApmServer).
[2021-01-11T03:29:47.676Z] info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[1]
[2021-01-11T03:29:47.676Z]       Executing action method Elastic.Apm.Tests.MockApmServer.Controllers.IntakeV2EventsController.Post (Elastic.Apm.Tests.MockApmServer) - Validation state: Valid
[2021-01-11T03:29:47.677Z] info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[2]
[2021-01-11T03:29:47.677Z]       Executed action method Elastic.Apm.Tests.MockApmServer.Controllers.IntakeV2EventsController.Post (Elastic.Apm.Tests.MockApmServer), returned result Microsoft.AspNetCore.Mvc.OkObjectResult in 3.3229ms.
[2021-01-11T03:29:47.677Z] info: Microsoft.AspNetCore.Mvc.Infrastructure.ObjectResultExecutor[1]
[2021-01-11T03:29:47.677Z]       Executing ObjectResult, writing value of type 'System.String'.
[2021-01-11T03:29:47.677Z] info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[2]
[2021-01-11T03:29:47.677Z]       Executed action Elastic.Apm.Tests.MockApmServer.Controllers.IntakeV2EventsController.Post (Elastic.Apm.Tests.MockApmServer) in 3.5741ms
[2021-01-11T03:29:47.677Z] info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
[2021-01-11T03:29:47.677Z]       Request finished in 3.8446ms 200 text/plain; charset=utf-8
[2021-01-11T03:29:47.677Z] info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
[2021-01-11T03:29:47.677Z]       Request starting HTTP/1.1 POST http://localhost:24466/intake/v2/events application/x-ndjson; charset=utf-8 1936
[2021-01-11T03:29:47.677Z] info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[3]
[2021-01-11T03:29:47.677Z]       Route matched with {action = "Post", controller = "IntakeV2Events"}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.IActionResult] Post() on controller Elastic.Apm.Tests.MockApmServer.Controllers.IntakeV2EventsController (Elastic.Apm.Tests.MockApmServer).
[2021-01-11T03:29:47.677Z] info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[1]
[2021-01-11T03:29:47.677Z]       Executing action method Elastic.Apm.Tests.MockApmServer.Controllers.IntakeV2EventsController.Post (Elastic.Apm.Tests.MockApmServer) - Validation state: Valid
[2021-01-11T03:29:47.677Z] info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[2]
[2021-01-11T03:29:47.677Z]       Executed action method Elastic.Apm.Tests.MockApmServer.Controllers.IntakeV2EventsController.Post (Elastic.Apm.Tests.MockApmServer), returned result Microsoft.AspNetCore.Mvc.OkObjectResult in 2.5087ms.
[2021-01-11T03:29:47.677Z] info: Microsoft.AspNetCore.Mvc.Infrastructure.ObjectResultExecutor[1]
[2021-01-11T03:29:47.677Z]       Executing ObjectResult, writing value of type 'System.String'.
[2021-01-11T03:29:47.677Z] info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[2]
[2021-01-11T03:29:47.677Z]       Executed action Elastic.Apm.Tests.MockApmServer.Controllers.IntakeV2EventsController.Post (Elastic.Apm.Tests.MockApmServer) in 2.7551ms
[2021-01-11T03:29:47.677Z] info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
[2021-01-11T03:29:47.677Z]       Request finished in 3.0013ms 200 text/plain; charset=utf-8
[2021-01-11T03:29:47.677Z] info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
[2021-01-11T03:29:47.677Z]       Request starting HTTP/1.1 POST http://localhost:24466/intake/v2/events application/x-ndjson; charset=utf-8 1520
[2021-01-11T03:29:47.677Z] info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[3]
[2021-01-11T03:29:47.677Z]       Route matched with {action = "Post", controller = "IntakeV2Events"}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.IActionResult] Post() on controller Elastic.Apm.Tests.MockApmServer.Controllers.IntakeV2EventsController (Elastic.Apm.Tests.MockApmServer).
[2021-01-11T03:29:47.677Z] info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[1]
[2021-01-11T03:29:47.677Z]       Executing action method Elastic.Apm.Tests.MockApmServer.Controllers.IntakeV2EventsController.Post (Elastic.Apm.Tests.MockApmServer) - Validation state: Valid
[2021-01-11T03:29:47.677Z] info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[2]
[2021-01-11T03:29:47.677Z]       Executed action method Elastic.Apm.Tests.MockApmServer.Controllers.IntakeV2EventsController.Post (Elastic.Apm.Tests.MockApmServer), returned result Microsoft.AspNetCore.Mvc.OkObjectResult in 2.7471ms.
[2021-01-11T03:29:47.677Z] info: Microsoft.AspNetCore.Mvc.Infrastructure.ObjectResultExecutor[1]
[2021-01-11T03:29:47.677Z]       Executing ObjectResult, writing value of type 'System.String'.
[2021-01-11T03:29:47.677Z] info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[2]
[2021-01-11T03:29:47.677Z]       Executed action Elastic.Apm.Tests.MockApmServer.Controllers.IntakeV2EventsController.Post (Elastic.Apm.Tests.MockApmServer) in 3.0041ms
[2021-01-11T03:29:47.677Z] info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
[2021-01-11T03:29:47.677Z]       Request finished in 3.2442ms 200 text/plain; charset=utf-8
[2021-01-11T03:29:48.245Z] info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
[2021-01-11T03:29:48.245Z]       Request starting HTTP/1.1 GET http://localhost:24466/config/v1/agents?service.name=AspNetFullFramework_Tests_CentralConfigTests-CustomServiceName&service.environment=AspNetFullFramework_Tests_CentralConfigTests-CustomEnvironment  
[2021-01-11T03:29:48.245Z] info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[3]
[2021-01-11T03:29:48.245Z]       Route matched with {action = "Get", controller = "AgentsConfig"}. Executing controller action with signature Microsoft.AspNetCore.Mvc.IActionResult Get() on controller Elastic.Apm.Tests.MockApmServer.Controllers.AgentsConfigController (Elastic.Apm.Tests.MockApmServer).
[2021-01-11T03:29:48.245Z] info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[1]
[2021-01-11T03:29:48.245Z]       Executing action method Elastic.Apm.Tests.MockApmServer.Controllers.AgentsConfigController.Get (Elastic.Apm.Tests.MockApmServer) - Validation state: Valid
[2021-01-11T03:29:48.245Z] info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[2]
[2021-01-11T03:29:48.245Z]       Executed action method Elastic.Apm.Tests.MockApmServer.Controllers.AgentsConfigController.Get (Elastic.Apm.Tests.MockApmServer), returned result Microsoft.AspNetCore.Mvc.StatusCodeResult in 0.1147ms.
[2021-01-11T03:29:48.245Z] info: Microsoft.AspNetCore.Mvc.StatusCodeResult[1]
[2021-01-11T03:29:48.245Z]       Executing HttpStatusCodeResult, setting HTTP status code 304
[2021-01-11T03:29:48.245Z] info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[2]
[2021-01-11T03:29:48.245Z]       Executed action Elastic.Apm.Tests.MockApmServer.Controllers.AgentsConfigController.Get (Elastic.Apm.Tests.MockApmServer) in 0.2985ms
[2021-01-11T03:29:48.245Z] info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
[2021-01-11T03:29:48.245Z]       Request finished in 0.6135ms 304 
[2021-01-11T03:29:49.620Z] Elastic APM .NET Tests> 97> Console> [2021-01-11 03:29:49.205 +00:00][Info] - {LoggingTestBase} Finished test: Elastic.Apm.AspNetFullFramework.Tests.CentralConfigTests+MaxSpansAndSampleRateTests.MaxSpans_invalid_value
[2021-01-11T03:29:49.620Z] [xUnit.net 00:18:30.3310812]   Finished:    Elastic.Apm.AspNetFullFramework.Tests
[2021-01-11T03:29:49.620Z]   Passed Elastic.Apm.AspNetFullFramework.Tests.CentralConfigTests+MaxSpansAndSampleRateTests.MaxSpans_invalid_value [9 s]
[2021-01-11T03:29:49.620Z] 
[2021-01-11T03:29:49.620Z] JunitXML Logger - Results File: C:\Users\jenkins\workspace\net_apm-agent-dotnet-mbp_PR-1091\apm-agent-dotnet\test\Elastic.Apm.AspNetFullFramework.Tests\junit-NETCoreApp21-Elastic.Apm.AspNetFullFramework.Tests.xml
[2021-01-11T03:29:49.620Z] 
[2021-01-11T03:29:49.620Z] Test Run Successful.
[2021-01-11T03:29:49.620Z] Total tests: 112
[2021-01-11T03:29:49.620Z]      Passed: 112
[2021-01-11T03:29:49.620Z]  Total time: 18.5596 Minutes
[2021-01-11T03:29:49.620Z] 
[2021-01-11T03:29:49.620Z] Build succeeded.
[2021-01-11T03:29:49.620Z]     0 Warning(s)
[2021-01-11T03:29:49.620Z]     0 Error(s)
[2021-01-11T03:29:49.620Z] 
[2021-01-11T03:29:49.620Z] Time Elapsed 00:18:34.94
[2021-01-11T03:29:50.510Z] Post stage
[2021-01-11T03:29:50.524Z] Running in C:\Users\jenkins\workspace\net_apm-agent-dotnet-mbp_PR-1091\apm-agent-dotnet
[2021-01-11T03:29:50.546Z] Archiving artifacts
[2021-01-11T03:29:51.032Z] Recording test results
[2021-01-11T03:29:52.548Z] Post stage
[2021-01-11T03:29:52.566Z] [WS-CLEANUP] Deleting project workspace...
[2021-01-11T03:29:52.566Z] [WS-CLEANUP] Deferred wipeout is disabled by the job configuration...
[2021-01-11T03:29:56.851Z] [WS-CLEANUP] done
[2021-01-11T03:29:57.072Z] Stage "Release to feedz.io" skipped due to earlier failure(s)
[2021-01-11T03:29:57.125Z] Stage "Release" skipped due to earlier failure(s)
[2021-01-11T03:29:57.165Z] Stage "Release" skipped due to earlier failure(s)
[2021-01-11T03:29:57.246Z] Stage "Release" skipped due to earlier failure(s)
[2021-01-11T03:29:57.328Z] Stage "AfterRelease" skipped due to earlier failure(s)
[2021-01-11T03:29:57.349Z] Stage "AfterRelease" skipped due to earlier failure(s)
[2021-01-11T03:29:57.610Z] Running on Jenkins in /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091
[2021-01-11T03:29:57.660Z] [INFO] getVaultSecret: Getting secrets
[2021-01-11T03:29:57.960Z] Masking supported pattern matches of $VAULT_ADDR or $VAULT_ROLE_ID or $VAULT_SECRET_ID
[2021-01-11T03:29:58.665Z] + chmod 755 generate-build-data.sh
[2021-01-11T03:29:58.665Z] + ./generate-build-data.sh https://apm-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/apm-agent-dotnet/apm-agent-dotnet-mbp/PR-1091/ https://apm-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/apm-agent-dotnet/apm-agent-dotnet-mbp/PR-1091/runs/13 FAILURE 4184728
[2021-01-11T03:29:59.216Z] INFO: curl https://apm-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/apm-agent-dotnet/apm-agent-dotnet-mbp/PR-1091/runs/13/steps/?limit=10000 -o steps-info.json
[2021-01-11T03:30:00.128Z] INFO: curl https://apm-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/apm-agent-dotnet/apm-agent-dotnet-mbp/PR-1091/runs/13/tests/?status=FAILED -o tests-errors.json

@gregkalapos gregkalapos self-requested a review December 15, 2020 18:20
Copy link
Contributor

@gregkalapos gregkalapos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Maybe we could also add a test to cover this.

@russcam
Copy link
Contributor Author

russcam commented Dec 16, 2020

Maybe we could also add a test to cover this.

I think it's going to be somewhat difficult to test this, because the test seams are concrete types and static methods i.e. ApmAgent and ApmAgentExtensions.Subscribe():

internal static IApplicationBuilder UseElasticApm(
this IApplicationBuilder builder,
ApmAgent agent,
IApmLogger logger,
params IDiagnosticsSubscriber[] subscribers
)
{
if (!agent.ConfigurationReader.Enabled)
return builder;
var subs = subscribers?.ToList() ?? new List<IDiagnosticsSubscriber>(1);
if (subs.Count == 0 || subs.All(s => s.GetType() != typeof(AspNetCoreErrorDiagnosticsSubscriber)))
subs.Add(new AspNetCoreErrorDiagnosticsSubscriber());
agent.Subscribe(subs.ToArray());
return builder.UseMiddleware<ApmMiddleware>(agent.Tracer, agent);
}

This could be refactored to use the IApmAgent interface and move Subscribe to a method on IApmAgent, but this would be a bit of work. Is there some other obvious way to test that I'm missing?

@gregkalapos
Copy link
Contributor

Is there some other obvious way to test that I'm missing?

In e.g. AspNetCoreBasicTests.cs we could do something like this:

[Fact]
public void RegisterErrorListenerTwice()
{
	var builder = _factory
		.WithWebHostBuilder(n =>
		{
			n.Configure(app =>
			{
			        //this'd end up in the method that you change in this PR... so it'd trigger the code we'd like to test
				app.UseElasticApm(_agent, _agent.Logger, new AspNetCoreErrorDiagnosticsSubscriber());
			});
		});
	builder.CreateClient();
	// And then here assert that _agent.Disposables only contains a single AspNetCoreErrorDiagnosticsSubscriber
}

It'd be a bit of a work and additional code to iterate through _agent.Disposables and check on the types included there, but that should be doable.

But this made me think a bit: Is there any case where it makes sense to subscribe to any of our subscribers more than once? 🤔 I think we could generally say: A subscriber should only subscribe once. Because otherwise we'd create events multiple times (in case of AspNetCoreErrorDiagnosticsSubscriber we'd capture multiple errors, in case of HttpDiagnosticsSubscriber we'd create multiple http spans, etc.).

So I wonder if it'd be better to have a general check - maybe in DiagnosticInitializer.cs or in ApmAgentExtensions.Subscribe - and make sure whatever IDiagnosticsSubscriber is passed into the agent, it'll only subscribe 1 time for each type?

The last part about an overall check for each type is just a general thought and it's not really a problem that was ever reported, so if it's offtopic for this PR, then let's just ignore it.

@russcam
Copy link
Contributor Author

russcam commented Jan 11, 2021

Added a unit test to assert that only one AspNetCoreErrorDiagnosticListener is registered.

So I wonder if it'd be better to have a general check - maybe in DiagnosticInitializer.cs or in ApmAgentExtensions.Subscribe - and make sure whatever IDiagnosticsSubscriber is passed into the agent, it'll only subscribe 1 time for each type?

I can see some value in doing this for our subscribers. Perhaps we can open a separate issue to track?

@gregkalapos
Copy link
Contributor

Added a unit test to assert that only one AspNetCoreErrorDiagnosticListener is registered.

Nice, looks good to me 👍

So I wonder if it'd be better to have a general check - maybe in DiagnosticInitializer.cs or in ApmAgentExtensions.Subscribe - and make sure whatever IDiagnosticsSubscriber is passed into the agent, it'll only subscribe 1 time for each type?

I can see some value in doing this for our subscribers. Perhaps we can open a separate issue to track?

Opened #1119.

I think this is ok to merge.

@russcam russcam merged commit c716415 into elastic:master Jan 11, 2021
@russcam russcam deleted the fix/add-diagnostic-subscribers branch January 11, 2021 23:59
@apmmachine
Copy link
Contributor

❕ Build Aborted

Either there was a build timeout or someone aborted the build.'}

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts

Expand to view the summary

Build stats

  • Build Cause: Pull request #1091 updated

  • Start Time: 2021-01-11T23:51:27.888+0000

  • Duration: 124 min 32 sec

Test stats 🧪

Test Results
Failed 0
Passed 11574
Skipped 0
Total 11574

Log output

Expand to view the last 100 lines of log output

[2021-01-12T01:54:46.025Z] Starting copy source file /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/src/Elastic.Apm/Helpers/DbgUtils.cs. 
[2021-01-12T01:54:46.090Z] Copied /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/src/Elastic.Apm/Helpers/DbgUtils.cs. 
[2021-01-12T01:54:46.091Z] Starting copy source file https://raw.githubusercontent.com/elastic/apm-agent-dotnet/50e3b3ebddfc780e354a835edd22fdf028bdaae3/src/Elastic.Apm/Helpers/TimeExtensions.cs. 
[2021-01-12T01:54:46.151Z] Unable to find source file https://raw.githubusercontent.com/elastic/apm-agent-dotnet/50e3b3ebddfc780e354a835edd22fdf028bdaae3/src/Elastic.Apm/Helpers/TimeExtensions.cs in workspace /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091
[2021-01-12T01:54:46.151Z] Starting copy source file /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/test/Elastic.Apm.Feature.Tests/FeatureContexts/ApiKeyFeatureContext.cs. 
[2021-01-12T01:54:46.219Z] Copied /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/test/Elastic.Apm.Feature.Tests/FeatureContexts/ApiKeyFeatureContext.cs. 
[2021-01-12T01:54:46.220Z] Starting copy source file /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/sample/GrpcServiceSample/Startup.cs. 
[2021-01-12T01:54:46.285Z] Copied /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/sample/GrpcServiceSample/Startup.cs. 
[2021-01-12T01:54:46.285Z] Starting copy source file https://raw.githubusercontent.com/elastic/apm-agent-dotnet/50e3b3ebddfc780e354a835edd22fdf028bdaae3/src/Elastic.Apm/Api/Node.cs. 
[2021-01-12T01:54:46.347Z] Unable to find source file https://raw.githubusercontent.com/elastic/apm-agent-dotnet/50e3b3ebddfc780e354a835edd22fdf028bdaae3/src/Elastic.Apm/Api/Node.cs in workspace /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091
[2021-01-12T01:54:46.347Z] Starting copy source file https://raw.githubusercontent.com/elastic/apm-agent-dotnet/50e3b3ebddfc780e354a835edd22fdf028bdaae3/src/Elastic.Apm.GrpcClient/GrpcClientDiagnosticSubscriber.cs. 
[2021-01-12T01:54:46.416Z] Unable to find source file https://raw.githubusercontent.com/elastic/apm-agent-dotnet/50e3b3ebddfc780e354a835edd22fdf028bdaae3/src/Elastic.Apm.GrpcClient/GrpcClientDiagnosticSubscriber.cs in workspace /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091
[2021-01-12T01:54:46.416Z] Starting copy source file /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/test/Elastic.Apm.Tests/TestHelpers/TaskTestExtensions.cs. 
[2021-01-12T01:54:46.484Z] Copied /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/test/Elastic.Apm.Tests/TestHelpers/TaskTestExtensions.cs. 
[2021-01-12T01:54:46.484Z] Starting copy source file https://raw.githubusercontent.com/elastic/apm-agent-dotnet/50e3b3ebddfc780e354a835edd22fdf028bdaae3/src/Elastic.Apm/Helpers/RandomGenerator.cs. 
[2021-01-12T01:54:46.556Z] Unable to find source file https://raw.githubusercontent.com/elastic/apm-agent-dotnet/50e3b3ebddfc780e354a835edd22fdf028bdaae3/src/Elastic.Apm/Helpers/RandomGenerator.cs in workspace /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091
[2021-01-12T01:54:46.556Z] Starting copy source file /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/test/Elastic.Apm.AspNetCore.Tests/FailedRequestTests.cs. 
[2021-01-12T01:54:46.631Z] Copied /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/test/Elastic.Apm.AspNetCore.Tests/FailedRequestTests.cs. 
[2021-01-12T01:54:46.631Z] Starting copy source file /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/src/Elastic.Apm/Api/System.cs. 
[2021-01-12T01:54:46.704Z] Copied /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/src/Elastic.Apm/Api/System.cs. 
[2021-01-12T01:54:46.704Z] Starting copy source file /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/src/Elastic.Apm/Config/AbstractConfigurationReader.cs. 
[2021-01-12T01:54:46.782Z] Copied /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/src/Elastic.Apm/Config/AbstractConfigurationReader.cs. 
[2021-01-12T01:54:46.783Z] Starting copy source file https://raw.githubusercontent.com/elastic/apm-agent-dotnet/50e3b3ebddfc780e354a835edd22fdf028bdaae3/src/Elastic.Apm.Specification/TypeValidationResult.cs. 
[2021-01-12T01:54:46.847Z] Unable to find source file https://raw.githubusercontent.com/elastic/apm-agent-dotnet/50e3b3ebddfc780e354a835edd22fdf028bdaae3/src/Elastic.Apm.Specification/TypeValidationResult.cs in workspace /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091
[2021-01-12T01:54:46.847Z] Starting copy source file /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/src/Elastic.Apm/Api/SpanCount.cs. 
[2021-01-12T01:54:46.915Z] Copied /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/src/Elastic.Apm/Api/SpanCount.cs. 
[2021-01-12T01:54:46.915Z] Starting copy source file /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/src/Elastic.Apm/Metrics/MetricsProvider/ProcessTotalCpuTimeProvider.cs. 
[2021-01-12T01:54:46.980Z] Copied /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/src/Elastic.Apm/Metrics/MetricsProvider/ProcessTotalCpuTimeProvider.cs. 
[2021-01-12T01:54:46.981Z] Starting copy source file https://raw.githubusercontent.com/elastic/apm-agent-dotnet/50e3b3ebddfc780e354a835edd22fdf028bdaae3/src/Elastic.Apm.AspNetCore/Extensions/StringExtensions.cs. 
[2021-01-12T01:54:47.044Z] Unable to find source file https://raw.githubusercontent.com/elastic/apm-agent-dotnet/50e3b3ebddfc780e354a835edd22fdf028bdaae3/src/Elastic.Apm.AspNetCore/Extensions/StringExtensions.cs in workspace /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091
[2021-01-12T01:54:47.044Z] Starting copy source file https://raw.githubusercontent.com/elastic/apm-agent-dotnet/50e3b3ebddfc780e354a835edd22fdf028bdaae3/src/Elastic.Apm/Api/Database.cs. 
[2021-01-12T01:54:47.109Z] Unable to find source file https://raw.githubusercontent.com/elastic/apm-agent-dotnet/50e3b3ebddfc780e354a835edd22fdf028bdaae3/src/Elastic.Apm/Api/Database.cs in workspace /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091
[2021-01-12T01:54:47.109Z] Starting copy source file /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/test/Elastic.Apm.Tests/TestHelpers/LineWriterToLoggerAdaptor.cs. 
[2021-01-12T01:54:47.173Z] Copied /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/test/Elastic.Apm.Tests/TestHelpers/LineWriterToLoggerAdaptor.cs. 
[2021-01-12T01:54:47.173Z] Starting copy source file /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/src/Elastic.Apm/Config/EnvironmentConfigurationReader.cs. 
[2021-01-12T01:54:47.242Z] Copied /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/src/Elastic.Apm/Config/EnvironmentConfigurationReader.cs. 
[2021-01-12T01:54:47.243Z] Starting copy source file /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/test/Elastic.Apm.EntityFrameworkCore.Tests/ExternalDbTests.cs. 
[2021-01-12T01:54:47.313Z] Copied /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/test/Elastic.Apm.EntityFrameworkCore.Tests/ExternalDbTests.cs. 
[2021-01-12T01:54:47.313Z] Starting copy source file https://raw.githubusercontent.com/elastic/apm-agent-dotnet/50e3b3ebddfc780e354a835edd22fdf028bdaae3/src/Elastic.Apm.Elasticsearch/SerializerDiagnosticsListener .cs. 
[2021-01-12T01:54:47.383Z] Unable to find source file https://raw.githubusercontent.com/elastic/apm-agent-dotnet/50e3b3ebddfc780e354a835edd22fdf028bdaae3/src/Elastic.Apm.Elasticsearch/SerializerDiagnosticsListener .cs in workspace /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091
[2021-01-12T01:54:47.383Z] Starting copy source file /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/src/Elastic.Apm/Helpers/GrpcHelper.cs. 
[2021-01-12T01:54:47.459Z] Copied /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/src/Elastic.Apm/Helpers/GrpcHelper.cs. 
[2021-01-12T01:54:47.459Z] Starting copy source file /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/test/Elastic.Apm.Tests/HelpersTests/StringBuilderExtensionsTests.cs. 
[2021-01-12T01:54:47.525Z] Copied /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/test/Elastic.Apm.Tests/HelpersTests/StringBuilderExtensionsTests.cs. 
[2021-01-12T01:54:47.525Z] Starting copy source file /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/src/Elastic.Apm/Api/Request.cs. 
[2021-01-12T01:54:47.593Z] Copied /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/src/Elastic.Apm/Api/Request.cs. 
[2021-01-12T01:54:47.593Z] Starting copy source file /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/test/Elastic.Apm.Tests/HelpersTests/AgentSpinLockTests.cs. 
[2021-01-12T01:54:47.659Z] Copied /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/test/Elastic.Apm.Tests/HelpersTests/AgentSpinLockTests.cs. 
[2021-01-12T01:54:47.659Z] Starting copy source file /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/test/Elastic.Apm.Tests/FilterTests.cs. 
[2021-01-12T01:54:47.729Z] Copied /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/test/Elastic.Apm.Tests/FilterTests.cs. 
[2021-01-12T01:54:47.729Z] Starting copy source file /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/test/Elastic.Apm.Tests/TestHelpers/JsonUtils.cs. 
[2021-01-12T01:54:47.795Z] Copied /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/test/Elastic.Apm.Tests/TestHelpers/JsonUtils.cs. 
[2021-01-12T01:54:47.795Z] Starting copy source file /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/test/Elastic.Apm.AspNetCore.Tests/ApmMiddlewareExtensionTest.cs. 
[2021-01-12T01:54:47.868Z] Copied /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/test/Elastic.Apm.AspNetCore.Tests/ApmMiddlewareExtensionTest.cs. 
[2021-01-12T01:54:47.869Z] Starting copy source file https://raw.githubusercontent.com/elastic/apm-agent-dotnet/50e3b3ebddfc780e354a835edd22fdf028bdaae3/src/Elastic.Apm/Filters/SpanStackTraceCapturingFilter.cs. 
[2021-01-12T01:54:47.931Z] Unable to find source file https://raw.githubusercontent.com/elastic/apm-agent-dotnet/50e3b3ebddfc780e354a835edd22fdf028bdaae3/src/Elastic.Apm/Filters/SpanStackTraceCapturingFilter.cs in workspace /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091
[2021-01-12T01:54:47.931Z] Starting copy source file /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/src/Elastic.Apm/Logging/ConsoleLogger.cs. 
[2021-01-12T01:54:48.001Z] Copied /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/src/Elastic.Apm/Logging/ConsoleLogger.cs. 
[2021-01-12T01:54:48.001Z] Starting copy source file /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/test/Elastic.Apm.Feature.Tests/Features/api_key.feature. 
[2021-01-12T01:54:48.074Z] Copied /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/test/Elastic.Apm.Feature.Tests/Features/api_key.feature. 
[2021-01-12T01:54:48.074Z] Starting copy source file /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/test/Elastic.Apm.Tests/TestHelpers/SplittingLineWriter.cs. 
[2021-01-12T01:54:48.141Z] Copied /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/test/Elastic.Apm.Tests/TestHelpers/SplittingLineWriter.cs. 
[2021-01-12T01:54:48.141Z] Starting copy source file /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/src/Elastic.Apm/Api/Label.cs. 
[2021-01-12T01:54:48.207Z] Copied /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/src/Elastic.Apm/Api/Label.cs. 
[2021-01-12T01:54:48.207Z] Starting copy source file /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/src/Elastic.Apm/Helpers/StringExtensions.cs. 
[2021-01-12T01:54:48.273Z] Copied /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/src/Elastic.Apm/Helpers/StringExtensions.cs. 
[2021-01-12T01:54:48.273Z] Starting copy source file /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/src/Elastic.Apm/Metrics/MetricsProvider/SystemTotalCpuProvider.cs. 
[2021-01-12T01:54:48.344Z] Copied /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/src/Elastic.Apm/Metrics/MetricsProvider/SystemTotalCpuProvider.cs. 
[2021-01-12T01:54:48.344Z] Starting copy source file /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/test/Elastic.Apm.AspNetCore.Tests/AspNetCoreBasicTests.cs. 
[2021-01-12T01:54:48.421Z] Copied /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091/apm-agent-dotnet/test/Elastic.Apm.AspNetCore.Tests/AspNetCoreBasicTests.cs. 
[2021-01-12T01:54:56.868Z] Body did not finish within grace period; terminating with extreme prejudice
[2021-01-12T01:54:56.875Z] Error when executing always post condition:
[2021-01-12T01:54:56.876Z] org.jenkinsci.plugins.workflow.steps.FlowInterruptedException
[2021-01-12T01:54:56.876Z] 	at org.jenkinsci.plugins.workflow.steps.TimeoutStepExecution.cancel(TimeoutStepExecution.java:165)
[2021-01-12T01:54:56.876Z] 	at org.jenkinsci.plugins.workflow.steps.TimeoutStepExecution.access$100(TimeoutStepExecution.java:38)
[2021-01-12T01:54:56.876Z] 	at org.jenkinsci.plugins.workflow.steps.TimeoutStepExecution$1.run(TimeoutStepExecution.java:139)
[2021-01-12T01:54:56.876Z] 	at jenkins.security.ImpersonatingScheduledExecutorService$1.run(ImpersonatingScheduledExecutorService.java:58)
[2021-01-12T01:54:56.876Z] 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[2021-01-12T01:54:56.876Z] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[2021-01-12T01:54:56.876Z] 	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
[2021-01-12T01:54:56.876Z] 	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
[2021-01-12T01:54:56.876Z] 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[2021-01-12T01:54:56.876Z] 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[2021-01-12T01:54:56.876Z] 	at java.lang.Thread.run(Thread.java:748)
[2021-01-12T01:54:56.876Z] 
[2021-01-12T01:54:56.901Z] Archiving artifacts
[2021-01-12T01:54:57.034Z] Failed in branch Linux
[2021-01-12T01:54:57.158Z] Stage "Release to feedz.io" skipped due to earlier failure(s)
[2021-01-12T01:54:57.210Z] Stage "Release" skipped due to earlier failure(s)
[2021-01-12T01:54:57.231Z] Stage "Release" skipped due to earlier failure(s)
[2021-01-12T01:54:57.286Z] Stage "Release" skipped due to earlier failure(s)
[2021-01-12T01:54:57.382Z] Stage "AfterRelease" skipped due to earlier failure(s)
[2021-01-12T01:54:57.411Z] Stage "AfterRelease" skipped due to earlier failure(s)
[2021-01-12T01:54:58.600Z] Running on Jenkins in /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1091
[2021-01-12T01:54:58.965Z] [INFO] getVaultSecret: Getting secrets
[2021-01-12T01:54:59.314Z] Masking supported pattern matches of $VAULT_ADDR or $VAULT_ROLE_ID or $VAULT_SECRET_ID
[2021-01-12T01:55:00.122Z] + chmod 755 generate-build-data.sh
[2021-01-12T01:55:00.123Z] + ./generate-build-data.sh https://apm-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/apm-agent-dotnet/apm-agent-dotnet-mbp/PR-1091/ https://apm-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/apm-agent-dotnet/apm-agent-dotnet-mbp/PR-1091/runs/15 ABORTED 7411975
[2021-01-12T01:55:00.674Z] INFO: curl https://apm-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/apm-agent-dotnet/apm-agent-dotnet-mbp/PR-1091/runs/15/steps/?limit=10000 -o steps-info.json
[2021-01-12T01:55:01.224Z] INFO: curl https://apm-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/apm-agent-dotnet/apm-agent-dotnet-mbp/PR-1091/runs/15/tests/?status=FAILED -o tests-errors.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants