File tree Expand file tree Collapse file tree 3 files changed +12
-2
lines changed
plugins/node/opentelemetry-instrumentation-aws-sdk Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Original file line number Diff line number Diff 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 {
Original file line number Diff line number Diff line change 1414 * limitations under the License.
1515 */
1616
17- import { getTestSpans } from '@opentelemetry/contrib-test-utils' ;
1817import './load-instrumentation' ;
1918
19+ import { getTestSpans } from '@opentelemetry/contrib-test-utils' ;
2020import {
2121 SEMATTRS_FAAS_EXECUTION ,
2222 SEMATTRS_FAAS_INVOKED_NAME ,
Original file line number Diff line number Diff line change 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+ */
1624import {
1725 initMeterProvider ,
1826 registerInstrumentationTesting ,
@@ -21,5 +29,4 @@ import { AwsInstrumentation } from '../src';
2129
2230export const instrumentation = new AwsInstrumentation ( ) ;
2331export const metricReader = initMeterProvider ( instrumentation ) ;
24- instrumentation . _updateMetricInstruments ( ) ;
2532registerInstrumentationTesting ( instrumentation ) ;
You can’t perform that action at this time.
0 commit comments