コード例 #1
0
        public async Task <KustoQuery> GetKustoQueryAsync(string query, string cluster, string database, string operationName)
        {
            try
            {
                if (FailoverClusterMapping.ContainsKey(cluster))
                {
                    cluster = FailoverClusterMapping[cluster];
                }
                var encodedQuery = await EncodeQueryAsBase64UrlAsync(query);

                var kustoQuery = new KustoQuery
                {
                    Text            = query,
                    Url             = $"https://dataexplorer.azure.com/clusters/{cluster}/databases/{database}?query={encodedQuery}",
                    KustoDesktopUrl = $"https://{cluster}.kusto.windows.net:443/{database}?query={encodedQuery}&web=0",
                    OperationName   = operationName
                };
                return(kustoQuery);
            }
            catch (Exception ex)
            {
                DiagnosticsETWProvider.Instance.LogDataProviderMessage(_requestId, "KustoClient", $"GetKustoQueryAsync Failure. Query: {query}; Cluster: {cluster}; Database: {database}; Exception: {ex.ToString()}");
                throw;
            }
        }
コード例 #2
0
        public async Task <KustoQuery> GetKustoQueryAsync(string query, string stampName)
        {
            string kustoClusterName = null;

            try
            {
                kustoClusterName = GetClusterNameFromStamp(stampName);
                string encodedQuery = await EncodeQueryAsBase64UrlAsync(query);

                KustoQuery kustoQuery = new KustoQuery
                {
                    Text            = query,
                    Url             = string.Format("https://web.kusto.windows.net/clusters/{0}.kusto.windows.net/databases/{1}?q={2}", kustoClusterName, _configuration.DBName, encodedQuery),
                    KustoDesktopUrl = $"https://{kustoClusterName}.kusto.windows.net:443/{_configuration.DBName}?query={encodedQuery}&web=0"
                };
                return(kustoQuery);
            }
            catch (Exception ex)
            {
                string message = string.Format("stamp : {0}, kustoClusterName : {1}, Exception : {2}",
                                               stampName ?? "null",
                                               kustoClusterName ?? "null",
                                               ex.ToString());
                throw;
            }
        }
コード例 #3
0
        private void AddQueryInformationToMetadata(string query, string queryUrl, string stampName)
        {
            bool       queryExists = false;
            KustoQuery q           = new KustoQuery
            {
                Text = query,
                Url  = queryUrl
            };

            queryExists = Metadata.PropertyBag.Any(x => x.Key == "Query" &&
                                                   x.Value.GetType() == typeof(KustoQuery) &&
                                                   x.Value.CastTo <KustoQuery>().Url.Equals(q.Url, StringComparison.OrdinalIgnoreCase));
            if (!queryExists)
            {
                Metadata.PropertyBag.Add(new KeyValuePair <string, object>("Query", q));
            }
        }
コード例 #4
0
        public Task <KustoQuery> GetKustoQueryAsync(string query, string stampName)
        {
            if (string.IsNullOrWhiteSpace(stampName))
            {
                throw new ArgumentNullException("stampName");
            }
            if (string.IsNullOrWhiteSpace(query))
            {
                throw new ArgumentNullException("query");
            }
            KustoQuery k = new KustoQuery
            {
                Url             = "https://fakekusto.windows.net/q=somequery",
                KustoDesktopUrl = "https://fakekusto.windows.net/q=somequery",
                Text            = query
            };

            return(Task.FromResult(k));
        }
コード例 #5
0
        public async Task <KustoQuery> GetKustoQueryAsync(string query, string cluster, string database)
        {
            try
            {
                string encodedQuery = await EncodeQueryAsBase64UrlAsync(query);

                KustoQuery kustoQuery = new KustoQuery
                {
                    Text            = query,
                    Url             = string.Format("https://web.kusto.windows.net/clusters/{0}.kusto.windows.net/databases/{1}?q={2}", cluster, database, encodedQuery),
                    KustoDesktopUrl = $"https://{cluster}.kusto.windows.net:443/{database}?query={encodedQuery}&web=0"
                };
                return(kustoQuery);
            }
            catch (Exception ex)
            {
                DiagnosticsETWProvider.Instance.LogDataProviderMessage(_requestId, "KustoClient", $"GetKustoQueryAsync Failure. Query: {query}; Cluster: {cluster}; Database: {database}; Exception: {ex.ToString()}");
                throw;
            }
        }