Comments (8)
Ok, I found some nice skeletons in the Jaeger extensions upstream (in the java-sdk). I built my own agent by adding my own classes to your project but I cannot get the SPI TracerProviderConfiguration.configureSampler()
to pick up my SampleProvider.
spiSamplers
is length 0.
What am I missing?
public class HelloSamplerProvider implements ConfigurableSamplerProvider {
/**
* Returns a {@link Sampler} that can be registered to OpenTelemetry by providing the property
* value specified by {@link #getName()}.
*/
@Override
public Sampler createSampler(ConfigProperties config) {
return new RateLimitingSampler(1);
}
/**
* Returns the name of this sampler, which can be specified with the {@code otel.traces.sampler}
* property to enable it. The name returned should NOT be the same as any other exporter name. If
* the name does conflict with another exporter name, the resulting behavior is undefined and it
* is explicitly unspecified which exporter will actually be used.
*/
public String getName() {
return "hello";
}
}
$ jar tvf aws-opentelemetry-agent-1.2.0-SNAPSHOT.jar |grep HelloSampler
913 Sun May 16 01:25:18 CEST 2021 inst/software/amazon/opentelemetry/javaagent/providers/HelloSamplerProvider.classdata
from aws-otel-java-instrumentation.
I will continue trying rolling my own agent for now, as the current one doesnt work for us... Is the plan to support X-Ray sampling rules any time soon? Ping @anuraaga
from aws-otel-java-instrumentation.
OpenJDK 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
***class software.amazon.opentelemetry.javaagent.bootstrap.HelloSamplerProvider <----- printing the classname from agentmain
OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended
[opentelemetry.auto.trace 2021-05-16 10:33:07:973 +0200] [main] INFO io.opentelemetry.javaagent.tooling.VersionLogger - opentelemetry-javaagent - version: 1.2.0-aws-SNAPSHOT
ERROR io.opentelemetry.javaagent.OpenTelemetryAgent
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at io.opentelemetry.javaagent.OpenTelemetryAgent.agentmain(OpenTelemetryAgent.java:64)
at software.amazon.opentelemetry.javaagent.bootstrap.AwsAgentBootstrap.agentmain(AwsAgentBootstrap.java:29)
at software.amazon.opentelemetry.javaagent.bootstrap.AwsAgentBootstrap.premain(AwsAgentBootstrap.java:24)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:513)
at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:525)
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at io.opentelemetry.javaagent.bootstrap.AgentInitializer.startAgent(AgentInitializer.java:44)
at io.opentelemetry.javaagent.bootstrap.AgentInitializer.initialize(AgentInitializer.java:30)
... 13 more
Caused by: io.opentelemetry.sdk.autoconfigure.ConfigurationException: Unrecognized value for otel.traces.sampler: hello
What am I missing?
from aws-otel-java-instrumentation.
Hi @stnor
For the issue of the agent, I didn't confirm myself but believe the problem is putting the code in the otelagent
folder, you should put it in the awsagentprovider
folder. otelagent
is just the initialization of the agent, which creates a separate ClassLoader
with the actual SDK, and that includes what's in awsagentprovider
. That is controlled by this line
https://github.com/stnor/aws-otel-java-instrumentation/blob/main/otelagent/build.gradle.kts#L58
As for sampling in general, its indeed an area OTel still needs to spec out much better. Out of curiosity, can you clarify your priority of these aspects
- Rate limiting, leaky bucket sampler to allow full sampling for lower QPS services, as opposed to random sampling which is always random
- Per-operation sampling where different HTTP paths for example have different sampling properties
- Remote sampling configuration, where you can update properties on a server and have that automatically reflected on running servers without restart
We will want to get some issues filed in opentelemetry-specification
based on what can help and the priorities. In the meantime, I think you having full control by writing a Sampler
is a good idea and hopefully my suggestion unblocks you. Having some real code based on what works well for you will help frame discussions in the spec even better.
from aws-otel-java-instrumentation.
Ah also just noticed the repo you linked seems to be missing the META-INF/services
file to register the sampler provider as an SPI implementation.
from aws-otel-java-instrumentation.
Hi @anuraaga
Thanks for the feedback, and for taking the time to look at this. I will revisit the code later today.
As for my priorities; Remote sampling configuration is not important at all. The ability to change configuration in runtime isn't important for us ever.
Per operation-configuration is my top prio as things stand, but I think that wouldn't be needed (I think) if the sampler would try to meet a budget with a lower and upper bound of traces per time unit per operation automatically. But I am not a statistician.
AppDynamics keeps track of typical invocation response times per operation and samples (more) based on deviations, which is very useful, https://docs.appdynamics.com/display/PRO21/Diagnostic+Sessions
from aws-otel-java-instrumentation.
Got the sampler registration to work now. Thanks. Did a reset, and created a new branch for this work in my fork. https://github.com/stnor/aws-otel-java-instrumentation/tree/nomp-sampler
from aws-otel-java-instrumentation.
I will try this simple hack to start with. When testing my code, I realised I should be using a parent based sampler.
https://github.com/stnor/aws-otel-java-instrumentation/blob/nomp-sampler/awsagentprovider/src/main/java/se/nomp/instrumentation/otel/providers/NompParentBasedSampler.java
from aws-otel-java-instrumentation.
Related Issues (20)
- Lack of a docker image HOT 3
- OTEL trace id mismatches with XRay trace id HOT 5
- Visual presentation and Resource Detection for eks HOT 4
- How to suppress export logs in open-telemetry agent? HOT 4
- Update actions to not use Node.js 12 HOT 1
- Logback MDC `AWS-XRAY-TRACE-ID` and `trace_id` mismatch sporadically HOT 9
- AWS Lambda: Unable to debug the issue HOT 1
- xray tracing stops after some hours HOT 7
- Does the xray remote sampler respect parent sampling decision? HOT 4
- FRAME_SIZE_ERROR: 4740180 HOT 2
- Using more than one tracing systems with AWS Java Agent #2333 HOT 2
- Upgrade opentelemetry-java to 1.30.x HOT 1
- AwsXrayPropagator can create invalid trace headers during baggage propagation HOT 8
- AWS OTEL agents in Docker images HOT 3
- [ci] Add new EKS cluster targets HOT 1
- Support for OTEL Synchronous Gauge HOT 2
- http.server.duration has exceeded the maximum allowed cardinality HOT 3
- ADOT Java Agent v1.31.1 - High Cardinality Metrics
- Java autoinstrumentation does not support PKIX algorithm
- Clarification about how to autoinstrumenting a spring-boot 3 with micrometer tracing and ADOT agent
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aws-otel-java-instrumentation.