Skip to content

Commit

Permalink
Update retry attribute names (#1359)
Browse files Browse the repository at this point in the history
* Update retry attribute names

* rename attributes

* update versions

* fix format
  • Loading branch information
rkodev authored Sep 10, 2024
1 parent 2cf02ba commit ddfff0c
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 15 deletions.
2 changes: 1 addition & 1 deletion packages/abstractions/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@microsoft/kiota-abstractions",
"version": "1.0.0-preview.63",
"version": "1.0.0-preview.64",
"description": "Core abstractions for kiota generated libraries in TypeScript and JavaScript",
"main": "dist/es/src/index.js",
"module": "dist/es/src/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/authentication/azure/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@microsoft/kiota-authentication-azure",
"version": "1.0.0-preview.58",
"version": "1.0.0-preview.59",
"description": "Authentication provider for Kiota using Azure Identity",
"main": "dist/es/src/index.js",
"module": "dist/es/src/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/authentication/spfx/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@microsoft/kiota-authentication-spfx",
"version": "1.0.0-preview.52",
"version": "1.0.0-preview.53",
"description": "Authentication provider for using Kiota in SPFx solutions",
"main": "dist/es/src/index.js",
"module": "dist/es/src/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/bundle/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@microsoft/kiota-bundle",
"version": "1.0.0-preview.6",
"version": "1.0.0-preview.7",
"description": "Kiota Bundle package providing default implementations for client setup for kiota generated libraries in TypeScript and JavaScript",
"main": "dist/es/src/index.js",
"module": "dist/es/src/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/http/fetch/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@microsoft/kiota-http-fetchlibrary",
"version": "1.0.0-preview.62",
"version": "1.0.0-preview.63",
"description": "Kiota request adapter implementation with fetch",
"keywords": [
"Kiota",
Expand Down
4 changes: 2 additions & 2 deletions packages/http/fetch/src/fetchRequestAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ export class FetchRequestAdapter implements RequestAdapter {
if (responseContentType) {
spanForAttributes.setAttribute("http.response_content_type", responseContentType);
}
spanForAttributes.setAttribute("http.status_code", response.status);
spanForAttributes.setAttribute("http.response.status_code", response.status);
// getting the http.flavor (protocol version) is impossible with fetch API
}
return response;
Expand All @@ -479,7 +479,7 @@ export class FetchRequestAdapter implements RequestAdapter {
const responseClaims = this.getClaimsFromResponse(response, claims);
if (responseClaims) {
span.addEvent(FetchRequestAdapter.authenticateChallengedEventKey);
spanForAttributes.setAttribute("http.retry_count", 1);
spanForAttributes.setAttribute("http.request.resend_count", 1);
await this.purgeResponseBody(response);
return await this.getHttpResponseMessage(requestInfo, spanForAttributes, responseClaims);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/http/fetch/src/middlewares/redirectHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export class RedirectHandler implements Middleware {
return trace.getTracer(tracerName).startActiveSpan(`redirectHandler - redirect ${redirectCount}`, (span) => {
try {
span.setAttribute("com.microsoft.kiota.handler.redirect.count", redirectCount);
span.setAttribute("http.status_code", response.status);
span.setAttribute("http.response.status_code", response.status);
return this.executeWithRedirect(url, fetchRequestInit, redirectCount, currentOptions, requestOptions);
} finally {
span.end();
Expand Down
10 changes: 7 additions & 3 deletions packages/http/fetch/src/middlewares/retryHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,19 @@ export class RetryHandler implements Middleware {
if (retryAttempts < currentOptions.maxRetries && this.isRetry(response) && this.isBuffered(fetchRequestInit) && currentOptions.shouldRetry(currentOptions.delay, retryAttempts, url, fetchRequestInit as RequestInit, response)) {
++retryAttempts;
setRequestHeader(fetchRequestInit, RetryHandler.RETRY_ATTEMPT_HEADER, retryAttempts.toString());
let delay = null;
if (response) {
const delay = this.getDelay(response, retryAttempts, currentOptions.delay);
delay = this.getDelay(response, retryAttempts, currentOptions.delay);
await this.sleep(delay);
}
if (tracerName) {
return await trace.getTracer(tracerName).startActiveSpan(`retryHandler - attempt ${retryAttempts}`, (span) => {
try {
span.setAttribute("http.retry_count", retryAttempts);
span.setAttribute("http.status_code", response.status);
span.setAttribute("http.request.resend_count", retryAttempts);
if (delay) {
span.setAttribute("http.request.resend_delay", delay);
}
span.setAttribute("http.response.status_code", response.status);
return this.executeWithRetry(url, fetchRequestInit, retryAttempts, currentOptions, requestOptions);
} finally {
span.end();
Expand Down
2 changes: 1 addition & 1 deletion packages/serialization/form/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@microsoft/kiota-serialization-form",
"version": "1.0.0-preview.51",
"version": "1.0.0-preview.52",
"description": "Implementation of Kiota Serialization interfaces for URI from encoded",
"main": "dist/es/src/index.js",
"browser": {
Expand Down
2 changes: 1 addition & 1 deletion packages/serialization/json/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@microsoft/kiota-serialization-json",
"version": "1.0.0-preview.63",
"version": "1.0.0-preview.64",
"description": "Implementation of Kiota Serialization interfaces for JSON",
"main": "dist/es/src/index.js",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion packages/serialization/multipart/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@microsoft/kiota-serialization-multipart",
"version": "1.0.0-preview.41",
"version": "1.0.0-preview.42",
"description": "Implementation of Kiota Serialization interfaces for multipart form data",
"main": "dist/es/src/index.js",
"module": "dist/es/src/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/serialization/text/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@microsoft/kiota-serialization-text",
"version": "1.0.0-preview.60",
"version": "1.0.0-preview.61",
"description": "Implementation of Kiota Serialization interfaces for text",
"main": "dist/es/src/index.js",
"browser": {
Expand Down

0 comments on commit ddfff0c

Please sign in to comment.