Skip to content

Issue CWMOT5100 only once #31223

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 15, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2024 IBM Corporation and others.
* Copyright (c) 2024, 2025 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
Expand All @@ -10,6 +10,8 @@
package io.openliberty.microprofile.telemetry.internal.common.info;

import java.util.HashMap;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicReference;

import org.apache.commons.lang3.concurrent.LazyInitializer;
Expand Down Expand Up @@ -43,6 +45,9 @@ public class OpenTelemtryLifecycleManagerImpl implements ApplicationStateListene

private final MetaDataSlot slotForOpenTelemetryInfoHolder;
private final OpenTelemetryInfoFactory openTelemetryInfoFactory;

private final Set<String> warningsEmittedForInternalApps = ConcurrentHashMap.newKeySet();

boolean telemetry2OrLater;

//These three are set during activation, and refreshed on checkpoint restore. (runtimeInstance is only set if we need one)
Expand Down Expand Up @@ -236,8 +241,13 @@ public OpenTelemetryInfoInternal getOpenTelemetryInfo(ApplicationMetaData metaDa
if (atomicRef == null) {
//If this is triggered by a WAB or internal code that doesn't have an associated app, and we're in app mode, return a no-op
//(in runtime mode we do want to have OpenTelemetry enabled for internal code, e.g., for tracing)
//Issue CWMOT5100 only once for WAB or internal code.
String j2EEName = metaData.getJ2EEName().toString();
Tr.info(tc, "CWMOT5100.tracing.is.disabled", j2EEName);

if (j2EEName != null && warningsEmittedForInternalApps.add(j2EEName)) {
Tr.info(tc, "CWMOT5100.tracing.is.disabled", j2EEName);
}

return new DisabledOpenTelemetryInfo();

}
Expand Down