Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite75697b

Browse files
committed
Explicit initialization of @azure/opentelemetry-instrumentation-azure-sdk
1 parent680294a commite75697b

File tree

5 files changed

+22
-10
lines changed

5 files changed

+22
-10
lines changed

‎apps/pwabuilder-google-play/package-lock.json‎

Lines changed: 5 additions & 3 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎apps/pwabuilder-google-play/package.json‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
"cross-env":"^10.1.0"
5656
},
5757
"overrides": {
58-
"@opentelemetry/api":"1.0.0",
5958
"tough-cookie":">=4.1.3",
6059
"handlebars":">=4.7.7",
6160
"json-schema":">=0.4.0",

‎apps/pwabuilder-google-play/server.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@ process.env.APPLICATIONINSIGHTS_NO_AZURE_INSTRUMENTATION = 'true';
88
process.env.OTEL_SDK_DISABLED='true';
99
process.env.OTEL_INSTRUMENTATION_COMMON_DEFAULT_ENABLED='false';
1010

11+
// Setup analytics early to avoid race issues with open telemetry.
12+
import{setupAnalytics}from"./services/analytics.js";
13+
setupAnalytics();
14+
1115
importdotenvfrom'dotenv';
1216
importappfrom'./app.js';
13-
import{setupAnalytics}from"./services/analytics.js";
1417
import{PackageJobProcessor}from'./services/packageJobProcessor.js';
1518

1619
constconfigResult=dotenv.config({
@@ -38,8 +41,6 @@ if (!jdk8Path || !androidDevToolsPath) {
3841
console.error("Couldn't find environment variables for JDK8 path or Android Dev tools",app.get("env"),jdk8Path,androidDevToolsPath);
3942
}
4043

41-
setupAnalytics();
42-
4344
// Kick off our background job processor.
4445
// This periodically polls Redis for new Google Play packaging jobs and processes them.
4546
constjobProcessor=newPackageJobProcessor();

‎apps/pwabuilder-google-play/services/analytics.ts‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import*asappInsightsfrom'applicationinsights';
2+
import{NodeSDK}from'@opentelemetry/sdk-node';
3+
import{ConsoleSpanExporter}from'@opentelemetry/sdk-trace-node';
24

35
enumAppInsightsStatus{
46
ENABLED=1,
@@ -9,8 +11,12 @@ enum AppInsightsStatus {
911
varappInsightsStatus:AppInsightsStatus=AppInsightsStatus.DEFAULT;
1012
exportfunctionsetupAnalytics(){
1113
try{
12-
// Environment variables are set at application startup in server.ts
13-
// to ensure they're configured before any Azure packages are imported
14+
constsdk=newNodeSDK({
15+
traceExporter:newConsoleSpanExporter(),
16+
instrumentations:[],
17+
});
18+
19+
sdk.start();
1420

1521
appInsights.setup()
1622
.setAutoCollectRequests(false)

‎apps/pwabuilder-google-play/services/azureStorageBlobService.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,11 @@ export class AzureStorageBlobService implements BlobStorage {
9494
if(!this.blobServiceClientTask){
9595
this.blobServiceClientTask=newPromise<BlobServiceClient>(async(resolve,reject)=>{
9696
try{
97-
console.info("Initializing Azure services, including @azure/core-tracing...");
97+
console.info("Initializing Azure services...");
98+
99+
// Import Azure open telemetry in order to avoid race condition around@azure/core-tracing.
100+
constazureOpenTelemetry=awaitimport("@azure/opentelemetry-instrumentation-azure-sdk");
101+
azureOpenTelemetry.logger.info("Azure Open Telemetry initialized");
98102

99103
// Dynamic imports to prevent early loading of Azure packages
100104
const{ BlobServiceClient}=awaitimport("@azure/storage-blob");

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp