Skip to content

Commit

Permalink
Adding application to Azure Kusto query runner (#4441)
Browse files Browse the repository at this point in the history
This is to allow for better metrics collection and tracking on the service side.
More info can be found [here](https://docs.microsoft.com/en-us/azure/kusto/api/netfx/request-properties#the-application-x-ms-app-named-property)
  • Loading branch information
Daniel Dubovski authored and arikfr committed Dec 13, 2019
1 parent ca09817 commit 8cb4915
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions redash/query_runner/azure_kusto.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


try:
from azure.kusto.data.request import KustoClient, KustoConnectionStringBuilder
from azure.kusto.data.request import KustoClient, KustoConnectionStringBuilder, ClientRequestProperites
from azure.kusto.data.exceptions import KustoServiceError

enabled = True
Expand All @@ -36,10 +36,12 @@
class AzureKusto(BaseQueryRunner):
should_annotate_query = False
noop_query = "let noop = datatable (Noop:string)[1]; noop"

def __init__(self, configuration):
super(AzureKusto, self).__init__(configuration)
self.syntax = "custom"
self.client_request_properties = ClientRequestProperites()
self.client_request_properties.application = "redash"

@classmethod
def configuration_schema(cls):
Expand Down Expand Up @@ -97,7 +99,7 @@ def run_query(self, query, user):

db = self.configuration["database"]
try:
response = client.execute(db, query)
response = client.execute(db, query, self.client_request_properties)

result_cols = response.primary_results[0].columns
result_rows = response.primary_results[0].rows
Expand Down

0 comments on commit 8cb4915

Please sign in to comment.