Skip to content
This repository has been archived by the owner on Dec 31, 2023. It is now read-only.

feat: add "not equal" support to the query filter #11

Merged
merged 2 commits into from Aug 20, 2020

Conversation

qingling128
Copy link
Contributor

Fixes #10

Added unit tests.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Apr 13, 2020
@qingling128 qingling128 force-pushed the patch-1 branch 2 times, most recently from 0842346 to ab5dddd Compare April 13, 2020 17:25
@qingling128
Copy link
Contributor Author

Rebased off the latest master. Can someone help take a look at this one. Should be fairly straight forward.

@qingling128
Copy link
Contributor Author

Can someone help with this PR?

@busunkim96
Copy link
Contributor

@qingling128 Apologies, I didn't see this until now.

Is there a way to do the filter by using the generated code directly? https://github.com/googleapis/python-monitoring/tree/e4bc5682d39f7e5938868497496f5d49318cee43/google/cloud/monitoring_v3/proto

It looks like this client was originally handwritten and query.py is a remnant of that. I believe it should be possible to use the generated library exclusively at this point though.

@qingling128
Copy link
Contributor Author

Hi @busunkim96 ,

We are currently trying to use the library in the following way:

from google.cloud.monitoring_v3 import query as query_v3

    query = query_v3.Query(
        self._client,
        self._project_id,
        metric_type,
        end_time=end_time,
        minutes=look_back_minutes)
    query = query.select_resources(
        resource_type=resource_type, **resource_labels)
    query = query.select_metrics(**metric_labels)
    query = query.align(metric_aligner, minutes=metric_alignment_minutes)
    query = query.reduce(metric_reducer)

Could you elaborate a bit on the suggestion to do the filter by using the generated code directly? I'm not very familiar with what the best practice is for the usage of this library. I found some documentation here: https://cloud.google.com/monitoring/docs/reference/libraries#client-libraries-usage-python. But it does not mention how to query time series though. The code above was put together after reading the source code for a bit.

@qingling128
Copy link
Contributor Author

@busunkim96
Gentle ping.

@busunkim96 busunkim96 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 17, 2020
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 17, 2020
Copy link
Contributor Author

@qingling128 qingling128 left a comment

Choose a reason for hiding this comment

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

Added the documentation link as suggested and rebased from upstream master.

google/cloud/monitoring_v3/query.py Show resolved Hide resolved
@busunkim96 busunkim96 changed the title Add "not equal" support to the query filter. feat: add "not equal" support to the query filter. Jun 19, 2020
@busunkim96 busunkim96 added automerge Merge the pull request once unit tests and other checks pass. kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Jun 19, 2020
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 19, 2020
@gcf-merge-on-green
Copy link
Contributor

Your PR has attempted to merge for 3 hours. Please check that all required checks have passed, you have an automerge label, and that all your reviewers have approved the PR

1 similar comment
@gcf-merge-on-green
Copy link
Contributor

Your PR has attempted to merge for 3 hours. Please check that all required checks have passed, you have an automerge label, and that all your reviewers have approved the PR

@gcf-merge-on-green
Copy link
Contributor

Merge-on-green attempted to merge your PR for 6 hours, but it was not mergeable because either one of your required status checks failed, or one of your required reviews was not approved. Learn more about your required status checks here: https://help.github.com/en/github/administering-a-repository/enabling-required-status-checks. You can remove and reapply the label to re-run the bot.

@gcf-merge-on-green gcf-merge-on-green bot removed the automerge Merge the pull request once unit tests and other checks pass. label Jun 20, 2020
@qingling128 qingling128 changed the title feat: add "not equal" support to the query filter. feat: add "not equal" support to the query filter Jul 31, 2020
@qingling128
Copy link
Contributor Author

@busunkim96 - Any chance you know why Kokoro is stuck in the Waiting for status to be reported state?

@busunkim96 busunkim96 added automerge Merge the pull request once unit tests and other checks pass. kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Aug 14, 2020
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 14, 2020
@busunkim96
Copy link
Contributor

@qingling128 Kokoro doesn't run automatically for people who do not belong to the GitHub 'googleapis' org.

@qingling128
Copy link
Contributor Author

@busunkim96 - Thanks for the help to trigger the Kokoro test. The test seems to be failing for a bunch of documentation format check failures that predates this PR. Any suggestion for what I should do with them?

https://source.cloud.google.com/results/invocations/fd68debc-462a-4dd6-b8f3-71c59cf5c1e8/log

@busunkim96
Copy link
Contributor

Ah, you can ignore the Kokoro docs-presubmit check. It's a new job whose configs haven't trickled through yet. It looks like the only outstanding issue on the main Kokoro build is lint. I just pushed to your branch, so hopefully it passes. 🤞 Thank you for your patience!

@busunkim96 busunkim96 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 15, 2020
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 15, 2020
@qingling128
Copy link
Contributor Author

@busunkim96 - Thanks! Kokoro build passed. The docs-presubmit still blocks merging though. How can we skip that check?

@gcf-merge-on-green
Copy link
Contributor

Merge-on-green attempted to merge your PR for 6 hours, but it was not mergeable because either one of your required status checks failed, or one of your required reviews was not approved. Learn more about your required status checks here: https://help.github.com/en/github/administering-a-repository/enabling-required-status-checks. You can remove and reapply the label to re-run the bot.

@gcf-merge-on-green gcf-merge-on-green bot removed the automerge Merge the pull request once unit tests and other checks pass. label Aug 15, 2020
@qingling128
Copy link
Contributor Author

@busunkim96 - Can we force submit this one and bypass the docs-presubmit failure?

@busunkim96 busunkim96 merged commit e293f7f into googleapis:master Aug 20, 2020
@qingling128 qingling128 deleted the patch-1 branch August 20, 2020 01:21
@qingling128
Copy link
Contributor Author

Thanks!

@qingling128
Copy link
Contributor Author

BTW, do we have any scheduled release coming?

@busunkim96
Copy link
Contributor

@qingling128 I merged the release PR so it should be out to PyPI in the next 15 or so minutes. #48

@qingling128
Copy link
Contributor Author

Wow. That's so fast. Thank you so much!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add "not equal" support to the query filter.
4 participants