Skip to content

Commit

Permalink
Align OTEL http attributes with latest standard (#1363)
Browse files Browse the repository at this point in the history
* Allign otel attributes

* update versions
  • Loading branch information
rkodev committed Sep 10, 2024
1 parent ddfff0c commit d45aec9
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 19 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.64",
"version": "1.0.0-preview.65",
"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.59",
"version": "1.0.0-preview.60",
"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.53",
"version": "1.0.0-preview.54",
"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.7",
"version": "1.0.0-preview.8",
"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.63",
"version": "1.0.0-preview.64",
"description": "Kiota request adapter implementation with fetch",
"keywords": [
"Kiota",
Expand Down
20 changes: 10 additions & 10 deletions packages/http/fetch/src/fetchRequestAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export class FetchRequestAdapter implements RequestAdapter {
const telemetryPathValue = urlTemplate.replace(/\{\?[^}]+\}/gi, "");
return trace.getTracer(this.observabilityOptions.getTracerInstrumentationName()).startActiveSpan(`${methodName} - ${telemetryPathValue}`, async (span) => {
try {
span.setAttribute("http.uri_template", urlTemplate);
span.setAttribute("url.uri_template", urlTemplate);
return await callback(span);
} finally {
span.end();
Expand Down Expand Up @@ -457,14 +457,14 @@ export class FetchRequestAdapter implements RequestAdapter {
if (response) {
const responseContentLength = response.headers.get("Content-Length");
if (responseContentLength) {
spanForAttributes.setAttribute("http.response_content_length", parseInt(responseContentLength));
spanForAttributes.setAttribute("http.response.body.size", parseInt(responseContentLength));
}
const responseContentType = response.headers.get("Content-Type");
if (responseContentType) {
spanForAttributes.setAttribute("http.response_content_type", responseContentType);
spanForAttributes.setAttribute("http.response.header.content-type", responseContentType);
}
spanForAttributes.setAttribute("http.response.status_code", response.status);
// getting the http.flavor (protocol version) is impossible with fetch API
// getting the network.protocol.version (protocol version) is impossible with fetch API
}
return response;
} finally {
Expand Down Expand Up @@ -514,24 +514,24 @@ export class FetchRequestAdapter implements RequestAdapter {
try {
const method = requestInfo.httpMethod?.toString();
const uri = requestInfo.URL;
spanForAttributes.setAttribute("http.method", method ?? "");
spanForAttributes.setAttribute("http.request.method", method ?? "");
const uriContainsScheme = uri.indexOf("://") > -1;
const schemeSplatUri = uri.split("://");
if (uriContainsScheme) {
spanForAttributes.setAttribute("http.scheme", schemeSplatUri[0]);
spanForAttributes.setAttribute("server.address", schemeSplatUri[0]);
}
const uriWithoutScheme = uriContainsScheme ? schemeSplatUri[1] : uri;
spanForAttributes.setAttribute("http.host", uriWithoutScheme.split("/")[0]);
spanForAttributes.setAttribute("url.scheme", uriWithoutScheme.split("/")[0]);
if (this.observabilityOptions.includeEUIIAttributes) {
spanForAttributes.setAttribute("http.uri", decodeURIComponent(uri));
spanForAttributes.setAttribute("url.full", decodeURIComponent(uri));
}
const requestContentLength = requestInfo.headers.tryGetValue("Content-Length");
if (requestContentLength) {
spanForAttributes.setAttribute("http.request_content_length", parseInt(requestContentLength[0]));
spanForAttributes.setAttribute("http.response.body.size", parseInt(requestContentLength[0]));
}
const requestContentType = requestInfo.headers.tryGetValue("Content-Type");
if (requestContentType) {
spanForAttributes.setAttribute("http.request_content_type", requestContentType);
spanForAttributes.setAttribute("http.request.header.content-type", requestContentType);
}
const headers: [string, string][] | undefined = requestInfo.headers ? Array.from(requestInfo.headers.keys()).map((key) => [key.toString().toLocaleLowerCase(), this.foldHeaderValue(requestInfo.headers.tryGetValue(key))]) : undefined;
const request = {
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.52",
"version": "1.0.0-preview.53",
"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.64",
"version": "1.0.0-preview.65",
"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.42",
"version": "1.0.0-preview.43",
"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.61",
"version": "1.0.0-preview.62",
"description": "Implementation of Kiota Serialization interfaces for text",
"main": "dist/es/src/index.js",
"browser": {
Expand Down

0 comments on commit d45aec9

Please sign in to comment.