File tree Expand file tree Collapse file tree
src/main/java/com/example
Log4j2/src/main/java/com/example
src/main/java/com/example
SLF4J1/src/main/java/com/example
TelemetryFilteredBaseOnRequestDuration
TelemetryFilteredBaseOnSpanEvents
FilterSpanBasedOnDuration
runtime-attach/CustomLoggerPerClass Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2727 <dependency >
2828 <groupId >io.opentelemetry</groupId >
2929 <artifactId >opentelemetry-api</artifactId >
30- <version >1.48 .0</version >
30+ <version >1.49 .0</version >
3131 </dependency >
3232 <dependency >
3333 <groupId >io.opentelemetry.instrumentation</groupId >
Original file line number Diff line number Diff line change 3232 <dependency >
3333 <groupId >io.opentelemetry</groupId >
3434 <artifactId >opentelemetry-api</artifactId >
35- <version >1.48 .0</version >
35+ <version >1.49 .0</version >
3636 </dependency >
3737 </dependencies >
3838
Original file line number Diff line number Diff line change 3838 <dependency >
3939 <groupId >ch.qos.logback</groupId >
4040 <artifactId >logback-core</artifactId >
41- <version >1.5.17 </version >
41+ <version >1.5.18 </version >
4242 </dependency >
4343 <dependency >
4444 <groupId >ch.qos.logback</groupId >
4545 <artifactId >logback-classic</artifactId >
46- <version >1.5.17 </version >
46+ <version >1.5.18 </version >
4747 </dependency >
4848 </dependencies >
4949
Original file line number Diff line number Diff line change 5151 <dependency >
5252 <groupId >ch.qos.logback</groupId >
5353 <artifactId >logback-core</artifactId >
54- <version >1.5.17 </version >
54+ <version >1.5.18 </version >
5555 </dependency >
5656 <dependency >
5757 <groupId >ch.qos.logback</groupId >
5858 <artifactId >logback-classic</artifactId >
59- <version >1.5.17 </version >
59+ <version >1.5.18 </version >
6060 </dependency >
6161 <dependency >
6262 <groupId >org.junit.jupiter</groupId >
Original file line number Diff line number Diff line change 33import com .azure .monitor .opentelemetry .autoconfigure .AzureMonitorAutoConfigure ;
44
55import io .opentelemetry .api .OpenTelemetry ;
6+ import io .opentelemetry .api .common .AttributeKey ;
67import io .opentelemetry .api .trace .Span ;
78import io .opentelemetry .api .trace .SpanContext ;
89import io .opentelemetry .api .trace .TraceFlags ;
2021import java .util .Map ;
2122
2223import static io .opentelemetry .semconv .ServiceAttributes .SERVICE_NAME ;
23- import static io .opentelemetry .semconv .incubating .ServiceIncubatingAttributes .SERVICE_INSTANCE_ID ;
2424
2525public class TrackAdvancedException {
2626
2727 private static final String CONNECTION_STRING = "<Your Connection String>" ;
28+ private static final AttributeKey <String > SERVICE_INSTANCE_ID = AttributeKey .stringKey ("service.instance.id" );
29+
2830 private static final Logger log4jLogger = LogManager .getLogger (TrackAdvancedException .class );
2931
3032 public static void main (String [] args ) throws InterruptedException {
Original file line number Diff line number Diff line change 4242 <dependency >
4343 <groupId >ch.qos.logback</groupId >
4444 <artifactId >logback-core</artifactId >
45- <version >1.5.17 </version >
45+ <version >1.5.18 </version >
4646 </dependency >
4747 <dependency >
4848 <groupId >ch.qos.logback</groupId >
4949 <artifactId >logback-classic</artifactId >
50- <version >1.5.17 </version >
50+ <version >1.5.18 </version >
5151 </dependency >
5252 <dependency >
5353 <groupId >org.junit.jupiter</groupId >
Original file line number Diff line number Diff line change 5656 <dependency >
5757 <groupId >ch.qos.logback</groupId >
5858 <artifactId >logback-core</artifactId >
59- <version >1.5.17 </version >
59+ <version >1.5.18 </version >
6060 </dependency >
6161 <dependency >
6262 <groupId >ch.qos.logback</groupId >
6363 <artifactId >logback-classic</artifactId >
64- <version >1.5.17 </version >
64+ <version >1.5.18 </version >
6565 </dependency >
6666 <dependency >
6767 <groupId >org.junit.jupiter</groupId >
Original file line number Diff line number Diff line change 5757 <dependency >
5858 <groupId >ch.qos.logback</groupId >
5959 <artifactId >logback-core</artifactId >
60- <version >1.5.17 </version >
60+ <version >1.5.18 </version >
6161 </dependency >
6262 <dependency >
6363 <groupId >ch.qos.logback</groupId >
6464 <artifactId >logback-classic</artifactId >
65- <version >1.5.17 </version >
65+ <version >1.5.18 </version >
6666 </dependency >
6767 </dependencies >
6868
Original file line number Diff line number Diff line change 44
55import io .opentelemetry .api .GlobalOpenTelemetry ;
66import io .opentelemetry .api .OpenTelemetry ;
7+ import io .opentelemetry .api .common .AttributeKey ;
78import io .opentelemetry .api .trace .Span ;
89import io .opentelemetry .context .Scope ;
910import io .opentelemetry .instrumentation .log4j .appender .v2_17 .OpenTelemetryAppender ;
2021import java .util .Map ;
2122
2223import static io .opentelemetry .semconv .ServiceAttributes .SERVICE_NAME ;
23- import static io .opentelemetry .semconv .incubating .ServiceIncubatingAttributes .SERVICE_INSTANCE_ID ;
2424
2525public class TrackLog4j2 {
2626
2727 private static final String CONNECTION_STRING = "<Your Connection String>" ;
28+ private static final AttributeKey <String > SERVICE_INSTANCE_ID = AttributeKey .stringKey ("service.instance.id" );
29+
2830 private static final org .apache .logging .log4j .Logger log4jLogger = LogManager .getLogger ("log4j-logger" );
2931 private static final org .slf4j .Logger slf4j_2_Logger = LoggerFactory .getLogger (TrackLog4j2 .class );
3032
Original file line number Diff line number Diff line change 3434 <groupId >io.opentelemetry.instrumentation</groupId >
3535 <artifactId >opentelemetry-logback-appender-1.0</artifactId >
3636 </dependency >
37- <dependency >
38- <groupId >io.opentelemetry.semconv</groupId >
39- <artifactId >opentelemetry-semconv-incubating</artifactId >
40- <version >1.30.0-alpha</version >
41- </dependency >
4237 <dependency >
4338 <groupId >com.azure</groupId >
4439 <artifactId >azure-monitor-opentelemetry-autoconfigure</artifactId >
5146 <dependency >
5247 <groupId >ch.qos.logback</groupId >
5348 <artifactId >logback-core</artifactId >
54- <version >1.5.17 </version >
49+ <version >1.5.18 </version >
5550 </dependency >
5651 <dependency >
5752 <groupId >ch.qos.logback</groupId >
5853 <artifactId >logback-classic</artifactId >
59- <version >1.5.17 </version >
54+ <version >1.5.18 </version >
6055 </dependency >
6156 <dependency >
6257 <groupId >org.junit.jupiter</groupId >
You can’t perform that action at this time.
0 commit comments