Skip to content

Commit db75d66

Browse files
Update upstream OpenTelemetry agent dependencies to 2.24.0 (elastic#932)
* chore: Update upstream OpenTelemetry agent version and related depend... ... encies Made with ❤️️ by updatecli * Update ElasticLoggingCustomizer.java * spotless --------- Co-authored-by: elastic-observability-automation[bot] <180520183+elastic-observability-automation[bot]@users.noreply.github.com> Co-authored-by: jackshirazi <[email protected]>
1 parent 19af42e commit db75d66

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ opentelemetryProto = "1.3.2-alpha"
1111

1212
# otel agent, we rely on the '*-alpha' and get the non-alpha dependencies transitively
1313
# updated from upstream agent with gradle/update-upstream.sh
14-
opentelemetryJavaagentAlpha = "2.23.0-alpha"
14+
opentelemetryJavaagentAlpha = "2.24.0-alpha"
1515

1616
# otel contrib
1717
# updated from upstream agent with gradle/update-upstream.sh

internal-logging/src/main/java/co/elastic/otel/logging/ElasticLoggingCustomizer.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,29 +36,40 @@ public String name() {
3636
}
3737

3838
@Override
39-
public void init(EarlyInitAgentConfig earlyConfig) {
39+
public void init() {
40+
EarlyInitAgentConfig earlyConfig = EarlyInitAgentConfig.get();
4041

4142
// trigger loading the slf4j provider from the agent CL, this should load log4j implementation
4243
LoggerFactory.getILoggerFactory();
4344

4445
// make the agent internal logger delegate to slf4j, which will delegate to log4j
4546
InternalLogger.initialize(Slf4jInternalLogger::create);
4647

47-
boolean upstreamDebugEnabled = earlyConfig.getBoolean(AgentLog.OTEL_JAVAAGENT_DEBUG, false);
48+
boolean upstreamDebugEnabled = earlyConfig.isDebug();
4849
Level level;
4950
if (upstreamDebugEnabled) {
5051
// set debug logging when enabled through configuration to behave like the upstream
5152
// distribution
5253
level = Level.DEBUG;
5354
} else {
5455
level =
55-
Optional.ofNullable(earlyConfig.getString("elastic.otel.javaagent.log.level"))
56+
// TODO the getString() became private but might become public again, at which time revert
57+
// Optional.ofNullable(earlyConfig.getString("elastic.otel.javaagent.log.level"))
58+
Optional.ofNullable(getEarlyConfigString("elastic.otel.javaagent.log.level"))
5659
.map(Level::getLevel)
5760
.orElse(Level.INFO);
5861
}
5962
AgentLog.init(upstreamDebugEnabled, level);
6063
}
6164

65+
private static String getEarlyConfigString(String key) {
66+
String value = System.getProperty(key);
67+
if (value == null) {
68+
value = System.getenv(key.replace('.', '_').toUpperCase());
69+
}
70+
return value;
71+
}
72+
6273
@Override
6374
public void onStartupSuccess() {
6475
Slf4jInternalLogger.setInitializationComplete();

0 commit comments

Comments
 (0)