Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating OT Exporter to align with latest mappings spec #17392

Merged
merged 20 commits into from
Sep 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
753 changes: 490 additions & 263 deletions common/config/rush/pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion sdk/monitor/monitor-opentelemetry-exporter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
"@opentelemetry/api": "^1.0.1",
"@opentelemetry/core": "^0.22.0",
"@opentelemetry/resources": "^0.22.0",
"@opentelemetry/semantic-conventions": "^0.22.0",
"@opentelemetry/semantic-conventions": "^0.24.0",
ramya-rao-a marked this conversation as resolved.
Show resolved Hide resolved
"@opentelemetry/tracing": "^0.22.0",
"tslib": "^2.2.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import * as opentelemetry from "@opentelemetry/api";
import { Resource } from "@opentelemetry/resources";
import { ResourceAttributes } from "@opentelemetry/semantic-conventions";
import { SemanticResourceAttributes } from "@opentelemetry/semantic-conventions";
import { BasicTracerProvider, SimpleSpanProcessor } from "@opentelemetry/tracing";
import { AzureMonitorTraceExporter } from "@azure/monitor-opentelemetry-exporter";

Expand All @@ -21,7 +21,7 @@ dotenv.config();

const provider = new BasicTracerProvider({
resource: new Resource({
[ResourceAttributes.SERVICE_NAME]: "basic-service"
[SemanticResourceAttributes.SERVICE_NAME]: "basic-service"
})
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,31 +127,3 @@ export type QuickPulseType =
| "RequestTelemetryDocument"
| "DependencyTelemetryDocument"
| "AvailabilityTelemetryDocument";

/**
* OpenTelemetry Span Attributes.
* @internal
*/
export const SpanAttribute = {
// HTTP
HttpHost: "http.host",
HttpMethod: "http.method",
HttpPort: "http.port",
HttpStatusCode: "http.status_code",
HttpUrl: "http.url",
HttpUserAgent: "http.user_agent",

// GRPC
GrpcMethod: "grpc.method",
GrpcService: "rpc.service" // rpc not grpc
};

/**
* OpenTelemetry dependency type names.
* @internal
*/
export const DependencyTypeName = {
Grpc: "GRPC",
Http: "HTTP",
InProc: "InProc"
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as path from "path";
import { diag } from "@opentelemetry/api";
import { SDK_INFO } from "@opentelemetry/core";

import { ContextTagKeys } from "../../../generated";
import { KnownContextTagKeys } from "../../../generated";
import { Tags } from "../../../types";

type PackageJson = { version: string };
Expand Down Expand Up @@ -92,17 +92,13 @@ export class Context {
Context.appVersion[packageJsonPath] = packageJson.version;
}

this.tags["ai.application.ver"] = Context.appVersion[packageJsonPath];
this.tags[KnownContextTagKeys.AiApplicationVer] = Context.appVersion[packageJsonPath];
}
}

private _loadDeviceContext(): void {
this.tags["ai.device.id"] = "";
this.tags["ai.device.osVersion"] = os && `${os.type()} ${os.release()}`;

// not yet supported tags
this.tags["ai.device.osArchitecture" as ContextTagKeys] = os && os.arch();
this.tags["ai.device.osPlatform" as ContextTagKeys] = os && os.platform();
this.tags[KnownContextTagKeys.AiDeviceId] = "";
this.tags[KnownContextTagKeys.AiDeviceOsVersion] = os && `${os.type()} ${os.release()}`;
}

private _loadInternalContext(): void {
Expand Down Expand Up @@ -144,8 +140,8 @@ export class Context {
}

this.tags[
"ai.internal.sdkVersion"
] = `node${Context.nodeVersion}:ot${SDK_INFO.VERSION}:ext${Context.sdkVersion}`;
KnownContextTagKeys.AiInternalSdkVersion
] = `node${Context.nodeVersion}:otel${SDK_INFO.VERSION}:ext${Context.sdkVersion}`;
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,41 +1,11 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

/**
* AI cloud role tag name.
* @internal
*/
export const AI_CLOUD_ROLE = "ai.cloud.role";
/**
* AI cloud role isntance tag name.
* @internal
*/
export const AI_CLOUD_ROLE_INSTACE = "ai.cloud.roleInstance";
/**
* AI operation Id tag name.
* @internal
*/
export const AI_OPERATION_ID = "ai.operation.id";
/**
* AI operation parent Id tag name.
* @internal
*/
export const AI_OPERATION_PARENT_ID = "ai.operation.parentId";
/**
* AI operation tag name.
* @internal
*/
export const AI_OPERATION_NAME = "ai.operation.name";
/**
* AI MS Links.
* @internal
*/
export const MS_LINKS = "_MS.links";
/**
* AI InProc attribute.
* @internal
*/
export const INPROC = "InProc";
/**
* AI enqueued time attribute.
* @internal
Expand All @@ -51,3 +21,11 @@ export const TIME_SINCE_ENQUEUED = "timeSinceEnqueued";
* @internal
*/
export const packageVersion = "1.0.0-beta.5";

export enum DependencyTypes {
InProc = "InProc",
QueueMessage = "Queue Message",
Sql = "SQL",
Http = "Http",
Grpc = "GRPC"
}

This file was deleted.

This file was deleted.

This file was deleted.

Loading