-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
chore(datadog_agent source, datadog_metrics sink): Add end to end tests with the Datadog Agent for metrics. #18840
Merged
neuronull
merged 72 commits into
neuronull/dd_e2e_infra_logs
from
neuronull/dd_e2e_metrics
Jan 31, 2024
Merged
Changes from 62 commits
Commits
Show all changes
72 commits
Select commit
Hold shift + click to select a range
e522ded
start
neuronull d7592c6
CI
neuronull 79248a3
Merge branch 'neuronull/dd_e2e_infra_logs' into neuronull/dd_e2e_metrics
neuronull d8891fd
add scaffolding for the differentiation of series API versions
neuronull 91ca255
fix(datadog_metrics sink): fix the integration tests which weren't ac…
neuronull 9afbd83
fix workflows
neuronull cc9cc2d
clippy
neuronull 597305d
fix filter for traces
neuronull 3f9cd72
add first pass
neuronull 4e204c5
Merge branch 'neuronull/fix_datadog_metrics_sink_integration_tests' i…
neuronull 3a96f18
add testing coverage
neuronull 9923219
cargo.lock
neuronull 4523fcd
reduce duplicated code
neuronull a87bf0c
cleanup
neuronull 376da18
clippy
neuronull 715cf22
Merge branch 'master' into neuronull/fix_datadog_metrics_sink_integra…
neuronull 7117d98
Merge branch 'neuronull/fix_datadog_metrics_sink_integration_tests' i…
neuronull 5912324
Merge branch 'master' into neuronull/sink_datadog_metrics_v2_series_e…
neuronull c95a326
feedback ds: remove check for sort by name
neuronull d73cfe0
feedback ds: extend unit tests for v2
neuronull c9c0fbc
feedback ds: extend the int test coverage
neuronull 2ac5bbf
Revert "feedback ds: remove check for sort by name"
neuronull cb92dc5
add explicit sort check
neuronull 96ef122
add env var for v1 support
neuronull 2de3617
check events
neuronull b9181e0
add note in deprecations
neuronull 4920c7c
Merge branch 'master' into neuronull/sink_datadog_metrics_v2_series_e…
neuronull 45e78e5
Merge branch 'neuronull/dd_e2e_infra_logs' into neuronull/dd_e2e_metrics
neuronull 7406730
ds feedback logs PR
neuronull d513eaf
Merge branch 'master' into neuronull/sink_datadog_metrics_v2_series_e…
neuronull 90d9ca8
Merge branch 'neuronull/sink_datadog_metrics_v2_series_endpoint_conve…
neuronull b7451f5
config pain; start aggregation
neuronull e7f3953
Merge branch 'neuronull/dd_e2e_infra_logs' into neuronull/dd_e2e_metrics
neuronull 6f7d3b8
Merge branch 'neuronull/dd_e2e_metrics' into neuronull/dd_e2e_metrics…
neuronull 244b9ed
remove dead code allow
neuronull f3db321
Merge branch 'neuronull/sink_datadog_metrics_v2_series_endpoint_conve…
neuronull cc35100
move to e2e dir
neuronull 50f2988
improve comparison logic
neuronull e47a00e
Merge branch 'master' into neuronull/dd_e2e_metrics
neuronull 15e9c83
Merge branch 'neuronull/dd_e2e_metrics' into neuronull/dd_e2e_metrics…
neuronull 9705c12
code reduction
neuronull 93ca197
add sketches, some reorg
neuronull 2dd590a
Merge branch 'neuronull/dd_e2e_infra_logs' into neuronull/dd_e2e_metrics
neuronull c66de4f
cleanup
neuronull 9125574
Merge branch 'neuronull/dd_e2e_infra_logs' into neuronull/dd_e2e_metrics
neuronull 0ef4238
Merge branch 'master' into neuronull/dd_e2e_metrics
neuronull 2b14940
true up the int test comment changes
neuronull 54fe46d
cleanup
neuronull 48ec676
rework the massaging and comparison model
neuronull 8a166d7
Merge branch 'neuronull/dd_e2e_infra_logs' into neuronull/dd_e2e_metrics
neuronull 61d25be
compare to all versions
neuronull 06277c2
cleanup and address TODO for sketches
neuronull fe3c31e
Merge branch 'neuronull/dd_e2e_infra_logs' into neuronull/dd_e2e_metrics
neuronull aa19307
clippy
neuronull fb7fc57
touchups
neuronull 61c5217
Merge branch 'neuronull/dd_e2e_infra_logs' into neuronull/dd_e2e_metrics
neuronull c0c2e2f
Merge branch 'neuronull/dd_e2e_infra_logs' into neuronull/dd_e2e_metrics
neuronull c33af87
fix workflows
neuronull 1e8bfb0
feedback bg
neuronull af5c4a9
feedback bg
neuronull c9d33d3
feedback ds: metric type check
neuronull 031cdcc
add descriptive comment
neuronull 773bb24
spelling
neuronull 6da0b03
chore(vdev): refactor e2e tests into own subcommand (#19666)
neuronull ce73f67
Merge branch 'neuronull/dd_e2e_infra_logs' into neuronull/dd_e2e_metrics
neuronull 34f9e7a
merge conflict
neuronull 12318fb
update workflows
neuronull 68d0fb7
rename
neuronull 5820a0b
fix e2e logic
neuronull 32e133c
fix e2e
neuronull f11099a
fix e2e
neuronull 5933c06
script usage
neuronull File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
version: '3' | ||
|
||
services: | ||
|
||
# Emits metrics to the Agent only path | ||
dogstatsd-client-agent: | ||
build: ./dogstatsd_client | ||
environment: | ||
- STATSD_HOST=datadog-agent | ||
depends_on: | ||
- datadog-agent | ||
|
||
# Emits metrics to the Agent-Vector path | ||
dogstatsd-client-vector: | ||
build: ./dogstatsd_client | ||
environment: | ||
- STATSD_HOST=datadog-agent-vector | ||
depends_on: | ||
- datadog-agent-vector | ||
|
||
# Sends metric data received from the Emitter to the `fakeintake-agent` service | ||
datadog-agent: | ||
image: docker.io/datadog/agent:${CONFIG_AGENT_VERSION} | ||
depends_on: | ||
- fakeintake-agent | ||
environment: | ||
- DD_API_KEY=${TEST_DATADOG_API_KEY:?TEST_DATADOG_API_KEY required} | ||
- DD_HOSTNAME=datadog-agent | ||
volumes: | ||
# The Agent config file | ||
- ${PWD}/tests/data/e2e/datadog/metrics/agent_only.yaml:/etc/datadog-agent/datadog.yaml | ||
|
||
# Sends metric data received from the Emitter to the `vector` service | ||
datadog-agent-vector: | ||
image: docker.io/datadog/agent:${CONFIG_AGENT_VERSION} | ||
depends_on: | ||
- vector | ||
environment: | ||
- DD_API_KEY=${TEST_DATADOG_API_KEY:?TEST_DATADOG_API_KEY required} | ||
- DD_HOSTNAME=datadog-agent-vector | ||
volumes: | ||
# The Agent config file | ||
- ${PWD}/tests/data/e2e/datadog/metrics/agent_vector.yaml:/etc/datadog-agent/datadog.yaml | ||
|
||
# Receives metric data from the `datadog-agent-vector` service and sends | ||
# to the `fakeintake-vector` service. | ||
vector: | ||
depends_on: | ||
- fakeintake-vector | ||
build: | ||
context: ${PWD} | ||
# re-using the integration test runner image since it already has | ||
# compiled vector on it. | ||
image: ${CONFIG_VECTOR_IMAGE} | ||
environment: | ||
- FEATURES=e2e-tests-datadog | ||
working_dir: /home/vector | ||
network_mode: host | ||
command: | ||
- "/usr/bin/vector" | ||
- "-vvv" | ||
- "-c" | ||
- "/home/vector/tests/data/e2e/datadog/metrics/vector.toml" | ||
volumes: | ||
- ${PWD}:/home/vector | ||
|
||
# Receives metric data from the `datadog-agent` service. Is queried by the test runner | ||
# which does the validation of consistency with the other fakeintake service. | ||
fakeintake-agent: | ||
image: docker.io/datadog/fakeintake:latest | ||
|
||
# Receives metric data from the `datadog-agent-vector` service. Is queried by the test runner | ||
# which does the validation of consistency with the other fakeintake service. | ||
fakeintake-vector: | ||
image: docker.io/datadog/fakeintake:latest | ||
|
||
networks: | ||
default: | ||
name: ${VECTOR_NETWORK} | ||
|
||
volumes: | ||
target: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FROM python:3.7-alpine | ||
|
||
COPY . /app | ||
WORKDIR /app | ||
|
||
RUN pip install -r requirements.txt | ||
|
||
CMD [ "python3", "./client.py"] |
56 changes: 56 additions & 0 deletions
56
scripts/e2e/e2e-datadog-metrics/dogstatsd_client/client.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
from datadog import initialize, statsd | ||
import time | ||
import os | ||
import random | ||
|
||
STATSD_HOST = os.getenv('STATSD_HOST') | ||
|
||
print(f"initializing for {STATSD_HOST}") | ||
|
||
options = { | ||
'statsd_host':STATSD_HOST, | ||
'statsd_port':8125 | ||
} | ||
|
||
initialize(**options) | ||
|
||
# Give the Agent time to actually spin up. | ||
# The container may return "ready" but the | ||
# Agent process is still booting. | ||
time.sleep(10) | ||
|
||
hist_data = [ | ||
9, 5, 0, 2, 16, 17, 8, 16, 10, 13, | ||
15, 3, 9, 13, 11, 17, 5, 18, 14, 9, | ||
4, 16, 9, 17, 4, 11, 7, 14, 8, 12, | ||
10, 9, 11, 3, 18, 12, 17, 12, 3, 19, | ||
9, 11, 19, 9, 15, 2, 7, 10, 4, 14 | ||
] | ||
|
||
dist_data = [ | ||
18, 5, 19, 0, 13, 12, 5, 12, 10, 4, | ||
1, 5, 7, 1, 14, 16, 20, 0, 8, 2, 4, | ||
20, 8, 4, 20, 6, 20, 3, 10, 11, 12, | ||
15, 2, 12, 5, 19, 19, 5, 9, 6, 18, | ||
19, 11, 6, 17, 5, 0, 1, 17, 17 | ||
] | ||
|
||
for i in range(50): | ||
print("rate") | ||
statsd.increment('foo_metric.rate', tags=['a_tag:1']) | ||
|
||
print("gauge") | ||
statsd.gauge('foo_metric.gauge', i, tags=["a_tag:2"]) | ||
|
||
print("set") | ||
statsd.set('foo_metric.set', i, tags=["a_tag:3"]) | ||
|
||
print("histogram") | ||
statsd.histogram('foo_metric.histogram', hist_data[i], tags=["a_tag:4"]) | ||
|
||
print("distribution") | ||
statsd.distribution('foo_metric.distribution', dist_data[i], tags=["a_tag:5"]) | ||
|
||
statsd.flush() | ||
time.sleep(0.01) | ||
|
1 change: 1 addition & 0 deletions
1
scripts/e2e/e2e-datadog-metrics/dogstatsd_client/requirements.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
datadog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
features: | ||
- e2e-tests-datadog | ||
|
||
test: "e2e" | ||
|
||
test_filter: 'datadog::metrics::' | ||
|
||
runner: | ||
env: | ||
VECTOR_RECEIVE_PORT: '8081' | ||
FAKE_INTAKE_AGENT_ENDPOINT: 'http://fakeintake-agent:80' | ||
FAKE_INTAKE_VECTOR_ENDPOINT: 'http://fakeintake-vector:80' | ||
|
||
matrix: | ||
# validate against the Agent latest nightly and also stable v6 and v7 | ||
agent_version: ['latest', '6', '7'] | ||
|
||
# changes to these files/paths will invoke the integration test in CI | ||
# expressions are evaluated using https://github.com/micromatch/picomatch | ||
paths: | ||
- "src/common/datadog.rs" | ||
- "src/sources/datadog_agent/**" | ||
- "src/internal_events/datadog_*" | ||
- "src/sinks/datadog/metrics/**" | ||
- "src/sinks/util/**" | ||
- "scripts/integration/datadog-e2e/metrics/**" | ||
- "tests/data/e2e/datadog/metrics/**" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The framework in this PR is the bulk of the changes ... if anyone has suggestions on additional test cases to cover, that would be helpful. In theory the framework should hold up and we would just need to extend this code.