From 2d9af21692c4f4c48697f9af7cf1bdb196e07c2e Mon Sep 17 00:00:00 2001 From: MacRae Linton Date: Mon, 6 Nov 2023 15:14:48 -0800 Subject: [PATCH] fix trace name for indexHPP and add some prospective logging --- services/app-api/src/resolvers/attributeHelper.ts | 5 ++++- .../resolvers/healthPlanPackage/indexHealthPlanPackages.ts | 7 ++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/services/app-api/src/resolvers/attributeHelper.ts b/services/app-api/src/resolvers/attributeHelper.ts index 1d49eeac5a..79dd7214c1 100644 --- a/services/app-api/src/resolvers/attributeHelper.ts +++ b/services/app-api/src/resolvers/attributeHelper.ts @@ -8,7 +8,10 @@ export function setResolverDetailsOnActiveSpan( user: Context['user'], span: Context['span'] ): void { - if (!span) return + if (!span) { + console.info(`No span set on ${name} call`) + return + } span.setAttributes({ [SemanticAttributes.ENDUSER_ID]: user.email, [SemanticAttributes.ENDUSER_ROLE]: user.role, diff --git a/services/app-api/src/resolvers/healthPlanPackage/indexHealthPlanPackages.ts b/services/app-api/src/resolvers/healthPlanPackage/indexHealthPlanPackages.ts index fc2dbec38e..fe220799ef 100644 --- a/services/app-api/src/resolvers/healthPlanPackage/indexHealthPlanPackages.ts +++ b/services/app-api/src/resolvers/healthPlanPackage/indexHealthPlanPackages.ts @@ -53,7 +53,8 @@ export function indexHealthPlanPackagesResolver( ): QueryResolvers['indexHealthPlanPackages'] { return async (_parent, _args, context) => { const { user, span } = context - setResolverDetailsOnActiveSpan('fetchHealthPlanPackage', user, span) + + setResolverDetailsOnActiveSpan('indexHealthPlanPackages', user, span) const ratesDatabaseRefactor = await launchDarkly.getFeatureFlag( context, @@ -70,7 +71,7 @@ export function indexHealthPlanPackagesResolver( if (contractsWithHistory instanceof Error) { const errMessage = `Issue finding contracts with history by stateCode: ${user.stateCode}. Message: ${contractsWithHistory.message}` - logError('fetchHealthPlanPackage', errMessage) + logError('indexHealthPlanPackages', errMessage) setErrorAttributesOnActiveSpan(errMessage, span) if (contractsWithHistory instanceof NotFoundError) { @@ -111,7 +112,7 @@ export function indexHealthPlanPackagesResolver( if (contractsWithHistory instanceof Error) { const errMessage = `Issue finding contracts with history by submit info. Message: ${contractsWithHistory.message}` - logError('fetchHealthPlanPackage', errMessage) + logError('indexHealthPlanPackages', errMessage) setErrorAttributesOnActiveSpan(errMessage, span) if (contractsWithHistory instanceof NotFoundError) {