Skip to content

Commit f41b872

Browse files
authored
Merge branch 'open-telemetry:main' into feature/koa-ignore
2 parents c18825a + 35e6607 commit f41b872

File tree

13 files changed

+73
-50
lines changed

13 files changed

+73
-50
lines changed

.github/component_owners.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ components:
111111
plugins/node/opentelemetry-instrumentation-runtime-node:
112112
- d4nyll
113113
plugins/node/opentelemetry-instrumentation-pg:
114+
- maryliag
114115
- rauno56
115116
plugins/node/opentelemetry-instrumentation-pino:
116117
- seemk

detectors/node/opentelemetry-resource-detector-alibaba-cloud/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
},
5858
"dependencies": {
5959
"@opentelemetry/resources": "^1.0.0",
60-
"@opentelemetry/semantic-conventions": "^1.0.0"
60+
"@opentelemetry/semantic-conventions": "^1.22.0"
6161
},
6262
"homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/detectors/node/opentelemetry-resource-detector-alibaba-cloud#readme"
6363
}

detectors/node/opentelemetry-resource-detector-alibaba-cloud/src/detectors/AlibabaCloudEcsDetector.ts

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,16 @@ import {
2020
ResourceDetectionConfig,
2121
} from '@opentelemetry/resources';
2222
import {
23-
CloudPlatformValues,
24-
CloudProviderValues,
25-
SemanticResourceAttributes,
23+
CLOUDPLATFORMVALUES_ALIBABA_CLOUD_ECS,
24+
CLOUDPROVIDERVALUES_ALIBABA_CLOUD,
25+
SEMRESATTRS_CLOUD_ACCOUNT_ID,
26+
SEMRESATTRS_CLOUD_AVAILABILITY_ZONE,
27+
SEMRESATTRS_CLOUD_PLATFORM,
28+
SEMRESATTRS_CLOUD_PROVIDER,
29+
SEMRESATTRS_CLOUD_REGION,
30+
SEMRESATTRS_HOST_ID,
31+
SEMRESATTRS_HOST_NAME,
32+
SEMRESATTRS_HOST_TYPE,
2633
} from '@opentelemetry/semantic-conventions';
2734
import * as http from 'http';
2835

@@ -61,16 +68,14 @@ class AlibabaCloudEcsDetector implements Detector {
6168
const hostname = await this._fetchHost();
6269

6370
return new Resource({
64-
[SemanticResourceAttributes.CLOUD_PROVIDER]:
65-
CloudProviderValues.ALIBABA_CLOUD,
66-
[SemanticResourceAttributes.CLOUD_PLATFORM]:
67-
CloudPlatformValues.ALIBABA_CLOUD_ECS,
68-
[SemanticResourceAttributes.CLOUD_ACCOUNT_ID]: accountId,
69-
[SemanticResourceAttributes.CLOUD_REGION]: region,
70-
[SemanticResourceAttributes.CLOUD_AVAILABILITY_ZONE]: availabilityZone,
71-
[SemanticResourceAttributes.HOST_ID]: instanceId,
72-
[SemanticResourceAttributes.HOST_TYPE]: instanceType,
73-
[SemanticResourceAttributes.HOST_NAME]: hostname,
71+
[SEMRESATTRS_CLOUD_PROVIDER]: CLOUDPROVIDERVALUES_ALIBABA_CLOUD,
72+
[SEMRESATTRS_CLOUD_PLATFORM]: CLOUDPLATFORMVALUES_ALIBABA_CLOUD_ECS,
73+
[SEMRESATTRS_CLOUD_ACCOUNT_ID]: accountId,
74+
[SEMRESATTRS_CLOUD_REGION]: region,
75+
[SEMRESATTRS_CLOUD_AVAILABILITY_ZONE]: availabilityZone,
76+
[SEMRESATTRS_HOST_ID]: instanceId,
77+
[SEMRESATTRS_HOST_TYPE]: instanceType,
78+
[SEMRESATTRS_HOST_NAME]: hostname,
7479
});
7580
}
7681

detectors/node/opentelemetry-resource-detector-alibaba-cloud/test/detectors/AlibabaCloudEcsDetector.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import * as nock from 'nock';
1818
import * as assert from 'assert';
1919
import { Resource } from '@opentelemetry/resources';
20-
import { CloudProviderValues } from '@opentelemetry/semantic-conventions';
20+
import { CLOUDPROVIDERVALUES_ALIBABA_CLOUD } from '@opentelemetry/semantic-conventions';
2121
import { alibabaCloudEcsDetector } from '../../src';
2222
import {
2323
assertCloudResource,
@@ -70,7 +70,7 @@ describe('alibabaCloudEcsDetector', () => {
7070
assert.ok(resource);
7171

7272
assertCloudResource(resource, {
73-
provider: CloudProviderValues.ALIBABA_CLOUD,
73+
provider: CLOUDPROVIDERVALUES_ALIBABA_CLOUD,
7474
accountId: 'my-owner-account-id',
7575
region: 'my-region-id',
7676
zone: 'my-zone-id',

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/node/opentelemetry-instrumentation-koa/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"dependencies": {
6868
"@opentelemetry/core": "^1.8.0",
6969
"@opentelemetry/instrumentation": "^0.49.1",
70-
"@opentelemetry/semantic-conventions": "^1.0.0",
70+
"@opentelemetry/semantic-conventions": "^1.22.0",
7171
"@types/koa": "2.14.0",
7272
"@types/koa__router": "12.0.3"
7373
},

plugins/node/opentelemetry-instrumentation-koa/src/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { KoaContext, KoaLayerType, KoaInstrumentationConfig } from './types';
1717
import { KoaMiddleware } from './internal-types';
1818
import { AttributeNames } from './enums/AttributeNames';
1919
import { Attributes } from '@opentelemetry/api';
20-
import { SemanticAttributes } from '@opentelemetry/semantic-conventions';
20+
import { SEMATTRS_HTTP_ROUTE } from '@opentelemetry/semantic-conventions';
2121

2222
export const getMiddlewareMetadata = (
2323
context: KoaContext,
@@ -34,7 +34,7 @@ export const getMiddlewareMetadata = (
3434
attributes: {
3535
[AttributeNames.KOA_NAME]: layerPath?.toString(),
3636
[AttributeNames.KOA_TYPE]: KoaLayerType.ROUTER,
37-
[SemanticAttributes.HTTP_ROUTE]: layerPath?.toString(),
37+
[SEMATTRS_HTTP_ROUTE]: layerPath?.toString(),
3838
},
3939
name: context._matchedRouteName || `router - ${layerPath}`,
4040
layerName: context._matchedRouteName || layerPath?.toString() || '',

plugins/node/opentelemetry-instrumentation-koa/test/koa.test.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ import {
2323
InMemorySpanExporter,
2424
SimpleSpanProcessor,
2525
} from '@opentelemetry/sdk-trace-base';
26-
import { SemanticAttributes } from '@opentelemetry/semantic-conventions';
26+
import {
27+
SEMATTRS_EXCEPTION_MESSAGE,
28+
SEMATTRS_HTTP_METHOD,
29+
SEMATTRS_HTTP_ROUTE,
30+
} from '@opentelemetry/semantic-conventions';
2731

2832
import { KoaInstrumentation } from '../src';
2933
const plugin = new KoaInstrumentation();
@@ -175,7 +179,7 @@ describe('Koa Instrumentation', () => {
175179
);
176180

177181
assert.strictEqual(
178-
requestHandlerSpan?.attributes[SemanticAttributes.HTTP_ROUTE],
182+
requestHandlerSpan?.attributes[SEMATTRS_HTTP_ROUTE],
179183
'/post/:id'
180184
);
181185

@@ -226,7 +230,7 @@ describe('Koa Instrumentation', () => {
226230
);
227231

228232
assert.strictEqual(
229-
requestHandlerSpan?.attributes[SemanticAttributes.HTTP_ROUTE],
233+
requestHandlerSpan?.attributes[SEMATTRS_HTTP_ROUTE],
230234
'/^\\/post/'
231235
);
232236

@@ -273,7 +277,7 @@ describe('Koa Instrumentation', () => {
273277
);
274278

275279
assert.strictEqual(
276-
requestHandlerSpan?.attributes[SemanticAttributes.HTTP_ROUTE],
280+
requestHandlerSpan?.attributes[SEMATTRS_HTTP_ROUTE],
277281
'/post/:id'
278282
);
279283

@@ -322,7 +326,7 @@ describe('Koa Instrumentation', () => {
322326
);
323327

324328
assert.strictEqual(
325-
requestHandlerSpan?.attributes[SemanticAttributes.HTTP_ROUTE],
329+
requestHandlerSpan?.attributes[SEMATTRS_HTTP_ROUTE],
326330
'/:first/post/:id'
327331
);
328332

@@ -369,7 +373,7 @@ describe('Koa Instrumentation', () => {
369373
);
370374

371375
assert.strictEqual(
372-
requestHandlerSpan?.attributes[SemanticAttributes.HTTP_ROUTE],
376+
requestHandlerSpan?.attributes[SEMATTRS_HTTP_ROUTE],
373377
'/:first/post/:id'
374378
);
375379

@@ -570,7 +574,7 @@ describe('Koa Instrumentation', () => {
570574
assert.ok(exceptionEvent, 'There should be an exception event recorded');
571575
assert.deepStrictEqual(exceptionEvent.name, 'exception');
572576
assert.deepStrictEqual(
573-
exceptionEvent.attributes![SemanticAttributes.EXCEPTION_MESSAGE],
577+
exceptionEvent.attributes![SEMATTRS_EXCEPTION_MESSAGE],
574578
'I failed!'
575579
);
576580
});
@@ -591,10 +595,7 @@ describe('Koa Instrumentation', () => {
591595
);
592596

593597
const requestHook = sinon.spy((span: Span, info: KoaRequestInfo) => {
594-
span.setAttribute(
595-
SemanticAttributes.HTTP_METHOD,
596-
info.context.request.method
597-
);
598+
span.setAttribute(SEMATTRS_HTTP_METHOD, info.context.request.method);
598599

599600
throw Error('error thrown in requestHook');
600601
});

plugins/web/opentelemetry-instrumentation-document-load/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,17 @@ registerInstrumentations({
111111

112112
See [examples/tracer-web](https://github.com/open-telemetry/opentelemetry-js/tree/main/examples/tracer-web) for a short example.
113113

114+
## Semantic Conventions
115+
116+
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)
117+
118+
Attributes collected:
119+
120+
| Attribute | Short Description | Notes |
121+
| ----------------- | ------------------------------------------------------------------------------ | ------------------------------- |
122+
| `http.url` | Full HTTP request URL in the form `scheme://host[:port]/path?query[#fragment]` | Key: `SEMATTRS_HTTP_URL` |
123+
| `http.user_agent` | Value of the HTTP User-Agent header sent by the client | Key: `SEMATTRS_HTTP_USER_AGENT` |
124+
114125
## Useful links
115126

116127
- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>

plugins/web/opentelemetry-instrumentation-document-load/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
"@opentelemetry/instrumentation": "^0.49.1",
7373
"@opentelemetry/sdk-trace-base": "^1.0.0",
7474
"@opentelemetry/sdk-trace-web": "^1.15.0",
75-
"@opentelemetry/semantic-conventions": "^1.0.0"
75+
"@opentelemetry/semantic-conventions": "^1.22.0"
7676
},
7777
"homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/web/opentelemetry-instrumentation-document-load#readme"
7878
}

0 commit comments

Comments
 (0)