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

Make sure Span.Composite is only instantiated for composite spans #1639

Merged
merged 1 commit into from Mar 2, 2022
Merged

Make sure Span.Composite is only instantiated for composite spans #1639

merged 1 commit into from Mar 2, 2022

Conversation

gregkalapos
Copy link
Contributor

Fixes #1631

The agent sent composite":{"count":0,"sum":0.0} which got rejected by APM Server. This PR fixes this and adds a test for a specific case when this happened.

@gregkalapos gregkalapos self-assigned this Mar 2, 2022
@elastic-apm-tech elastic-apm-tech added this to In Progress in APM-Agents (OLD) Mar 2, 2022
@apmmachine
Copy link
Collaborator

💔 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 preview

Expand to view the summary

Build stats

  • Start Time: 2022-03-02T17:22:30.128+0000

  • Duration: 81 min 47 sec

Test stats 🧪

Test Results
Failed 3
Passed 24121
Skipped 136
Total 24260

Test errors 3

Expand to view the tests failures

Initializing / Parallel / Linux / Profiler Tests / ExcludeTests.Elastic.Apm.Profiler.Managed.Tests.ExcludeTests.ShouldNotInstrumentExcludedServiceName – Elastic.Apm.Profiler.Managed.Tests.ExcludeTests
    Expand to view the error details

     Expected logs {empty} to have an item matching line.Contains(Format("service name {0} matches excluded name {1}. Profiler disabled", value(Elastic.Apm.Profiler.Managed.Tests.ExcludeTests+<>c__DisplayClass5_0).serviceName, value(Elastic.Apm.Profiler.Managed.Tests.ExcludeTests+<>c__DisplayClass5_0).serviceName)). 
    

    Expand to view the stacktrace

     Expected logs {empty} to have an item matching line.Contains(Format("service name {0} matches excluded name {1}. Profiler disabled", value(Elastic.Apm.Profiler.Managed.Tests.ExcludeTests+<>c__DisplayClass5_0).serviceName, value(Elastic.Apm.Profiler.Managed.Tests.ExcludeTests+<>c__DisplayClass5_0).serviceName)).
    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.Collections.SelfReferencingCollectionAssertions`2.Contain(Expression`1 predicate, String because, Object[] becauseArgs)
       at Elastic.Apm.Profiler.Managed.Tests.ExcludeTests.ShouldNotInstrumentExcludedServiceName() in /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1639/apm-agent-dotnet/test/Elastic.Apm.Profiler.Managed.Tests/ExcludeTests.cs:line 165
    --- End of stack trace from previous location ---
    Standard Output:
        ProcNet.ObservableProcessException: Exception while starting observable process: dotnet
        ---> System.ComponentModel.Win32Exception (2): No such file or directory
        at System.Diagnostics.Process.ForkAndExecProcess(String filename, String[] argv, String[] envp, String cwd, Boolean redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)
        at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
        at System.Diagnostics.Process.Start()
        at ProcNet.ObservableProcessBase`1.StartProcess(IObserver`1 observer)
        --- End of inner exception stack trace --- 
    

Initializing / Parallel / Linux / Profiler Tests / ExcludeTests.Elastic.Apm.Profiler.Managed.Tests.ExcludeTests.ShouldNotInstrumentAzureAppServiceInfrastructureOrReservedProcess(key: "APP_POOL_ID", value: "~apppool") – Elastic.Apm.Profiler.Managed.Tests.ExcludeTests
    Expand to view the error details

     Expected apmServer.ReceivedData.Spans to contain 32 item(s), but found 0. 
    

    Expand to view the stacktrace

     Expected apmServer.ReceivedData.Spans to contain 32 item(s), but found 0.
    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.Collections.SelfReferencingCollectionAssertions`2.HaveCount(Int32 expected, String because, Object[] becauseArgs)
       at Elastic.Apm.Profiler.Managed.Tests.ExcludeTests.ShouldNotInstrumentAzureAppServiceInfrastructureOrReservedProcess(String key, String value) in /var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1639/apm-agent-dotnet/test/Elastic.Apm.Profiler.Managed.Tests/ExcludeTests.cs:line 222
    --- End of stack trace from previous location ---
    Standard Output:
        ELASTIC_APM_SERVER_URL="http://localhost:23844"
        ELASTIC_APM_DISABLE_METRICS="*"
        ELASTIC_APM_PROFILER_LOG_TARGETS="file;stdout"
        APP_POOL_ID="~apppool"
        CORECLR_ENABLE_PROFILING="1"
        CORECLR_PROFILER="{FA65FE15-F085-4681-9B20-95E04F6C03CC}"
        CORECLR_PROFILER_PATH="/var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1639/apm-agent-dotnet/target/release/libelastic_apm_profiler.so"
        COR_ENABLE_PROFILING="1"
        COR_PROFILER="{FA65FE15-F085-4681-9B20-95E04F6C03CC}"
        COR_PROFILER_PATH="/var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1639/apm-agent-dotnet/target/release/libelastic_apm_profiler.so"
        ELASTIC_APM_PROFILER_HOME="/var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1639/apm-agent-dotnet/src/Elastic.Apm.Profiler.Managed/bin/Release"
        ELASTIC_APM_PROFILER_INTEGRATIONS="/var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1639/apm-agent-dotnet/src/Elastic.Apm.Profiler.Managed/integrations.yml"
        ELASTIC_APM_PROFILER_LOG="trace"
        ELASTIC_APM_PROFILER_LOG_DIR="/var/lib/jenkins/workspace/net_apm-agent-dotnet-mbp_PR-1639/apm-agent-dotnet/logs"
        Could not execute because the specified command or file was not found.
        Possible reasons for this include:
        * You misspelled a built-in dotnet command.
        * You intended to execute a .NET program, but dotnet-SqliteSample.dll does not exist.
        * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH. 
    

Initializing / Parallel / Windows .NET Framework / Test / WorkingLoopTests.Elastic.Apm.Tests.WorkingLoopTests.RequestTimeoutTest – Elastic.Apm.Tests.WorkingLoopTests
    Expand to view the error details

     Expected collection {"{BackendCommUtils} Building HTTP client with BaseAddress: http://localhost:49216/ for BackendCommComponentBase (PayloadSenderV2)...", "{ExceptionUtils.DoSwallowingExceptions} `ElasticApmPayloadSenderV2' (managed ID: 23) thread entry method entered", "{PayloadSenderV2} Using the following configuration options: Events intake API absolute URL: http://localhost:49216/intake/v2/events, FlushInterval: 1ms, MaxBatchEventCount: 10, MaxQueueEventCount: 1000", "{SingleThreadTaskScheduler (thread: ElasticApmPayloadSenderV2)} Adding task... Task: {ID: 1647, Status: WaitingToRun, AsyncState: null}", "{SingleThreadTaskScheduler (thread: ElasticApmPayloadSenderV2)} Added task. Task: {ID: 1647, Status: WaitingToRun, AsyncState: null}", "{BackendCommComponentBase (PayloadSenderV2)} Posted Work loop to internal task scheduler", "{BackendCommComponentBase (PayloadSenderV2)} Waiting for work loop started event...", "{SingleThreadTaskScheduler (thread: ElasticApmPayloadSenderV2)} Starting to execute task... Task: {ID: 1647, Status: WaitingToRun, AsyncState: null}", "{BackendCommComponentBase (PayloadSenderV2)} Signaling work loop started event...", "{BackendCommComponentBase (PayloadSenderV2)} Work loop started signaled", "{PayloadSenderV2} Waiting for data to send... FlushInterval: 1ms", "{SingleThreadTaskScheduler (thread: ElasticApmPayloadSenderV2)} Finished executing task. Task: {ID: 1647, Status: RanToCompletion, AsyncState: null}", "{PayloadSenderV2} Enqueued Transaction. newEventQueueCount: 1. MaxQueueEventCount: 1000. Transaction: Transaction{Id: 0e8f7eb9312aef41, TraceId: da9b9ae08b9d4244ad5200cc61e4f24b, ParentId: null, Name: Test, Type: Test, Outcome: Success, IsSampled: True}.", "{PayloadSenderV2} Enqueued Transaction. newEventQueueCount: 2. MaxQueueEventCount: 1000. Transaction: Transaction{Id: 9d1b94ab02225a4e, TraceId: cb1cd1d700abd34ab2c1fb800a57709f, ParentId: null, Name: Test2, Type: Test, Outcome: Success, IsSampled: True}."} to have an item matching (l.Contains("{PayloadSenderV2} Serialized item to send: Transaction") AndAlso l.Contains("Name: Test2")). 
    

    Expand to view the stacktrace

     Expected collection {"{BackendCommUtils} Building HTTP client with BaseAddress: http://localhost:49216/ for BackendCommComponentBase (PayloadSenderV2)...", "{ExceptionUtils.DoSwallowingExceptions} `ElasticApmPayloadSenderV2' (managed ID: 23) thread entry method entered", "{PayloadSenderV2} Using the following configuration options: Events intake API absolute URL: http://localhost:49216/intake/v2/events, FlushInterval: 1ms, MaxBatchEventCount: 10, MaxQueueEventCount: 1000", "{SingleThreadTaskScheduler (thread: ElasticApmPayloadSenderV2)} Adding task... Task: {ID: 1647, Status: WaitingToRun, AsyncState: null}", "{SingleThreadTaskScheduler (thread: ElasticApmPayloadSenderV2)} Added task. Task: {ID: 1647, Status: WaitingToRun, AsyncState: null}", "{BackendCommComponentBase (PayloadSenderV2)} Posted Work loop to internal task scheduler", "{BackendCommComponentBase (PayloadSenderV2)} Waiting for work loop started event...", "{SingleThreadTaskScheduler (thread: ElasticApmPayloadSenderV2)} Starting to execute task... Task: {ID: 1647, Status: WaitingToRun, AsyncState: null}", "{BackendCommComponentBase (PayloadSenderV2)} Signaling work loop started event...", "{BackendCommComponentBase (PayloadSenderV2)} Work loop started signaled", "{PayloadSenderV2} Waiting for data to send... FlushInterval: 1ms", "{SingleThreadTaskScheduler (thread: ElasticApmPayloadSenderV2)} Finished executing task. Task: {ID: 1647, Status: RanToCompletion, AsyncState: null}", "{PayloadSenderV2} Enqueued Transaction. newEventQueueCount: 1. MaxQueueEventCount: 1000. Transaction: Transaction{Id: 0e8f7eb9312aef41, TraceId: da9b9ae08b9d4244ad5200cc61e4f24b, ParentId: null, Name: Test, Type: Test, Outcome: Success, IsSampled: True}.", "{PayloadSenderV2} Enqueued Transaction. newEventQueueCount: 2. MaxQueueEventCount: 1000. Transaction: Transaction{Id: 9d1b94ab02225a4e, TraceId: cb1cd1d700abd34ab2c1fb800a57709f, ParentId: null, Name: Test2, Type: Test, Outcome: Success, IsSampled: True}."} to have an item matching (l.Contains("{PayloadSenderV2} Serialized item to send: Transaction") AndAlso l.Contains("Name: Test2")).
    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.Collections.SelfReferencingCollectionAssertions`2.Contain(Expression`1 predicate, String because, Object[] becauseArgs)
       at Elastic.Apm.Tests.WorkingLoopTests.RequestTimeoutTest() in C:\Users\jenkins\workspace\net_apm-agent-dotnet-mbp_PR-1639\apm-agent-dotnet\test\Elastic.Apm.Tests\WorkingLoopTests.cs:line 69 
    

Steps errors 5

Expand to view the steps failures

Test & coverage
  • Took 10 min 25 sec . View more details here
  • Description: .ci/linux/test-profiler.sh
Archive the artifacts
  • Took 0 min 0 sec . View more details here
  • Description: [2022-03-02T18:42:36.262Z] Archiving artifacts withAzureCredentials: error hudson.AbortException: s
Test & coverage
  • Took 3 min 1 sec . View more details here
  • Description: .ci/windows/testnet461.bat
Archive the artifacts
  • Took 0 min 0 sec . View more details here
  • Description: [2022-03-02T17:56:51.121Z] Archiving artifacts script returned exit code 1
Error signal
  • Took 0 min 0 sec . View more details here
  • Description: withAzureCredentials: error hudson.AbortException: script returned exit code 1

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • run benchmark tests : Run the benchmark test.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@gregkalapos gregkalapos merged commit d692460 into elastic:main Mar 2, 2022
APM-Agents (OLD) automation moved this from In Progress to Done Mar 2, 2022
@gregkalapos gregkalapos deleted the SpanCompressionFix branch March 2, 2022 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

[BUG] Apm Agent 1.14.0 event sending error on composite span validation - validation rule 'min(2)' violated
2 participants