[@azure/search-documents] Update Dependency of `@azure/core-tracing` package (#22477)

* Update Tracing Dependency

* Modified code for breaking changes in tracing
This commit is contained in:
Sarangan Rajamanickam 2022-07-06 14:09:54 -07:00 коммит произвёл GitHub
Родитель c6928a3028
Коммит 075ab48aa2
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 125 добавлений и 127 удалений

Просмотреть файл

@ -77,7 +77,7 @@
"@azure/core-client": "^1.3.0",
"@azure/core-auth": "^1.3.0",
"@azure/core-paging": "^1.1.1",
"@azure/core-tracing": "1.0.0-preview.13",
"@azure/core-tracing": "^1.0.0",
"@azure/core-rest-pipeline": "^1.3.0",
"@azure/core-http-compat": "^1.2.0",
"@azure/logger": "^1.0.0",

Просмотреть файл

@ -17,7 +17,6 @@ import {
IndexDocumentsResult,
} from "./generated/data/models";
import { createSpan } from "./tracing";
import { SpanStatusCode } from "@azure/core-tracing";
import { deserialize, serialize } from "./serialization";
import {
CountDocumentsOptions,
@ -204,8 +203,8 @@ export class SearchClient<T> implements IndexDocumentsClient<T> {
return documentsCount;
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -249,8 +248,8 @@ export class SearchClient<T> implements IndexDocumentsClient<T> {
return result;
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -302,8 +301,8 @@ export class SearchClient<T> implements IndexDocumentsClient<T> {
return deserialize<SearchDocumentsPageResult<Pick<T, Fields>>>(converted);
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -399,8 +398,8 @@ export class SearchClient<T> implements IndexDocumentsClient<T> {
};
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -450,8 +449,8 @@ export class SearchClient<T> implements IndexDocumentsClient<T> {
return deserialize<SuggestDocumentsResult<Pick<T, Fields>>>(modifiedResult);
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -474,8 +473,8 @@ export class SearchClient<T> implements IndexDocumentsClient<T> {
return deserialize<T>(result);
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -516,8 +515,8 @@ export class SearchClient<T> implements IndexDocumentsClient<T> {
return result;
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -543,8 +542,8 @@ export class SearchClient<T> implements IndexDocumentsClient<T> {
return await this.indexDocuments(batch, updatedOptions);
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -571,8 +570,8 @@ export class SearchClient<T> implements IndexDocumentsClient<T> {
return await this.indexDocuments(batch, updatedOptions);
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -599,8 +598,8 @@ export class SearchClient<T> implements IndexDocumentsClient<T> {
return await this.indexDocuments(batch, updatedOptions);
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -648,8 +647,8 @@ export class SearchClient<T> implements IndexDocumentsClient<T> {
return await this.indexDocuments(batch, updatedOptions);
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {

Просмотреть файл

@ -6,7 +6,6 @@
import { KeyCredential, TokenCredential, isTokenCredential } from "@azure/core-auth";
import { InternalClientPipelineOptions } from "@azure/core-client";
import { bearerTokenAuthenticationPolicy } from "@azure/core-rest-pipeline";
import { SpanStatusCode } from "@azure/core-tracing";
import { SDK_VERSION } from "./constants";
import { AnalyzeResult } from "./generated/service/models";
import { SearchServiceClient as GeneratedClient } from "./generated/service/searchServiceClient";
@ -196,8 +195,8 @@ export class SearchIndexClient {
yield mapped;
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -242,8 +241,8 @@ export class SearchIndexClient {
yield result.aliases;
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -292,8 +291,8 @@ export class SearchIndexClient {
yield mapped;
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -340,8 +339,8 @@ export class SearchIndexClient {
return result.synonymMaps.map(utils.generatedSynonymMapToPublicSynonymMap);
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -363,8 +362,8 @@ export class SearchIndexClient {
return result.synonymMaps.map((sm) => sm.name);
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -384,8 +383,8 @@ export class SearchIndexClient {
return utils.generatedIndexToPublicIndex(result);
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -408,8 +407,8 @@ export class SearchIndexClient {
return utils.generatedSynonymMapToPublicSynonymMap(result);
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -435,8 +434,8 @@ export class SearchIndexClient {
return utils.generatedIndexToPublicIndex(result);
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -462,8 +461,8 @@ export class SearchIndexClient {
return utils.generatedSynonymMapToPublicSynonymMap(result);
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -495,8 +494,8 @@ export class SearchIndexClient {
return utils.generatedIndexToPublicIndex(result);
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -531,8 +530,8 @@ export class SearchIndexClient {
return utils.generatedSynonymMapToPublicSynonymMap(result);
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -561,8 +560,8 @@ export class SearchIndexClient {
});
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -595,8 +594,8 @@ export class SearchIndexClient {
});
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -624,8 +623,8 @@ export class SearchIndexClient {
return result;
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -648,8 +647,8 @@ export class SearchIndexClient {
return result;
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -679,8 +678,8 @@ export class SearchIndexClient {
});
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -703,8 +702,8 @@ export class SearchIndexClient {
return result;
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -728,8 +727,8 @@ export class SearchIndexClient {
return result;
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -766,8 +765,8 @@ export class SearchIndexClient {
return result;
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -788,8 +787,8 @@ export class SearchIndexClient {
return result;
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {

Просмотреть файл

@ -4,7 +4,6 @@
import { KeyCredential, TokenCredential, isTokenCredential } from "@azure/core-auth";
import { InternalClientPipelineOptions } from "@azure/core-client";
import { bearerTokenAuthenticationPolicy } from "@azure/core-rest-pipeline";
import { SpanStatusCode } from "@azure/core-tracing";
import { SDK_VERSION } from "./constants";
import { SearchIndexerStatus } from "./generated/service/models";
import { SearchServiceClient as GeneratedClient } from "./generated/service/searchServiceClient";
@ -179,8 +178,8 @@ export class SearchIndexerClient {
return result.indexers.map(utils.generatedSearchIndexerToPublicSearchIndexer);
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -202,8 +201,8 @@ export class SearchIndexerClient {
return result.indexers.map((idx) => idx.name);
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -227,8 +226,8 @@ export class SearchIndexerClient {
return result.dataSources.map(utils.generatedDataSourceToPublicDataSource);
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -255,8 +254,8 @@ export class SearchIndexerClient {
return result.dataSources.map((ds) => ds.name);
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -277,8 +276,8 @@ export class SearchIndexerClient {
return result.skillsets.map(utils.generatedSkillsetToPublicSkillset);
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -300,8 +299,8 @@ export class SearchIndexerClient {
return result.skillsets.map((sks) => sks.name);
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -324,8 +323,8 @@ export class SearchIndexerClient {
return utils.generatedSearchIndexerToPublicSearchIndexer(result);
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -351,8 +350,8 @@ export class SearchIndexerClient {
return utils.generatedDataSourceToPublicDataSource(result);
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -375,8 +374,8 @@ export class SearchIndexerClient {
return utils.generatedSkillsetToPublicSkillset(result);
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -402,8 +401,8 @@ export class SearchIndexerClient {
return utils.generatedSearchIndexerToPublicSearchIndexer(result);
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -432,8 +431,8 @@ export class SearchIndexerClient {
return utils.generatedDataSourceToPublicDataSource(result);
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -459,8 +458,8 @@ export class SearchIndexerClient {
return utils.generatedSkillsetToPublicSkillset(result);
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -497,8 +496,8 @@ export class SearchIndexerClient {
return utils.generatedSearchIndexerToPublicSearchIndexer(result);
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -534,8 +533,8 @@ export class SearchIndexerClient {
return utils.generatedDataSourceToPublicDataSource(result);
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -573,8 +572,8 @@ export class SearchIndexerClient {
return utils.generatedSkillsetToPublicSkillset(result);
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -607,8 +606,8 @@ export class SearchIndexerClient {
});
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -645,8 +644,8 @@ export class SearchIndexerClient {
});
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -679,8 +678,8 @@ export class SearchIndexerClient {
});
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -703,8 +702,8 @@ export class SearchIndexerClient {
return result;
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -723,8 +722,8 @@ export class SearchIndexerClient {
await this.client.indexers.reset(indexerName, updatedOptions);
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -743,8 +742,8 @@ export class SearchIndexerClient {
await this.client.indexers.run(indexerName, updatedOptions);
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -772,8 +771,8 @@ export class SearchIndexerClient {
});
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -797,8 +796,8 @@ export class SearchIndexerClient {
);
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {

Просмотреть файл

@ -16,7 +16,6 @@ import { IndexDocumentsResult } from "./generated/data/models";
import { OperationOptions } from "@azure/core-client";
import EventEmitter from "events";
import { createSpan } from "./tracing";
import { SpanStatusCode } from "@azure/core-tracing";
import { delay } from "./serviceUtils";
import { getRandomIntegerInclusive } from "./serviceUtils";
import { RestError } from "@azure/core-rest-pipeline";
@ -165,8 +164,8 @@ export class SearchIndexingBufferedSender<T> {
return this.internalFlush(false, updatedOptions);
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -197,8 +196,8 @@ export class SearchIndexingBufferedSender<T> {
return this.internalFlush(false, updatedOptions);
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -229,8 +228,8 @@ export class SearchIndexingBufferedSender<T> {
return this.internalFlush(false, updatedOptions);
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -261,8 +260,8 @@ export class SearchIndexingBufferedSender<T> {
return this.internalFlush(false, updatedOptions);
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {
@ -285,8 +284,8 @@ export class SearchIndexingBufferedSender<T> {
}
} catch (e: any) {
span.setStatus({
code: SpanStatusCode.ERROR,
message: e.message,
status: "error",
error: e.message,
});
throw e;
} finally {

Просмотреть файл

@ -1,13 +1,15 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import { createSpanFunction } from "@azure/core-tracing";
import { createTracingClient } from "@azure/core-tracing";
/**
* Creates a span using the global tracer.
* Creates a tracing client using the global tracer.
* @internal
*/
export const createSpan = createSpanFunction({
packagePrefix: "Azure.Search",
export const tracingClient = createTracingClient({
namespace: "Microsoft.Search",
packageName: "Azure.Search",
});
export const createSpan = tracingClient.startSpan;