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

Commitfd9b18e

Browse files
committed
Potential fix for "shutdown may only be called once per MeterProvider"
1 parent5c6f36b commitfd9b18e

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
lines changed

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

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ enum AnalyticsStatus {
1010
letanalyticsStatus:AnalyticsStatus=AnalyticsStatus.DEFAULT;
1111
lettracer:any=null;
1212
letmeter:any=null;
13-
letisShuttingDown=false;
1413

1514
exportfunctionsetupAnalytics(){
1615
try{
@@ -40,17 +39,8 @@ export function setupAnalytics() {
4039
analyticsStatus=AnalyticsStatus.ENABLED;
4140
console.log('Azure Monitor OpenTelemetry enabled successfully');
4241

43-
// Handle graceful shutdown
44-
constgracefulShutdown=async()=>{
45-
if(isShuttingDown)return;
46-
isShuttingDown=true;
47-
console.warn('Shutting down OpenTelemetry...');
48-
// Give telemetry time to flush before exit
49-
setTimeout(()=>process.exit(0),2000);
50-
};
51-
52-
process.on('SIGTERM',gracefulShutdown);
53-
process.on('SIGINT',gracefulShutdown);
42+
// Note: Azure Monitor OpenTelemetry distro handles shutdown automatically
43+
// No need for manual shutdown handlers as they can conflict with built-in shutdown logic
5444
}else{
5545
console.warn('APPLICATIONINSIGHTS_CONNECTION_STRING not found, analytics disabled');
5646
analyticsStatus=AnalyticsStatus.DISABLED;
@@ -83,8 +73,8 @@ export function setupAnalytics() {
8373
setupAnalytics();
8474
}
8575

86-
if(analyticsStatus===AnalyticsStatus.DISABLED||!tracer||isShuttingDown){
87-
console.warn("Analytics disabled or shutting down, skipping event tracking");
76+
if(analyticsStatus===AnalyticsStatus.DISABLED||!tracer){
77+
console.warn("Analytics disabled, skipping event tracking");
8878
return;
8979
}
9080

@@ -123,7 +113,7 @@ export function setupAnalytics() {
123113
span.end();
124114

125115
// Create a metric counter for package events - with error handling
126-
if(meter&&!isShuttingDown){
116+
if(meter){
127117
try{
128118
constpackageCounter=meter.createCounter('pwa_package_events',{
129119
description:'Count of PWA package creation events'

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export interface BlobStorage {
1111

1212
/**
1313
* Blob storage service that connects to PWABuilder's Azure Storage account for uploading and downloading files.
14-
* NOTE: we lazily initialize the Azure BlobServiceClient and ContainerClient to avoid loading Azure SDK packagestoo early, which can cause conflicts with OpenTelemetry in our environment. Without this, we'd see errors like, "Module @azure/core-tracing has been loaded before @azure/opentelemetry-instrumentation-azure-sdk so it might not work, please initialize it before requiring @azure/core-tracing'"
14+
* NOTE: we lazily initialize the Azure BlobServiceClient and ContainerClientfor better performance andto avoid loadinglargeAzure SDK packagesduring application startup when they may not be needed (e.g., in development mode).
1515
*/
1616
exportclassAzureStorageBlobServiceimplementsBlobStorage{
1717
privateblobServiceClientTask:Promise<BlobServiceClient>|null=null;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp