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

test/new-e2e/trace-agent: add basic e2e test #22261

Merged
merged 25 commits into from Feb 5, 2024

Conversation

knusbaum
Copy link
Contributor

@knusbaum knusbaum commented Jan 22, 2024

What does this PR do?

This PR adds a new, simple e2e test for the trace agent, generating some traces and checking that intake receives what we expect.

Motivation

This will serve as a basic check of the agent, as well as serving as a template for more complicated e2e tests.

Additional Notes

Possible Drawbacks / Trade-offs

Describe how to test/QA your changes

N/A

Reviewer's Checklist

  • If known, an appropriate milestone has been selected; otherwise the Triage milestone is set.
  • Use the major_change label if your change either has a major impact on the code base, is impacting multiple teams or is changing important well-established internals of the Agent. This label will be use during QA to make sure each team pay extra attention to the changed behavior. For any customer facing change use a releasenote.
  • A release note has been added or the changelog/no-changelog label has been applied.
  • Changed code has automated tests for its functionality.
  • Adequate QA/testing plan information is provided. Except if the qa/skip-qa label, with required either qa/done or qa/no-code-change labels, are applied.
  • At least one team/.. label has been applied, indicating the team(s) that should QA this change.
  • If applicable, docs team has been notified or an issue has been opened on the documentation repo.
  • If applicable, the need-change/operator and need-change/helm labels have been applied.
  • If applicable, the k8s/<min-version> label, indicating the lowest Kubernetes version compatible with this feature.
  • If applicable, the config template has been updated.

@knusbaum knusbaum added changelog/no-changelog team/agent-apm trace-agent qa/skip-qa Use this tag to skip creating a QA card for a Pull Request. labels Jan 22, 2024
@knusbaum knusbaum added this to the 7.52.0 milestone Jan 22, 2024
@knusbaum knusbaum force-pushed the knusbaum/trace-agent-e2e-basic branch from 5d0c748 to c821d3b Compare January 24, 2024 19:41
@knusbaum knusbaum force-pushed the knusbaum/trace-agent-e2e-basic branch from 8de9039 to c7e0c0d Compare January 24, 2024 21:44
@knusbaum knusbaum marked this pull request as ready for review January 24, 2024 21:46
@knusbaum knusbaum requested review from a team as code owners January 24, 2024 21:46
@knusbaum knusbaum added the qa/no-code-change Skip QA week as there is no code change in Agent code label Jan 24, 2024
@pr-commenter
Copy link

pr-commenter bot commented Jan 24, 2024

Bloop Bleep... Dogbot Here

Regression Detector Results

Run ID: a64a1d10-6217-45be-b696-b8c464553a79
Baseline: ea7d79b
Comparison: 92340df
Total CPUs: 7

Performance changes are noted in the perf column of each table:

  • ✅ = significantly better comparison variant performance
  • ❌ = significantly worse comparison variant performance
  • ➖ = no significant change in performance

No significant changes in experiment optimization goals

Confidence level: 90.00%
Effect size tolerance: |Δ mean %| ≥ 5.00%

There were no significant changes in experiment optimization goals at this confidence level and effect size tolerance.

Experiments ignored for regressions

Regressions in experiments with settings containing erratic: true are ignored.

perf experiment goal Δ mean % Δ mean % CI
idle memory utilization -0.33 [-0.38, -0.28]
file_tree memory utilization -0.45 [-0.55, -0.36]
file_to_blackhole % cpu utilization -0.48 [-7.03, +6.08]

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI
process_agent_real_time_mode memory utilization +0.27 [+0.23, +0.31]
tcp_syslog_to_blackhole ingress throughput +0.13 [+0.07, +0.20]
trace_agent_msgpack ingress throughput +0.07 [+0.05, +0.08]
uds_dogstatsd_to_api ingress throughput +0.00 [-0.03, +0.03]
tcp_dd_logs_filter_exclude ingress throughput -0.00 [-0.06, +0.06]
trace_agent_json ingress throughput -0.05 [-0.08, -0.02]
process_agent_standard_check_with_stats memory utilization -0.10 [-0.15, -0.05]
idle memory utilization -0.33 [-0.38, -0.28]
file_tree memory utilization -0.45 [-0.55, -0.36]
process_agent_standard_check memory utilization -0.47 [-0.52, -0.41]
file_to_blackhole % cpu utilization -0.48 [-7.03, +6.08]
otel_to_otel_logs ingress throughput -0.63 [-1.35, +0.08]
uds_dogstatsd_to_api_cpu % cpu utilization -1.11 [-2.55, +0.33]

Explanation

A regression test is an A/B test of target performance in a repeatable rig, where "performance" is measured as "comparison variant minus baseline variant" for an optimization goal (e.g., ingress throughput). Due to intrinsic variability in measuring that goal, we can only estimate its mean value for each experiment; we report uncertainty in that value as a 90.00% confidence interval denoted "Δ mean % CI".

For each experiment, we decide whether a change in performance is a "regression" -- a change worth investigating further -- if all of the following criteria are true:

  1. Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.

  2. Its 90.00% confidence interval "Δ mean % CI" does not contain zero, indicating that if our statistical model is accurate, there is at least a 90.00% chance there is a difference in performance between baseline and comparison variants.

  3. Its configuration does not mark it "erratic".

Copy link
Contributor

@ahmed-mez ahmed-mez left a comment

Choose a reason for hiding this comment

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

Looks good, just added some comments!

Before merging, let's make sure all the tests pass locally since they're skipped on the CI currently.

test/new-e2e/tests/apm/docker_test.go Outdated Show resolved Hide resolved
test/new-e2e/tests/apm/docker_test.go Outdated Show resolved Hide resolved
test/new-e2e/tests/apm/docker_test.go Outdated Show resolved Hide resolved
test/new-e2e/tests/apm/docker_test.go Outdated Show resolved Hide resolved
test/new-e2e/tests/apm/docker_test.go Show resolved Hide resolved
test/new-e2e/tests/apm/docker_test.go Outdated Show resolved Hide resolved
test/new-e2e/tests/apm/docker_test.go Show resolved Hide resolved
test/new-e2e/go.mod Outdated Show resolved Hide resolved
test/new-e2e/pkg/environments/aws/host/host.go Outdated Show resolved Hide resolved
test/new-e2e/tests/apm/docker_test.go Show resolved Hide resolved
Copy link
Contributor

@ajgajg1134 ajgajg1134 left a comment

Choose a reason for hiding this comment

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

Overall looks good for our e2e tests, although I can't really comment too much on the changes to the components themselves (but I'm sure e2e team can look at those)

Just a few small change requests :)

test/new-e2e/tests/apm/tests.go Outdated Show resolved Hide resolved
test/new-e2e/tests/apm/tests.go Show resolved Hide resolved
test/new-e2e/tests/apm/tracegen.go Outdated Show resolved Hide resolved
Copy link
Contributor

@ahmed-mez ahmed-mez left a comment

Choose a reason for hiding this comment

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

Nice refactoring of the existing tests 👏

test/new-e2e/tests/apm/vm_test.go Show resolved Hide resolved
@ahmed-mez ahmed-mez removed the request for review from a team February 2, 2024 08:59
test/new-e2e/pkg/components/remotehost.go Show resolved Hide resolved
test/new-e2e/pkg/environments/aws/host/host.go Outdated Show resolved Hide resolved
test/new-e2e/tests/apm/docker_test.go Outdated Show resolved Hide resolved
test/new-e2e/tests/apm/vm_test.go Show resolved Hide resolved
@knusbaum knusbaum requested a review from a team as a code owner February 2, 2024 10:47
@ahmed-mez ahmed-mez force-pushed the knusbaum/trace-agent-e2e-basic branch from 2664fb0 to e601dbc Compare February 2, 2024 13:39
dockeragentparams.WithAgentServiceEnvVariable("STATSD_URL", pulumi.String("unix:///var/run/datadog/dsd.socket")), // Optional: UDS is more reliable for statsd metrics
))),
e2e.WithProvisioner(awsdocker.Provisioner(opts...)),
e2e.WithStackName(fmt.Sprintf("apm-docker-suite-%s-%v", tr, os.Getenv("CI_PIPELINE_ID"))),
Copy link
Contributor

Choose a reason for hiding this comment

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

Added this because the default stack name caused a collision between test suites and errors in the CI

Copy link
Contributor

Choose a reason for hiding this comment

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

You can fix this also by having one base suite and than one implementation per Test*, stack name use the suite name as an ID

Comment on lines 175 to 176
// TODO: Use the e2e context
c, err = v.Env().RemoteHost.DialRemotePort(context.Background(), port)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@vboulineau Not sure how to get the e2e.Context you mentioned. I don't see where I would get access to one anywhere, unless I need to hang on to a reference from the Init function.

Copy link
Contributor

Choose a reason for hiding this comment

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

You'd need to add context.Context to e2e.Context - currently e2e.Context defines only a T() function to return a *testing.T instance.

The suite initialiser needs some changes too, as we need to create a context, probably at suite.init(). Then the function can be RemoteHost.DialRemotePort(port).

We can help with the implementation, but it looks like a bigger change than expected, so I suggest keeping your implementation and refactor it in a follow up, or wait for us to implement the change, or again open a new PR that introduces only the remoteHost.DialPort function.

test/new-e2e/tests/apm/docker_test.go Outdated Show resolved Hide resolved
Comment on lines +125 to +130
func WithDocker() ProvisionerOption {
return func(params *ProvisionerParams) error {
params.installDocker = true
return nil
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

💭 thought
Having docker in an host environment prevents from having the docker client on the output environment struct. I'd rather use the awsdocker environment that has a docker client. The provider there takes care of defaulting to AMIs that have docker already installed, which saves some setup time. But we need a way to allow installing the agent on docker or on the host, so maybe it makes sense to use awshost for this goal.

One way to address the issue of extending default providers is to export the run function, so that you can call it from your custom provider with a custom env based on awshost. Would that work for you ?

Comment on lines +43 to +44
apm_config.enabled: true
apm_config.receiver_socket: /var/run/datadog/apm.socket
Copy link
Contributor

Choose a reason for hiding this comment

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

💬 suggestion
Not a blocker, you can use embed to import it from a yaml file and leverage formatting

dockeragentparams.WithAgentServiceEnvVariable("STATSD_URL", pulumi.String("unix:///var/run/datadog/dsd.socket")), // Optional: UDS is more reliable for statsd metrics
))),
e2e.WithProvisioner(awsdocker.Provisioner(opts...)),
e2e.WithStackName(fmt.Sprintf("apm-docker-suite-%s-%v", tr, os.Getenv("CI_PIPELINE_ID"))),
Copy link
Contributor

Choose a reason for hiding this comment

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

You can fix this also by having one base suite and than one implementation per Test*, stack name use the suite name as an ID

@knusbaum
Copy link
Contributor Author

knusbaum commented Feb 5, 2024

/merge

@dd-devflow
Copy link

dd-devflow bot commented Feb 5, 2024

🚂 MergeQueue

Pull request added to the queue.

There are 2 builds ahead! (estimated merge in less than 47m)

Use /merge -c to cancel this operation!

@dd-mergequeue dd-mergequeue bot merged commit a23db14 into main Feb 5, 2024
174 of 176 checks passed
@dd-mergequeue dd-mergequeue bot deleted the knusbaum/trace-agent-e2e-basic branch February 5, 2024 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog/no-changelog mergequeue-status: done qa/no-code-change Skip QA week as there is no code change in Agent code qa/skip-qa Use this tag to skip creating a QA card for a Pull Request. team/agent-apm trace-agent
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants