Skip to content

Commit

Permalink
(#9297)
Browse files Browse the repository at this point in the history
- use compile dependency on `:javaagent-bootstrap` and do runtime check before use.
  • Loading branch information
cleverchuk committed Oct 16, 2023
1 parent 7683547 commit 1f02dc6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
base.archivesName.set("${base.archivesName.get()}-autoconfigure")

dependencies {
implementation(project(":javaagent-bootstrap"))
compileOnly(project(":javaagent-bootstrap"))
library("org.apache.logging.log4j:log4j-core:2.17.0")

testImplementation(project(":instrumentation:log4j:log4j-context-data:log4j-context-data-common:testing"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,14 @@ public Map<String, String> supplyContextData() {
contextData.put(TRACE_ID, spanContext.getTraceId());
contextData.put(SPAN_ID, spanContext.getSpanId());
contextData.put(TRACE_FLAGS, spanContext.getTraceFlags().asHex());
contextData.putAll(ConfiguredResourceAttributesHolder.getResourceAttributes());

try {
Class.forName("io.opentelemetry.javaagent.bootstrap.ConfiguredResourceAttributesHolder");
contextData.putAll(ConfiguredResourceAttributesHolder.getResourceAttributes());
} catch (ClassNotFoundException ok) {
// this probably shouldn't happen, however if it does happen, we don't care.
}


if (BAGGAGE_ENABLED) {
Baggage baggage = Baggage.fromContext(context);
Expand Down

0 comments on commit 1f02dc6

Please sign in to comment.