-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Azure Log Analytics Workspace Task Logs Ingestion #10273
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
Conversation
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst)
|
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.
Can you check if we can do this with any of these libraries:
https://pypi.org/project/azure-mgmt-loganalytics/0.7.0/
https://pypi.org/project/azure-loganalytics/0.1.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.
I see a lot of breaking changes commits per version of these libraries.
Further, the real thing to look for a library would be if it handles the split functionality due to API limit. Which I did not found here. But will check more. For our purpose and full control though, I think this will provide more control. Let me know your thoughts.
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.
@mik-laj @turbaszek what do you think?
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.
@kumargauravin , I actually don't think it's ok to provide access key in the way you're currently doing it. We have connection table to manage authentication information. You can take inspiration from the other hooks in the Azure package. That's what I think. :\
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.
OK. That is a nice idea. Can you refer to anyone and I will try to work in same way. Also for pylint, I may need some help setting up on that breeze setup.
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.
Check the video here https://github.com/apache/airflow/blob/master/BREEZE.rst for setting up breeze environment.
Try using the Azure Batch hook https://github.com/apache/airflow/blob/master/airflow/providers/microsoft/azure/hooks/azure_batch.py
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.
In the case of Stackdriver, we used configurations via airflow.cfg. It is easier to use, but it is not a generally accepted rule.
|
You need to install pre-commit in your development environment https://github.com/apache/airflow/blob/master/STATIC_CODE_CHECKS.rst#pre-commit-hooks |
|
Hi,
Let’s set priorities.
1. Pylint: I will go with the video and see what I understand.
2. Complete ToDo sections and how we can test it.
3. What else needs to be done in order to use the PI.
4. Anything else we require to add to PR. Any other SOP issues you see!
5. Movement of config to table as per example provided.
Can you contribute also like in any one points like pylint will be helpful.
Add any missing things and let’s get this close and merged so that we can
use!!!
Regards,
Kumar
On Mon, Aug 10, 2020 at 4:18 PM Kamil Breguła ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In airflow/providers/microsoft/azure/hooks/laws.py
<#10273 (comment)>:
> + self.conn_id = remote_conn_id
+ self.account_id = account_id
+ self.access_key = access_key
+ self.table_name = table_name
+
+ def build_signature(self, date, content_length, method, content_type, resource):
+ x_headers = 'x-ms-date:' + date
+ string_to_hash = method + "\n" + str(content_length) + "\n" + content_type + "\n" + x_headers + "\n" + resource
+ bytes_to_hash = bytes(string_to_hash, encoding="utf-8")
+ decoded_key = base64.b64decode(self.access_key)
+ encoded_hash = base64.b64encode(
+ hmac.new(decoded_key, bytes_to_hash, digestmod=hashlib.sha256).digest()
+ ).decode()
+ authorization = "SharedKey {}:{}".format(self.account_id, encoded_hash)
+ return authorization
+
In the case of Stackdriver, we used configurations via airflow.cfg. It is
easier to use, but it is not a generally accepted rule.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#10273 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADK64R7FNRVPNAU72DSAPTLSABP2VANCNFSM4PZYJCCQ>
.
--
Regards,
Kumar Gaurav
+1 469 354 2101
|
|
@feluelle @ephraimbuddy Request to check once and suggest. I want to complete once cycle of build tests and then continue to work. |
| # | ||
| """ | ||
| This module contains integration with Azure LAWS. | ||
|
|
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.
| uri = ( | ||
| 'https://' + self.account_id + '.ods.opinsights.azure.com' + resource + '?api-version=2016-04-01' | ||
| ) |
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.
| uri = ( | |
| 'https://' + self.account_id + '.ods.opinsights.azure.com' + resource + '?api-version=2016-04-01' | |
| ) | |
| uri = f'https://{self.account_id}.ods.opinsights.azure.com{resource}?api-version=2016-04-01' |
| response = requests.post(uri, data=body, headers=headers, verify=ssl_verify) | ||
| response.raise_for_status() |
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 think thats what a basic HttpHook also does? WDYT of inheriting from HttpHook instead of BaseHook? There are a lot of similiarities.
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.
OK will try that out. Thanks for your comments.
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.
Did that work? Or haven't you tried that yet?
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
Hey @kumargauravin how is this going? Do you need any help? The tests are failing because you must add tests for the provider class you added. The config test is also failing. Can you fix that? |
|
hi,
Yes not much knowledge about testing if someone can help getting this pass
I will get idea.
Regards,
Kumar
…On Thu, Oct 22, 2020 at 2:17 PM Felix Uellendall ***@***.***> wrote:
Hey @kumargauravin <https://github.com/kumargauravin> how is this going?
Do you need any help?
The tests are failing because you must add tests for the provider class
you added. The config test is also failing. Can you fix that?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#10273 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADK64R4L2S7CFS6XGUMCPT3SL7WQRANCNFSM4PZYJCCQ>
.
--
Regards,
Kumar Gaurav
+1 469 354 2101
|
|
For testing the task handler you can check out test_es_task_handler.py for example. It contains unittest by simply mocking elasticsearch. You would have to mock azlaws. You can do this by simply using |
|
Sure Felix,
Haven't tried will try soon and update.
Regards,
Kumar
…On Wed, Oct 28, 2020 at 2:14 PM Felix Uellendall ***@***.***> wrote:
For testing the task handler you can check out test_es_task_handler.py
<https://github.com/apache/airflow/blob/master/tests/providers/elasticsearch/log/test_es_task_handler.py>
for example. It contains unittest by simply mocking elasticsearch. You
would habe to mock azlaws.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#10273 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADK64R73WNSLQPAHZMTBWMDSM7KV3ANCNFSM4PZYJCCQ>
.
--
Regards,
Kumar Gaurav
+1 469 354 2101
|
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
@kumargauravin I am interested in this functionality. Does the code basically work and what's needed from here is to get the pull request into good merge shape (i.e., sort out whatever issues have been mentioned). |
|
Test cases if you could please I am occupied with something else.
Thanks in advance.
On Thu, Dec 16, 2021 at 6:06 AM Malthe Borch ***@***.***> wrote:
@kumargauravin <https://github.com/kumargauravin> I am interested in this
functionality. Does the code basically work and what's needed from here is
to get the pull request into good merge shape (i.e., sort out whatever
issues have been mentioned).
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#10273 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADK64R34MYROAQFNLH35EG3URHB3HANCNFSM4PZYJCCQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
--
Regards,
Kumar Gaurav
+1 469 354 2101
|
|
Rest some suggestion were thr it may have to be rebased.
On Thu, Dec 16, 2021 at 2:02 PM Kumar Gaurav ***@***.***>
wrote:
Test cases if you could please I am occupied with something else.
Thanks in advance.
On Thu, Dec 16, 2021 at 6:06 AM Malthe Borch ***@***.***>
wrote:
> @kumargauravin <https://github.com/kumargauravin> I am interested in
> this functionality. Does the code basically work and what's needed from
> here is to get the pull request into good merge shape (i.e., sort out
> whatever issues have been mentioned).
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#10273 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ADK64R34MYROAQFNLH35EG3URHB3HANCNFSM4PZYJCCQ>
> .
> Triage notifications on the go with GitHub Mobile for iOS
> <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
> or Android
> <https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
>
>
--
Regards,
Kumar Gaurav
+1 469 354 2101
--
Regards,
Kumar Gaurav
+1 469 354 2101
|
Initial version of code for review.
Needs to be tested with real account which has permissions which I do not have at this time.
Some ToDo left added as comments.