-
Notifications
You must be signed in to change notification settings - Fork 539
add rum test for geoip tags #18217
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
add rum test for geoip tags #18217
Conversation
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
|
This pull request does not have a backport label. Could you fix it @rubvs? 🙏
|
| ], | ||
| "agent.version": [ | ||
| "5.5.0" | ||
| ], |
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 was this changed ?
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.
+1, the client.geo expansion should not be removed.
| func TestRUMGeoIpTags(t *testing.T) { | ||
| systemtest.CleanupElasticsearch(t) | ||
|
|
||
| // Ensure the geo-database does not get downloaded. |
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.
I might be missing something but I think the issue was about testing the geoip is correctly downloaded and applied. This PR seems to do the opposite 🤔
|
|
||
| r := esapi.ClusterPutSettingsRequest{ | ||
| Body: bytes.NewReader(b), | ||
| } |
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 would this be set to false? The goal is to trigger the geoip downloader and have the relevant fields in the ingested events geoip enriched.
The tags field would only be set if an error happened during this download or enrichment, so we want to check that tags is empty.
|
@simitt, there is something flaky here. The bind volume ( I've also noticed, the db does net get installed properly the first time I run the systems tests. Even with the cluster settings enabled for downloading. The second time I run After looking into this a bit, I see the original Issue, solved in PR, introduced the docker volume for exactly this flaky reason. I'll have a deeper look at this tomorrow. |
Please dig a bit more into why this fails on the first try and succeeds on second. Is it a timing issue? |
|
It doesn't seem like a timing issue from my debugging yesterday. There was a previous PR that would loop twice for this same reason: b5d52d7. I'll look at this today. |
|
Quick update: YesterdayI looked into why downloading the GeoIp database is so inconsistent. I added the following download funtions: func waitGeoIPDatabase(ctx context.Context) error {
b, err := json.Marshal(map[string]any{
"persistent": map[string]any{
"ingest.geoip.downloader.enabled": true,
"ingest.geoip.downloader.eager.download": true, // <- Crucial
},
})
r := esapi.ClusterPutSettingsRequest{
Body: bytes.NewReader(b),
}
res, err := r.Do(ctx, Elasticsearch)
if err != nil {
return err
}
defer res.Body.Close()
if res.IsError() {
return fmt.Errorf("response err: %d", res.StatusCode)
}
var geoIpResponse struct {
Databases []struct {
Id string `json:"id"`
Database struct {
Name string `json:"name"`
} `json:"database"`
} `json:"databases"`
}
first := true
for {
gr, err := Elasticsearch.Ingest.GetGeoipDatabase()
if err != nil {
return err
}
if err := json.NewDecoder(gr.Body).Decode(&geoIpResponse); err != nil {
return err
}
if len(geoIpResponse.Databases) > 0 {
return nil
}
if first {
log.Printf("Waiting for geoIP database to be downloaded")
first = false
}
time.Sleep(waitHealthyInterval)
}
}The critical part, is the addition if
With this setup, and a wait loop, we are able to consistently download the db. However, on my local machine this takes some time - around TodayWith the downloading taking some time, it's safe to assume this will lead to some networking issues in CI, hence the solution outlined in PR. I have been looking into programmatically manipulating the volume to toggle the presence of the database. Updates will follow. |
@rubvs another option to consider: maybe we can intentionally break the ingest processor configuration by updating the |
No, I mean modify the ingest pipeline. Your approach sounds fine. |
|
Superseded by #18325 |
Closes #17603
This system test should fail if there are any
tagsin the indexed doc. This test ensure that if, for some reason, we cannot connect or download thegeoIPdatabase, the system tests will fail.The systems test leverage docker volumes to link the geoip database, see docker-compose. Therefore, properly testing this PR requires some manual steps.
make system-testshould fail with the following error:ingest-geoipvolume enabled indocker-compose.yml, then the system test will pass.