Skip to content

Commit e59286e

Browse files
committed
Cleanup
1 parent 00e7ac6 commit e59286e

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/bedrock-runtime.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ export class BedrockRuntimeServiceExtension implements ServiceExtension {
5757
private operationDuration!: Histogram;
5858

5959
updateMetricInstruments(meter: Meter) {
60+
// https://opentelemetry.io/docs/specs/semconv/gen-ai/gen-ai-metrics/#metric-gen_aiclienttokenusage
6061
this.tokenUsage = meter.createHistogram('gen_ai.client.token.usage', {
6162
unit: '{token}',
6263
description: 'Measures number of input and output tokens used',
@@ -68,6 +69,8 @@ export class BedrockRuntimeServiceExtension implements ServiceExtension {
6869
],
6970
},
7071
});
72+
73+
// https://opentelemetry.io/docs/specs/semconv/gen-ai/gen-ai-metrics/#metric-gen_aiclientoperationduration
7174
this.operationDuration = meter.createHistogram(
7275
'gen_ai.client.operation.duration',
7376
{

plugins/node/opentelemetry-instrumentation-aws-sdk/test/lambda.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { getTestSpans } from '@opentelemetry/contrib-test-utils';
1817
import './load-instrumentation';
1918

19+
import { getTestSpans } from '@opentelemetry/contrib-test-utils';
2020
import {
2121
SEMATTRS_FAAS_EXECUTION,
2222
SEMATTRS_FAAS_INVOKED_NAME,

plugins/node/opentelemetry-instrumentation-aws-sdk/test/load-instrumentation.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
17+
/**
18+
* Because all tests in this folder are run in the same process, if instantiating
19+
* instrumentation within tests with different configurations such as metrics support,
20+
* it can be difficult to ensure the correct instrumentation is applied during the
21+
* specific test. We instead instantiate a single instrumentation instance here to
22+
* use within all tests.
23+
*/
1624
import {
1725
initMeterProvider,
1826
registerInstrumentationTesting,
@@ -21,5 +29,4 @@ import { AwsInstrumentation } from '../src';
2129

2230
export const instrumentation = new AwsInstrumentation();
2331
export const metricReader = initMeterProvider(instrumentation);
24-
instrumentation._updateMetricInstruments();
2532
registerInstrumentationTesting(instrumentation);

0 commit comments

Comments
 (0)