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

Closes #60 #63

Merged
merged 1 commit into from Jun 7, 2018
Merged

Closes #60 #63

merged 1 commit into from Jun 7, 2018

Conversation

aswanipranjal
Copy link
Contributor

Updated comments in esquery.py.
Metrics.py uses elasticsearch_dsl.py instead of directly requesting easticsearch for data.
Updated test for get_agg.

Copy link
Contributor

@jgbarah jgbarah 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 to me. @acs @valeriocos could you you have al lpok, please?

start_ts = start.replace(tzinfo=timezone.utc).timestamp()
start_ts_ms = start_ts * 1000 # ES uses ms
if end:
end = end.replace(microsecond=0)
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need to set microsecond to 0? Is not configured in this way by default?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@acs: No, it isn't configured this way by default and results in an error from elasticsearch.
screen shot 2018-06-04 at 11 46 57 am
This error presents it self when we convert datetime to timestamp.
I'll update the file and mention it there.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, ok, it is related with the migration to elasticsearch_dsl. Great! I want just to understand the need for it. Thanks you @aswanipranjal ! LGTM

response = s.execute()
return response.to_dict()
except Exception as e:
raise e
Copy link
Member

Choose a reason for hiding this comment

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

Capturing the Exception an reraising it without doing any thing is a bit weird. And having the return inside the try also.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My bad. I wanted to use the error and show the exact information about the error to the user to make debugging easier.

Copy link
Member

Choose a reason for hiding this comment

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

IMHO once this comment is addressed the PR is ready to be merged.

@aswanipranjal
Copy link
Contributor Author

PR #64 and this one have similar errors. I am looking into them.

@aswanipranjal
Copy link
Contributor Author

aswanipranjal commented Jun 4, 2018

So, for the tests, what is happening is:
In the bool query for must match field, the function get_query_filters is returning a list which is same as the list to test but the ordering of elements is different. So it is comparing "name1":"value1" key pair to "name2":"value2" key pair and vice versa, hence the tests keep on failing.

In #64 i removed the error from test_get_query_filters but the test_get_query_basic still gives an error because the lists inside the two dict we compare have different ordering of elements.

@aswanipranjal
Copy link
Contributor Author

@jgbarah, @acs, should I change the function get_query_filters and then rewrite the tests? Right now, as far as I can tell, the dictionaries are identical but the lists inside them might have same items in different orders.

Updated comments in esquery.py.
Metrics.py uses elasticsearch_dsl.py instead of directly
requesting easticsearch for data.
Updated test for get_agg.
@aswanipranjal
Copy link
Contributor Author

Fixed the errors using OrdereDict instead.

@jgbarah
Copy link
Contributor

jgbarah commented Jun 7, 2018

I see that fixed the test. So, ready to go!

@jgbarah jgbarah merged commit 10e5707 into chaoss:master Jun 7, 2018
@aswanipranjal aswanipranjal deleted the cleanup-esquery2 branch July 8, 2018 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants