diff --git a/.github/component_owners.yml b/.github/component_owners.yml
index 713bea0bfa..be9a44a13b 100644
--- a/.github/component_owners.yml
+++ b/.github/component_owners.yml
@@ -111,6 +111,7 @@ components:
plugins/node/opentelemetry-instrumentation-runtime-node:
- d4nyll
plugins/node/opentelemetry-instrumentation-pg:
+ - maryliag
- rauno56
plugins/node/opentelemetry-instrumentation-pino:
- seemk
diff --git a/detectors/node/opentelemetry-resource-detector-alibaba-cloud/package.json b/detectors/node/opentelemetry-resource-detector-alibaba-cloud/package.json
index 68162e3f2f..5009697401 100644
--- a/detectors/node/opentelemetry-resource-detector-alibaba-cloud/package.json
+++ b/detectors/node/opentelemetry-resource-detector-alibaba-cloud/package.json
@@ -57,7 +57,7 @@
},
"dependencies": {
"@opentelemetry/resources": "^1.0.0",
- "@opentelemetry/semantic-conventions": "^1.0.0"
+ "@opentelemetry/semantic-conventions": "^1.22.0"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/detectors/node/opentelemetry-resource-detector-alibaba-cloud#readme"
}
diff --git a/detectors/node/opentelemetry-resource-detector-alibaba-cloud/src/detectors/AlibabaCloudEcsDetector.ts b/detectors/node/opentelemetry-resource-detector-alibaba-cloud/src/detectors/AlibabaCloudEcsDetector.ts
index 38e54df5ba..776e5dbccd 100644
--- a/detectors/node/opentelemetry-resource-detector-alibaba-cloud/src/detectors/AlibabaCloudEcsDetector.ts
+++ b/detectors/node/opentelemetry-resource-detector-alibaba-cloud/src/detectors/AlibabaCloudEcsDetector.ts
@@ -20,9 +20,16 @@ import {
ResourceDetectionConfig,
} from '@opentelemetry/resources';
import {
- CloudPlatformValues,
- CloudProviderValues,
- SemanticResourceAttributes,
+ CLOUDPLATFORMVALUES_ALIBABA_CLOUD_ECS,
+ CLOUDPROVIDERVALUES_ALIBABA_CLOUD,
+ SEMRESATTRS_CLOUD_ACCOUNT_ID,
+ SEMRESATTRS_CLOUD_AVAILABILITY_ZONE,
+ SEMRESATTRS_CLOUD_PLATFORM,
+ SEMRESATTRS_CLOUD_PROVIDER,
+ SEMRESATTRS_CLOUD_REGION,
+ SEMRESATTRS_HOST_ID,
+ SEMRESATTRS_HOST_NAME,
+ SEMRESATTRS_HOST_TYPE,
} from '@opentelemetry/semantic-conventions';
import * as http from 'http';
@@ -61,16 +68,14 @@ class AlibabaCloudEcsDetector implements Detector {
const hostname = await this._fetchHost();
return new Resource({
- [SemanticResourceAttributes.CLOUD_PROVIDER]:
- CloudProviderValues.ALIBABA_CLOUD,
- [SemanticResourceAttributes.CLOUD_PLATFORM]:
- CloudPlatformValues.ALIBABA_CLOUD_ECS,
- [SemanticResourceAttributes.CLOUD_ACCOUNT_ID]: accountId,
- [SemanticResourceAttributes.CLOUD_REGION]: region,
- [SemanticResourceAttributes.CLOUD_AVAILABILITY_ZONE]: availabilityZone,
- [SemanticResourceAttributes.HOST_ID]: instanceId,
- [SemanticResourceAttributes.HOST_TYPE]: instanceType,
- [SemanticResourceAttributes.HOST_NAME]: hostname,
+ [SEMRESATTRS_CLOUD_PROVIDER]: CLOUDPROVIDERVALUES_ALIBABA_CLOUD,
+ [SEMRESATTRS_CLOUD_PLATFORM]: CLOUDPLATFORMVALUES_ALIBABA_CLOUD_ECS,
+ [SEMRESATTRS_CLOUD_ACCOUNT_ID]: accountId,
+ [SEMRESATTRS_CLOUD_REGION]: region,
+ [SEMRESATTRS_CLOUD_AVAILABILITY_ZONE]: availabilityZone,
+ [SEMRESATTRS_HOST_ID]: instanceId,
+ [SEMRESATTRS_HOST_TYPE]: instanceType,
+ [SEMRESATTRS_HOST_NAME]: hostname,
});
}
diff --git a/detectors/node/opentelemetry-resource-detector-alibaba-cloud/test/detectors/AlibabaCloudEcsDetector.test.ts b/detectors/node/opentelemetry-resource-detector-alibaba-cloud/test/detectors/AlibabaCloudEcsDetector.test.ts
index 14fa8ac1f4..c4a2c41d36 100644
--- a/detectors/node/opentelemetry-resource-detector-alibaba-cloud/test/detectors/AlibabaCloudEcsDetector.test.ts
+++ b/detectors/node/opentelemetry-resource-detector-alibaba-cloud/test/detectors/AlibabaCloudEcsDetector.test.ts
@@ -17,7 +17,7 @@
import * as nock from 'nock';
import * as assert from 'assert';
import { Resource } from '@opentelemetry/resources';
-import { CloudProviderValues } from '@opentelemetry/semantic-conventions';
+import { CLOUDPROVIDERVALUES_ALIBABA_CLOUD } from '@opentelemetry/semantic-conventions';
import { alibabaCloudEcsDetector } from '../../src';
import {
assertCloudResource,
@@ -70,7 +70,7 @@ describe('alibabaCloudEcsDetector', () => {
assert.ok(resource);
assertCloudResource(resource, {
- provider: CloudProviderValues.ALIBABA_CLOUD,
+ provider: CLOUDPROVIDERVALUES_ALIBABA_CLOUD,
accountId: 'my-owner-account-id',
region: 'my-region-id',
zone: 'my-zone-id',
diff --git a/package-lock.json b/package-lock.json
index 66b5c5382d..0149d7bb23 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -41,7 +41,7 @@
"license": "Apache-2.0",
"dependencies": {
"@opentelemetry/resources": "^1.0.0",
- "@opentelemetry/semantic-conventions": "^1.0.0"
+ "@opentelemetry/semantic-conventions": "^1.22.0"
},
"devDependencies": {
"@opentelemetry/api": "^1.0.0",
@@ -37828,7 +37828,7 @@
"dependencies": {
"@opentelemetry/core": "^1.8.0",
"@opentelemetry/instrumentation": "^0.49.1",
- "@opentelemetry/semantic-conventions": "^1.0.0",
+ "@opentelemetry/semantic-conventions": "^1.22.0",
"@types/koa": "2.14.0",
"@types/koa__router": "12.0.3"
},
@@ -38614,7 +38614,7 @@
"@opentelemetry/instrumentation": "^0.49.1",
"@opentelemetry/sdk-trace-base": "^1.0.0",
"@opentelemetry/sdk-trace-web": "^1.15.0",
- "@opentelemetry/semantic-conventions": "^1.0.0"
+ "@opentelemetry/semantic-conventions": "^1.22.0"
},
"devDependencies": {
"@babel/core": "7.22.17",
@@ -45966,7 +45966,7 @@
"@opentelemetry/instrumentation": "^0.49.1",
"@opentelemetry/sdk-trace-base": "^1.0.0",
"@opentelemetry/sdk-trace-web": "^1.15.0",
- "@opentelemetry/semantic-conventions": "^1.0.0",
+ "@opentelemetry/semantic-conventions": "^1.22.0",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.2.3",
"@types/chai": "^4.3.10",
@@ -46262,7 +46262,7 @@
"@opentelemetry/instrumentation-http": "^0.49.1",
"@opentelemetry/sdk-trace-base": "^1.8.0",
"@opentelemetry/sdk-trace-node": "^1.8.0",
- "@opentelemetry/semantic-conventions": "^1.0.0",
+ "@opentelemetry/semantic-conventions": "^1.22.0",
"@types/koa": "2.14.0",
"@types/koa__router": "12.0.3",
"@types/mocha": "7.0.2",
@@ -47597,7 +47597,7 @@
"@opentelemetry/api": "^1.0.0",
"@opentelemetry/contrib-test-utils": "^0.37.0",
"@opentelemetry/resources": "^1.0.0",
- "@opentelemetry/semantic-conventions": "^1.0.0",
+ "@opentelemetry/semantic-conventions": "^1.22.0",
"@types/mocha": "8.2.3",
"@types/node": "18.6.5",
"@types/sinon": "10.0.18",
diff --git a/plugins/node/opentelemetry-instrumentation-koa/package.json b/plugins/node/opentelemetry-instrumentation-koa/package.json
index d5f255d676..2b89f7cc94 100644
--- a/plugins/node/opentelemetry-instrumentation-koa/package.json
+++ b/plugins/node/opentelemetry-instrumentation-koa/package.json
@@ -67,7 +67,7 @@
"dependencies": {
"@opentelemetry/core": "^1.8.0",
"@opentelemetry/instrumentation": "^0.49.1",
- "@opentelemetry/semantic-conventions": "^1.0.0",
+ "@opentelemetry/semantic-conventions": "^1.22.0",
"@types/koa": "2.14.0",
"@types/koa__router": "12.0.3"
},
diff --git a/plugins/node/opentelemetry-instrumentation-koa/src/utils.ts b/plugins/node/opentelemetry-instrumentation-koa/src/utils.ts
index fe6106d234..a6d236756a 100644
--- a/plugins/node/opentelemetry-instrumentation-koa/src/utils.ts
+++ b/plugins/node/opentelemetry-instrumentation-koa/src/utils.ts
@@ -17,7 +17,7 @@ import { KoaContext, KoaLayerType, KoaInstrumentationConfig } from './types';
import { KoaMiddleware } from './internal-types';
import { AttributeNames } from './enums/AttributeNames';
import { Attributes } from '@opentelemetry/api';
-import { SemanticAttributes } from '@opentelemetry/semantic-conventions';
+import { SEMATTRS_HTTP_ROUTE } from '@opentelemetry/semantic-conventions';
export const getMiddlewareMetadata = (
context: KoaContext,
@@ -34,7 +34,7 @@ export const getMiddlewareMetadata = (
attributes: {
[AttributeNames.KOA_NAME]: layerPath?.toString(),
[AttributeNames.KOA_TYPE]: KoaLayerType.ROUTER,
- [SemanticAttributes.HTTP_ROUTE]: layerPath?.toString(),
+ [SEMATTRS_HTTP_ROUTE]: layerPath?.toString(),
},
name: context._matchedRouteName || `router - ${layerPath}`,
layerName: context._matchedRouteName || layerPath?.toString() || '',
diff --git a/plugins/node/opentelemetry-instrumentation-koa/test/koa.test.ts b/plugins/node/opentelemetry-instrumentation-koa/test/koa.test.ts
index 483aa757f6..ea46c6d072 100644
--- a/plugins/node/opentelemetry-instrumentation-koa/test/koa.test.ts
+++ b/plugins/node/opentelemetry-instrumentation-koa/test/koa.test.ts
@@ -23,7 +23,11 @@ import {
InMemorySpanExporter,
SimpleSpanProcessor,
} from '@opentelemetry/sdk-trace-base';
-import { SemanticAttributes } from '@opentelemetry/semantic-conventions';
+import {
+ SEMATTRS_EXCEPTION_MESSAGE,
+ SEMATTRS_HTTP_METHOD,
+ SEMATTRS_HTTP_ROUTE,
+} from '@opentelemetry/semantic-conventions';
import { KoaInstrumentation } from '../src';
const plugin = new KoaInstrumentation();
@@ -175,7 +179,7 @@ describe('Koa Instrumentation', () => {
);
assert.strictEqual(
- requestHandlerSpan?.attributes[SemanticAttributes.HTTP_ROUTE],
+ requestHandlerSpan?.attributes[SEMATTRS_HTTP_ROUTE],
'/post/:id'
);
@@ -226,7 +230,7 @@ describe('Koa Instrumentation', () => {
);
assert.strictEqual(
- requestHandlerSpan?.attributes[SemanticAttributes.HTTP_ROUTE],
+ requestHandlerSpan?.attributes[SEMATTRS_HTTP_ROUTE],
'/^\\/post/'
);
@@ -273,7 +277,7 @@ describe('Koa Instrumentation', () => {
);
assert.strictEqual(
- requestHandlerSpan?.attributes[SemanticAttributes.HTTP_ROUTE],
+ requestHandlerSpan?.attributes[SEMATTRS_HTTP_ROUTE],
'/post/:id'
);
@@ -322,7 +326,7 @@ describe('Koa Instrumentation', () => {
);
assert.strictEqual(
- requestHandlerSpan?.attributes[SemanticAttributes.HTTP_ROUTE],
+ requestHandlerSpan?.attributes[SEMATTRS_HTTP_ROUTE],
'/:first/post/:id'
);
@@ -369,7 +373,7 @@ describe('Koa Instrumentation', () => {
);
assert.strictEqual(
- requestHandlerSpan?.attributes[SemanticAttributes.HTTP_ROUTE],
+ requestHandlerSpan?.attributes[SEMATTRS_HTTP_ROUTE],
'/:first/post/:id'
);
@@ -570,7 +574,7 @@ describe('Koa Instrumentation', () => {
assert.ok(exceptionEvent, 'There should be an exception event recorded');
assert.deepStrictEqual(exceptionEvent.name, 'exception');
assert.deepStrictEqual(
- exceptionEvent.attributes![SemanticAttributes.EXCEPTION_MESSAGE],
+ exceptionEvent.attributes![SEMATTRS_EXCEPTION_MESSAGE],
'I failed!'
);
});
@@ -591,10 +595,7 @@ describe('Koa Instrumentation', () => {
);
const requestHook = sinon.spy((span: Span, info: KoaRequestInfo) => {
- span.setAttribute(
- SemanticAttributes.HTTP_METHOD,
- info.context.request.method
- );
+ span.setAttribute(SEMATTRS_HTTP_METHOD, info.context.request.method);
throw Error('error thrown in requestHook');
});
diff --git a/plugins/web/opentelemetry-instrumentation-document-load/README.md b/plugins/web/opentelemetry-instrumentation-document-load/README.md
index e0ec16ecdd..4ec62269ae 100644
--- a/plugins/web/opentelemetry-instrumentation-document-load/README.md
+++ b/plugins/web/opentelemetry-instrumentation-document-load/README.md
@@ -111,6 +111,17 @@ registerInstrumentations({
See [examples/tracer-web](https://github.com/open-telemetry/opentelemetry-js/tree/main/examples/tracer-web) for a short example.
+## Semantic Conventions
+
+This package uses `@opentelemetry/semantic-conventions` version `1.22+`, which implements Semantic Convention [Version 1.7.0](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.7.0/semantic_conventions/README.md)
+
+Attributes collected:
+
+| Attribute | Short Description | Notes |
+| ----------------- | ------------------------------------------------------------------------------ | ------------------------------- |
+| `http.url` | Full HTTP request URL in the form `scheme://host[:port]/path?query[#fragment]` | Key: `SEMATTRS_HTTP_URL` |
+| `http.user_agent` | Value of the HTTP User-Agent header sent by the client | Key: `SEMATTRS_HTTP_USER_AGENT` |
+
## Useful links
- For more information on OpenTelemetry, visit:
diff --git a/plugins/web/opentelemetry-instrumentation-document-load/package.json b/plugins/web/opentelemetry-instrumentation-document-load/package.json
index 89b6968221..c52463fbc9 100644
--- a/plugins/web/opentelemetry-instrumentation-document-load/package.json
+++ b/plugins/web/opentelemetry-instrumentation-document-load/package.json
@@ -72,7 +72,7 @@
"@opentelemetry/instrumentation": "^0.49.1",
"@opentelemetry/sdk-trace-base": "^1.0.0",
"@opentelemetry/sdk-trace-web": "^1.15.0",
- "@opentelemetry/semantic-conventions": "^1.0.0"
+ "@opentelemetry/semantic-conventions": "^1.22.0"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/web/opentelemetry-instrumentation-document-load#readme"
}
diff --git a/plugins/web/opentelemetry-instrumentation-document-load/src/instrumentation.ts b/plugins/web/opentelemetry-instrumentation-document-load/src/instrumentation.ts
index 78ab9162d1..ecc84b9f76 100644
--- a/plugins/web/opentelemetry-instrumentation-document-load/src/instrumentation.ts
+++ b/plugins/web/opentelemetry-instrumentation-document-load/src/instrumentation.ts
@@ -40,7 +40,10 @@ import {
} from './types';
import { AttributeNames } from './enums/AttributeNames';
import { VERSION } from './version';
-import { SemanticAttributes } from '@opentelemetry/semantic-conventions';
+import {
+ SEMATTRS_HTTP_URL,
+ SEMATTRS_HTTP_USER_AGENT,
+} from '@opentelemetry/semantic-conventions';
import {
addSpanPerformancePaintEvents,
getPerformanceNavigationEntries,
@@ -115,7 +118,7 @@ export class DocumentLoadInstrumentation extends InstrumentationBase {
entries
);
if (fetchSpan) {
- fetchSpan.setAttribute(SemanticAttributes.HTTP_URL, location.href);
+ fetchSpan.setAttribute(SEMATTRS_HTTP_URL, location.href);
context.with(trace.setSpan(context.active(), fetchSpan), () => {
addSpanNetworkEvents(fetchSpan, entries);
this._addCustomAttributesOnSpan(
@@ -127,11 +130,8 @@ export class DocumentLoadInstrumentation extends InstrumentationBase {
}
});
- rootSpan.setAttribute(SemanticAttributes.HTTP_URL, location.href);
- rootSpan.setAttribute(
- SemanticAttributes.HTTP_USER_AGENT,
- navigator.userAgent
- );
+ rootSpan.setAttribute(SEMATTRS_HTTP_URL, location.href);
+ rootSpan.setAttribute(SEMATTRS_HTTP_USER_AGENT, navigator.userAgent);
this._addResourcesSpans(rootSpan);
@@ -196,7 +196,7 @@ export class DocumentLoadInstrumentation extends InstrumentationBase {
parentSpan
);
if (span) {
- span.setAttribute(SemanticAttributes.HTTP_URL, resource.name);
+ span.setAttribute(SEMATTRS_HTTP_URL, resource.name);
addSpanNetworkEvents(span, resource);
this._addCustomAttributesOnResourceSpan(
span,
diff --git a/plugins/web/opentelemetry-instrumentation-document-load/test/documentLoad.test.ts b/plugins/web/opentelemetry-instrumentation-document-load/test/documentLoad.test.ts
index 4d31349f68..3dbf64dbe7 100644
--- a/plugins/web/opentelemetry-instrumentation-document-load/test/documentLoad.test.ts
+++ b/plugins/web/opentelemetry-instrumentation-document-load/test/documentLoad.test.ts
@@ -39,7 +39,10 @@ import {
import chai from 'chai/chai.js';
import * as sinon from 'sinon';
import { DocumentLoadInstrumentation } from '../src';
-import { SemanticAttributes } from '@opentelemetry/semantic-conventions';
+import {
+ SEMATTRS_HTTP_RESPONSE_CONTENT_LENGTH,
+ SEMATTRS_HTTP_URL,
+} from '@opentelemetry/semantic-conventions';
import { EventNames } from '../src/enums/EventNames';
const { assert } = chai as typeof import('chai');
@@ -347,7 +350,7 @@ describe('DocumentLoad Instrumentation', () => {
assert.strictEqual(rootSpan.name, 'documentFetch');
assert.ok(
(rootSpan.attributes[
- SemanticAttributes.HTTP_RESPONSE_CONTENT_LENGTH
+ SEMATTRS_HTTP_RESPONSE_CONTENT_LENGTH
] as number) > 0
);
assert.strictEqual(fetchSpan.name, 'documentLoad');
@@ -448,11 +451,11 @@ describe('DocumentLoad Instrumentation', () => {
const srEvents2 = spanResource2.events;
assert.strictEqual(
- spanResource1.attributes[SemanticAttributes.HTTP_URL],
+ spanResource1.attributes[SEMATTRS_HTTP_URL],
'http://localhost:8090/bundle.js'
);
assert.strictEqual(
- spanResource2.attributes[SemanticAttributes.HTTP_URL],
+ spanResource2.attributes[SEMATTRS_HTTP_URL],
'http://localhost:8090/sockjs-node/info?t=1572620894466'
);
@@ -484,7 +487,7 @@ describe('DocumentLoad Instrumentation', () => {
const srEvents1 = spanResource1.events;
assert.strictEqual(
- spanResource1.attributes[SemanticAttributes.HTTP_URL],
+ spanResource1.attributes[SEMATTRS_HTTP_URL],
'http://localhost:8090/bundle.js'
);
diff --git a/plugins/web/opentelemetry-instrumentation-document-load/web-test-runner.config.mjs b/plugins/web/opentelemetry-instrumentation-document-load/web-test-runner.config.mjs
index aeef46fe8e..1989a756fd 100644
--- a/plugins/web/opentelemetry-instrumentation-document-load/web-test-runner.config.mjs
+++ b/plugins/web/opentelemetry-instrumentation-document-load/web-test-runner.config.mjs
@@ -18,6 +18,7 @@ import { nodeResolve as nodeResolveRollup } from '@rollup/plugin-node-resolve';
import commonjsRollup from '@rollup/plugin-commonjs';
import { esbuildPlugin } from '@web/dev-server-esbuild';
import { fromRollup } from '@web/dev-server-rollup';
+import { chromeLauncher } from '@web/test-runner';
const nodeResolve = fromRollup(nodeResolveRollup);
const commonjs = fromRollup(commonjsRollup);
@@ -25,6 +26,7 @@ const commonjs = fromRollup(commonjsRollup);
export default {
files: ['test/**/*.test.ts'],
nodeResolve: true,
+ browsers: [chromeLauncher({ launchOptions: { args: ['--no-sandbox'] } })],
plugins: [
esbuildPlugin({ ts: true }),
nodeResolve({ browser: true, preferBuiltins: false }),