Skip to content

Commit 5f59819

Browse files
committed
suppressTracing during resource detection to satisfy GcpDetectorIntegration.test.ts
1 parent 139c111 commit 5f59819

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/resource-detector-gcp/src/detectors/GcpDetector.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
* limitations under the License.
1616
*/
1717

18+
import { context } from '@opentelemetry/api';
19+
import { suppressTracing } from '@opentelemetry/core';
1820
import {
1921
CLOUDPLATFORMVALUES_GCP_APP_ENGINE,
2022
CLOUDPLATFORMVALUES_GCP_CLOUD_FUNCTIONS,
@@ -207,7 +209,11 @@ async function makeResource(attrs: GcpResourceAttributes): Promise<Resource> {
207209
*/
208210
export class GcpDetector implements ResourceDetector {
209211
private async _asyncAttributes(): Promise<Attributes> {
210-
return (await detect()).attributes;
212+
const resource = await context.with(
213+
suppressTracing(context.active()),
214+
detect
215+
);
216+
return resource.attributes;
211217
}
212218

213219
detect(): DetectedResource {

0 commit comments

Comments
 (0)