Skip to content

Instantly share code, notes, and snippets.

View breedx-splk's full-sized avatar
🤘

jason plumb breedx-splk

🤘
View GitHub Profile
@breedx-splk
breedx-splk / gist:2c5e1fff1d0d2337c4775d934a6ec7bb
Created January 7, 2021 01:18
All of the static imports in the instrumentation project
$ find . -name '*.java' | xargs grep -h 'import static' | sort | uniq
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.StandardSystemProperty.JAVA_CLASS_PATH;
import static com.google.common.base.StandardSystemProperty.PATH_SEPARATOR;
import static com.google.common.util.concurrent.MoreExecutors.directExecutor;
import static com.lambdaworks.redis.protocol.CommandKeyword.SEGFAULT;
import static com.lambdaworks.redis.protocol.CommandType.DEBUG;
import static com.lambdaworks.redis.protocol.CommandType.SHUTDOWN;
import static io.grpc.MethodDescriptor.generateFullMethodName;
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.sdk.trace;
import io.opentelemetry.sdk.common.Clock;
import io.opentelemetry.sdk.common.CompletableResultCode;
import io.opentelemetry.sdk.resources.Resource;
@breedx-splk
breedx-splk / gist:6c962a28815f71f158031a7e7c349427
Created July 30, 2021 16:43
diff main vs branch jar content
$ diff /tmp/main.txt /tmp/new.txt
585d584
< com/splunk/opentelemetry/SplunkAgent.class
586a586
> com/splunk/opentelemetry/javaagent/SplunkAgent.class
816a817
> inst/META-INF/services/
16782,16869d16782
< inst/io/opentelemetry/javaagent/shaded/io/opentelemetry/api/metrics/
< inst/io/opentelemetry/javaagent/shaded/io/opentelemetry/api/metrics/AsynchronousInstrument$DoubleResult.classdata
@breedx-splk
breedx-splk / gist:e83a0ed816130ef37ea92dc3ff302e62
Created July 1, 2022 16:29
opentelemetry-spring-starter ClassNotFoundException
java.lang.IllegalStateException: Failed to introspect Class [io.opentelemetry.instrumentation.spring.autoconfigure.resources.OtelResourceAutoConfiguration] from ClassLoader [jdk.internal.loader.ClassLoaders$AppClassLoader@2c13da15]
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:485) ~[spring-core-5.3.20.jar:5.3.20]
at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:361) ~[spring-core-5.3.20.jar:5.3.20]
at org.springframework.util.ReflectionUtils.getUniqueDeclaredMethods(ReflectionUtils.java:418) ~[spring-core-5.3.20.jar:5.3.20]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.lambda$getTypeForFactoryMethod$2(AbstractAutowireCapableBeanFactory.java:765) ~[spring-beans-5.3.20.jar:5.3.20]
at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1737) ~[na:na]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod(AbstractAutowireC
@breedx-splk
breedx-splk / HttpUrlConnectionCheck.java
Last active November 15, 2023 21:54
In another window, run `nc -l 8000` (mac) or `nc -l -p 8000` (linux) to listen on port 8000. Then run this class with the otel java agent.
package io.opentelemetry.javaagent;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import static java.nio.charset.StandardCharsets.UTF_8;
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.instrumentation.library.httpurlconnection;
import static io.opentelemetry.instrumentation.library.httpurlconnection.internal.HttpUrlConnectionSingletons.instrumenter;
import io.opentelemetry.api.GlobalOpenTelemetry;
@Test
void sharedCompletableFuture() throws Exception {
Supplier<String> longTokenFetchProcess = () ->
testing.runWithSpan("tokenFetch", () -> {
try {
Thread.sleep(5000L);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new RuntimeException(e);

This is an attempt to summarize some of the discussion from last Friday's Event WG meeting and to argue for the existence of metadata and for keeping it separate. It also provides a set of possible design choices for how to model events.

Event model

Background

We know that events will be implemented with logs as the transport. That's decided and for the purposes of this discussion is purely an implementation detail.

Events are a wad of information about something that happened at a point in time. The core content of an event is usually structured and is presented in a certain shape. We can call this shape a data model.

@breedx-splk
breedx-splk / gist:687a0c756ce980f802128b9b0c201afe
Created February 22, 2024 00:54
Otel trivia question answer!
Content-Type: application/x-protobuf
@Test
void testThing(){
// You probably want to do this in setup?
OpenTelemetry otel = OpenTelemetrySdk.builder().build();
SpanBuilder builder = otel.getTracer("foo")
.spanBuilder("span");
Span span = builder.startSpan();
try (Scope scope = span.makeCurrent()) {