-
Notifications
You must be signed in to change notification settings - Fork 14
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
Update new elastic search request #105
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
import json | ||
import logging | ||
import tempfile | ||
from requests.auth import HTTPBasicAuth | ||
|
||
import opl.http | ||
import opl.status_data | ||
|
||
# Environment variables for OpenSearch credentials | ||
open_search_username = "insights_perf" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please do not hardcode stuff here. This should come from investigator config. |
||
open_search_password = os.environ.get('OPEN_SEARCH_PASSWORD') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would add name of the variable to investigator config just to force user to understand it is needed. |
||
|
||
|
||
def load(server, index, query, paths): | ||
out = {} | ||
|
@@ -21,7 +26,7 @@ def load(server, index, query, paths): | |
f"Querying ES with url={url}, headers={headers} and json={json.dumps(data)}" | ||
) | ||
|
||
response = opl.http.get(url, headers=headers, json=data) | ||
response = opl.http.get(url, auth=HTTPBasicAuth(open_search_username, open_search_password), headers=headers, json=data) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not backwards compatible. We will not be able to migrate all our tests at one moment. We need the change that will not break current setup. |
||
|
||
for item in response["hits"]["hits"]: | ||
logging.debug( | ||
|
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.
Hello Sarath. This is a generic library. Do not do changes like this here.