-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[CI][WIP] Scrape metrics at the end of e2e test #6330
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: chahatsagarmain <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6330 +/- ##
==========================================
- Coverage 96.12% 96.11% -0.02%
==========================================
Files 357 360 +3
Lines 20537 20479 -58
==========================================
- Hits 19742 19684 -58
Misses 607 607
Partials 188 188
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Signed-off-by: chahatsagarmain <[email protected]>
Signed-off-by: chahatsagarmain <[email protected]>
Signed-off-by: chahatsagarmain <[email protected]>
Signed-off-by: chahatsagarmain <[email protected]>
Signed-off-by: chahatsagarmain <[email protected]>
Signed-off-by: chahatsagarmain <[email protected]>
@@ -152,6 +152,14 @@ func (s *E2EStorageIntegration) e2eInitialize(t *testing.T, storage string) { | |||
s.SpanReader, err = createSpanReader(logger, ports.QueryGRPC) | |||
require.NoError(t, err) | |||
|
|||
scrapeCmd := exec.Command("./scripts/scrape-metrics.sh", "-t", storage) |
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.
a) it's a good idea that we can execute scraping from this test, instead of from individual shell scripts
b) if we do it here there is no need to call a shell script, just execute an HTTP GET request from Go and write output to a file.
c) why is scrape dir "../../../.."? I believe the cwd for test is the root of the repository already
d) I would suggest we create a .gitignore
-d directory in the root like .metrics
and place all the files there. We don't want to create files that will show up as changes in git.
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.
Yes , we should directly send a get request instead of calling the scrape script
scripts/es-integration-test.sh
Outdated
@@ -130,6 +130,7 @@ main() { | |||
build_local_img | |||
if [[ "${j_version}" == "v2" ]]; then | |||
STORAGE=${distro} SPAN_STORAGE_TYPE=${distro} make jaeger-v2-storage-integration-test | |||
|
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.
please undo unnecessary changes, they create noise
uses: actions/upload-artifact@v3 | ||
with: | ||
name: cassandra-metrics-${{ matrix.version }} | ||
path: ./metrics/cassandra_metrics.txt |
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.
this job runs in a matrix multiple times. In v1 runs there won't be any metrics. In v2 I don't think we want to upload them with the same file name.
path: ./metrics/cassandra_metrics.txt | |
path: ./metrics/cassandra_metrics_${{ matrix.version.major }}_${{ matrix.version.schema }}_${{ matrix.jaeger-version }}.txt |
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.
@yurishkuro the artifacts will identified with name parameter so we can have simple path for the file ?
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.
please implement downloading them, then we can see
with: | ||
name: cassandra-metrics-${{ matrix.version }} | ||
path: ./metrics/cassandra_metrics.txt | ||
retention-days: 7 |
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.
this won't be enough for artifacts uploaded for a release (those should be at 60 days)
|
||
|
||
|
||
|
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.
How would we download the artifacts back for comparison with the ones from the release?
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.
https://github.com/actions/download-artifact
using this but we need unique name for uploaded artifacts .
Signed-off-by: chahatsagarmain <[email protected]>
with: | ||
name: cassandra-metrics-${{ matrix.version }} | ||
path: ./metrics/cassandra_metrics.txt | ||
retention-days: 60 |
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.
60 days could force us to exceed storage quota from GitHub. We only need 60 days for uploads from tagged release, all other uploads can have 7 days retention.
@@ -152,6 +152,28 @@ func (s *E2EStorageIntegration) e2eInitialize(t *testing.T, storage string) { | |||
s.SpanReader, err = createSpanReader(logger, ports.QueryGRPC) | |||
require.NoError(t, err) | |||
|
|||
req, err := http.NewRequestWithContext(context.Background(), http.MethodGet, "http://localhost:8888/metrics", nil) |
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.
a) why would you scrape metrics before the test starts?
b) please move this code to a helper function
c) you can probably schedule this function to run in t.Cleanup()
so that it runs just before the binary is stopped
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.
Got it
scripts/scrape-metrics.sh
Outdated
@@ -0,0 +1,78 @@ | |||
#!/bin/bash |
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.
we don't need this script anymore, right?
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.
Yes
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.
Will remove it
Signed-off-by: chahatsagarmain <[email protected]>
with: | ||
name: badger-metrics-${{ matrix.version }} | ||
path: ./metrics/badger_metrics.txt | ||
retention-days: 7 |
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.
Why do you keep switching between 7 and 60 days? I already explained that we need BOTH of those retention values depending on whether the job runs for a tagged release or not.
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.
how do we know if its a tagged release run or a normal run ?
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.
${{ github.event_name == 'release' && 60 || 7 }}
something like this ?
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.
no, we don't run these workflows on release event. When CI runs for a tag I think the github.ref
variable has a value like refs/tags/v1.0.0
, so we can check for that.
But before we even get into all of that we need to define the main logic for comparing metrics artifacts between the current run and the last release. For example. there is this action https://github.com/benchmark-action/github-action-benchmark that does something similar but for benchmark results. It seems to suggest using actions/cache@v4 to store the results of the tagged release run.
@@ -50,3 +50,4 @@ sha256sum.combined.txt | |||
resource.syso | |||
.gocache | |||
test-results.json | |||
metrics/ |
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.
Please use dot-name .metrics
. I don't need to see this dir in ls
.
err = os.MkdirAll("../../../../metrics", os.ModePerm) | ||
if err != nil { | ||
t.Fatalf("Failed to create directory: %v", err) | ||
} |
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.
err = os.MkdirAll("../../../../metrics", os.ModePerm) | |
if err != nil { | |
t.Fatalf("Failed to create directory: %v", err) | |
} | |
const outputDir = "../../../../.metrics" | |
require.NoError(t, os.MkdirAll(outputDir, os.ModePerm)) |
metricsFile, err := os.Create(fmt.Sprintf("../../../../metrics/%v_metrics.txt", storage)) | ||
if err != nil { | ||
t.Fatalf("Failed to create metrics file: %v", err) | ||
} |
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.
metricsFile, err := os.Create(fmt.Sprintf("../../../../metrics/%v_metrics.txt", storage)) | |
if err != nil { | |
t.Fatalf("Failed to create metrics file: %v", err) | |
} | |
metricsFile, err := os.Create(fmt.Sprintf("%s/%v_metrics.txt", outputDir, storage)) | |
require.NoError(t, err) |
Which problem is this PR solving?
Description of the changes
How was this change tested?
Checklist
jaeger
:make lint test
jaeger-ui
:yarn lint
andyarn test