Giter VIP home page Giter VIP logo

aws-codeguru-profiler-demo-application's People

Contributors

amazon-auto avatar dependabot[bot] avatar gimki avatar ivoanjo avatar martinschaef avatar mirelap-amazon avatar olivergillespie avatar pandpara avatar rednes avatar tfcerda avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

aws-codeguru-profiler-demo-application's Issues

The security token included in the request is invalid.

When I run command java -javaagent:codeguru-profiler-java-agent-standalone-1.1.1.jar -jar target/DemoApplication-1.0-jar-with-dependencies.jar without-issues got below errors, anyone can help here? Thanks.

INFO: Exception while calling agent orchestration.
codegurushadow.software.amazon.awssdk.services.codeguruprofiler.model.CodeGuruProfilerException: The security token included in the request is invalid. (Service: CodeGuruProfiler, Status Code: 403, Request ID: 18e11672-1b76-434e-92a5-f52f823645b1, Extended Request ID: null)
at codegurushadow.software.amazon.awssdk.core.internal.http.CombinedResponseHandler.handleErrorResponse(CombinedResponseHandler.java:123)
at codegurushadow.software.amazon.awssdk.core.internal.http.CombinedResponseHandler.handleResponse(CombinedResponseHandler.java:79)
at codegurushadow.software.amazon.awssdk.core.internal.http.CombinedResponseHandler.handle(CombinedResponseHandler.java:59)
at codegurushadow.software.amazon.awssdk.core.internal.http.CombinedResponseHandler.handle(CombinedResponseHandler.java:40)
at codegurushadow.software.amazon.awssdk.core.internal.http.pipeline.stages.HandleResponseStage.execute(HandleResponseStage.java:40)
at codegurushadow.software.amazon.awssdk.core.internal.http.pipeline.stages.HandleResponseStage.execute(HandleResponseStage.java:30)
at codegurushadow.software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:206)
at codegurushadow.software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallAttemptTimeoutTrackingStage.execute(ApiCallAttemptTimeoutTrackingStage.java:73)
at codegurushadow.software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallAttemptTimeoutTrackingStage.execute(ApiCallAttemptTimeoutTrackingStage.java:42)
at codegurushadow.software.amazon.awssdk.core.internal.http.pipeline.stages.TimeoutExceptionHandlingStage.execute(TimeoutExceptionHandlingStage.java:77)
at codegurushadow.software.amazon.awssdk.core.internal.http.pipeline.stages.TimeoutExceptionHandlingStage.execute(TimeoutExceptionHandlingStage.java:39)
at codegurushadow.software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallAttemptMetricCollectionStage.execute(ApiCallAttemptMetricCollectionStage.java:50)
at codegurushadow.software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallAttemptMetricCollectionStage.execute(ApiCallAttemptMetricCollectionStage.java:36)
at codegurushadow.software.amazon.awssdk.core.internal.http.pipeline.stages.RetryableStage.execute(RetryableStage.java:64)
at codegurushadow.software.amazon.awssdk.core.internal.http.pipeline.stages.RetryableStage.execute(RetryableStage.java:34)
at codegurushadow.software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:206)
at codegurushadow.software.amazon.awssdk.core.internal.http.StreamManagingStage.execute(StreamManagingStage.java:56)
at codegurushadow.software.amazon.awssdk.core.internal.http.StreamManagingStage.execute(StreamManagingStage.java:36)
at codegurushadow.software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallTimeoutTrackingStage.executeWithTimer(ApiCallTimeoutTrackingStage.java:80)
at codegurushadow.software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallTimeoutTrackingStage.execute(ApiCallTimeoutTrackingStage.java:60)
at codegurushadow.software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallTimeoutTrackingStage.execute(ApiCallTimeoutTrackingStage.java:42)
at codegurushadow.software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallMetricCollectionStage.execute(ApiCallMetricCollectionStage.java:48)
at codegurushadow.software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallMetricCollectionStage.execute(ApiCallMetricCollectionStage.java:31)
at codegurushadow.software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:206)
at codegurushadow.software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:206)
at codegurushadow.software.amazon.awssdk.core.internal.http.pipeline.stages.ExecutionFailureExceptionReportingStage.execute(ExecutionFailureExceptionReportingStage.java:37)
at codegurushadow.software.amazon.awssdk.core.internal.http.pipeline.stages.ExecutionFailureExceptionReportingStage.execute(ExecutionFailureExceptionReportingStage.java:26)
at codegurushadow.software.amazon.awssdk.core.internal.http.AmazonSyncHttpClient$RequestExecutionBuilderImpl.execute(AmazonSyncHttpClient.java:193)
at codegurushadow.software.amazon.awssdk.core.internal.handler.BaseSyncClientHandler.invoke(BaseSyncClientHandler.java:133)
at codegurushadow.software.amazon.awssdk.core.internal.handler.BaseSyncClientHandler.doExecute(BaseSyncClientHandler.java:159)
at codegurushadow.software.amazon.awssdk.core.internal.handler.BaseSyncClientHandler.lambda$execute$1(BaseSyncClientHandler.java:112)
at codegurushadow.software.amazon.awssdk.core.internal.handler.BaseSyncClientHandler.measureApiCallSuccess(BaseSyncClientHandler.java:167)
at codegurushadow.software.amazon.awssdk.core.internal.handler.BaseSyncClientHandler.execute(BaseSyncClientHandler.java:94)
at codegurushadow.software.amazon.awssdk.core.client.handler.SdkSyncClientHandler.execute(SdkSyncClientHandler.java:45)
at codegurushadow.software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler.execute(AwsSyncClientHandler.java:55)
at codegurushadow.software.amazon.awssdk.services.codeguruprofiler.DefaultCodeGuruProfilerClient.configureAgent(DefaultCodeGuruProfilerClient.java:324)
at codegurushadow.software.amazon.codeguruprofilerjavaagent.CodeGuruProfilerSDKClient.configureAgent(CodeGuruProfilerSDKClient.java:91)
at codegurushadow.software.amazon.codeguruprofilerjavaagent.CodeGuruProfilerSDKClient.configureAgent(CodeGuruProfilerSDKClient.java:76)
at codegurushadow.software.amazon.codeguruprofilerjavaagent.ProfilingCommand.callConfigureAgent(ProfilingCommand.java:178)
at codegurushadow.software.amazon.codeguruprofilerjavaagent.ProfilingCommand.refreshConfiguration(ProfilingCommand.java:194)
at codegurushadow.software.amazon.codeguruprofilerjavaagent.ProfilingCommand.startSampling(ProfilingCommand.java:138)
at codegurushadow.software.amazon.codeguruprofilerjavaagent.Timer.time(Timer.java:69)
at codegurushadow.software.amazon.codeguruprofilerjavaagent.ProfilingCommandExecutor.run(ProfilingCommandExecutor.java:78)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

Jun 21, 2021 9:06:44 AM codegurushadow.software.amazon.codeguruprofilerjavaagent.ProfilingCommand notifyFailedAgentConfig
INFO: Could not get new configuration. Using the previous one:
com

codeguru-profiler-java-agent no module name, etc.

The following dependency:

            <groupId>com.amazonaws</groupId>
            <artifactId>codeguru-profiler-java-agent</artifactId>
            <version>1.0.1</version>

Does not seem to provide a JPMS module name. Even if it is not a full-fledged module, it should provide a fallback module name.
By the way, is the codeguru-profiler-java-agent open source? I can't seem to find it.

It's also somewhat strange that it is not on Maven Central (need to use a somewhat obscure looking cloudfront repository).

Sorry if this is the wrong place for such an issue.

Dependency Version Convergence Error

When including codeguru-profiler-java-agent a dependency convergence error occurs (as caught by the dependencyConvergence rule of maven enforcer, for example):

+-MY_PROJECT
  +-software.amazon.codeguruprofiler:codeguru-profiler-java-agent:1.1.2
    +-software.amazon.awssdk:codeguruprofiler:2.15.4
      +-software.amazon.awssdk:netty-nio-client:2.15.4
        +-io.netty:netty-codec-http2:4.1.46.Final
          +-io.netty:netty-handler:4.1.46.Final
and
+-MY_PROJECT
  +-software.amazon.codeguruprofiler:codeguru-profiler-java-agent:1.1.2
    +-software.amazon.awssdk:codeguruprofiler:2.15.4
      +-software.amazon.awssdk:netty-nio-client:2.15.4
        +-io.netty:netty-handler:4.1.46.Final
and
+-MY_PROJECT
  +-software.amazon.codeguruprofiler:codeguru-profiler-java-agent:1.1.2
    +-software.amazon.awssdk:codeguruprofiler:2.15.4
      +-software.amazon.awssdk:netty-nio-client:2.15.4
        +-com.typesafe.netty:netty-reactive-streams-http:2.0.4
          +-com.typesafe.netty:netty-reactive-streams:2.0.4
            +-io.netty:netty-handler:4.1.43.Final

As you can see both 4.1.46.Final and 4.1.43.Final are both resolved by dependencies purely of codeguru-profiler-java-agent. It is possible to fix this by updating netty-reactive-streams-http to a later version that include 4.1.46.Final or by manually excluding dependencies.

codeguru-profiler-java-agent profiler choice?

In decompiled codeguru-profiler-java-agent I see that there are two methods to use for collecting profiling data. Namely JMX and the new Java Flight Recorder Consumer API. Are both used always or is it possible to select between them? It seems that JMX requires com.sun.management module and in newer JDKs I am getting a module not found error - so being able to disable JMX and only use the jdk.jfr.consumer profiler would be ideal.

For reference, here is the error I am getting when trying to run codeguru-profiler-java-agent on AWS lambda with Java 14:

Caused by: java.lang.NoClassDefFoundError: com/sun/management/OperatingSystemMXBean
at software.amazon.codeguruprofilerjavaagent.CpuTimeMonitor.<init>(CPUTimeMonitor.kt:7)
at software.amazon.codeguruprofilerjavaagent.CpuTimeMonitor.<init>(CPUTimeMonitor.kt)
at software.amazon.codeguruprofilerjavaagent.ProfilingCommand.<init>(ProfilingCommand.java:88)
at software.amazon.codeguruprofilerjavaagent.ProfilingCommandWithPause.<init>(ProfilingCommandWithPause.java:56)
at software.amazon.codeguruprofilerjavaagent.ProfilerWithPause.createNewProfilingCommand(ProfilerWithPause.java:251)
at software.amazon.codeguruprofilerjavaagent.ProfilerWithPause.lambda$start$0(ProfilerWithPause.java:204)
at software.amazon.codeguruprofilerjavaagent.Profiler.startWithProfilingCommand(Profiler.java:247)
at software.amazon.codeguruprofilerjavaagent.ProfilerWithPause.startWithProfilingCommand(ProfilerWithPause.java:257)
at software.amazon.codeguruprofilerjavaagent.ProfilerWithPause.start(ProfilerWithPause.java:202)
at software.amazon.codeguruprofilerjavaagent.ProfilerWithPause.resume(ProfilerWithPause.java:234)
at software.amazon.codeguruprofilerjavaagent.LambdaProfiler.resumeProfiler(LambdaProfiler.java:169)
at software.amazon.codeguruprofilerjavaagent.LambdaProfiler.profile(LambdaProfiler.java:71)
at RequestHandler.handleRequest(RequestHandler.java:243)
... 6 more
Caused by: java.lang.ClassNotFoundException: com.sun.management.OperatingSystemMXBean
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:435)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
at java.base/java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java:855)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) 

Codeguru Profiler Fails with Custom Java Runtime?

I am getting the following sequence of log messages when attempting to run CodeGuru on my custom java runtime which can be found here: https://github.com/brcolow/lambda-java-runtime

START RequestId: 65e66e2e-3e90-4a6f-8900-79faef4cc681 Version: $LATEST 
Apr 03, 2021 9:11:32 PM software.amazon.codeguruprofilerjavaagent.LambdaProfilerUtils attemptToCreateProfiler 
INFO: CodeGuru profiling group: as2 in AWS region: us-west-2 will be used for profiling your lambda function 
Apr 03, 2021 9:11:34 PM software.amazon.codeguruprofilerjavaagent.Profiler startWithProfilingCommand 
INFO: Starting the profiler : Profiler{profilingGroupName=as2, isRunning=false, isProfiling=false} 
Apr 03, 2021 9:11:34 PM software.amazon.codeguruprofilerjavaagent.ProfilingCommandExecutor scheduleProfiling 
INFO: Profiling scheduled, sampling rate is PT1S 
Apr 03, 2021 9:11:35 PM software.amazon.codeguruprofilerjavaagent.ProfilingCommandWithPause isFleetTypeIncorrect
INFO: CodeGuru Profiler agent was found to be running on a compute platform other than AWS Lambda. Profiling will be terminated. Please refer to CodeGuru Profiler's documentation to learn more about how to profile AWS Lambda functions
Apr 03, 2021 9:11:35 PM software.amazon.codeguruprofilerjavaagent.ProfilingCommand flush
INFO: Dropping the profile as it could not be reported 

It is running on AWS Lambda and I have the two environment variables properly set, and the permissions set to the same thing as the lambda's execution role.

I am invoking the profiler as follows:

public void handleRequest(InputStream input, OutputStream output, TestContext context) throws IOException {
                response = LambdaProfiler.profile(input, null, (i, o) -> {
                    return handleInboundMessage(new HttpEvent(event.getHttpMethod(),
                            headers, base64EncodedBodyOptional.get(), event.getPath()), context);
                });
}

I have found the error in the source code, but I have no idea what FleetInfo is or how it is set:

protected boolean isFleetTypeIncorrect() {
        FleetInstanceType fleetType = (FleetInstanceType)this.profilerFinalParameters.getAgentMetadata().getFleetInfo().map(FleetInfo::getFleetInstanceType).orElse(FleetInstanceType.Unknown);
        if (!FleetInstanceType.AWSLambda.equals(fleetType)) {
            LOG.info("CodeGuru Profiler agent was found to be running on a compute platform other than AWS Lambda. Profiling will be terminated. Please refer to CodeGuru Profiler's documentation to learn more about how to profile AWS Lambda functions");
            return true;
        } else {
            return false;
        }
}

I wonder if maybe it is because of the AWS_EXECUTION_ENV variable being different on a custom runtime (i.e. provided versus java11 - though not sure why codeguru-profiler-java-agent is checking that).

Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.