forked from elastic/apm-agent-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into apm-agent-java/issues/2976
* main: make the Agent.activationMethod field immutable (elastic#3032) Add Activation method for telemetry on how the agent was started (elastic#2926) Unnest exceptions before filtering (elastic#3025) Use composite action for updatecli workflow (elastic#3023) # Conflicts: # CHANGELOG.asciidoc
- Loading branch information
Showing
21 changed files
with
831 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
...agent-attach/src/test/java/co/elastic/apm/attach/ExampleSelfAttachAppWithProvidedJar.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package co.elastic.apm.attach; | ||
|
||
import java.io.File; | ||
import java.lang.management.ManagementFactory; | ||
import java.util.HashMap; | ||
|
||
/** | ||
* Note this is used for integration testing by the core project, | ||
* so don't delete it without running tests there! (It's here | ||
* to avoid a cyclic dependency in the poms) | ||
*/ | ||
public class ExampleSelfAttachAppWithProvidedJar { | ||
|
||
public static void main(String[] args) throws InterruptedException { | ||
// Just sleep for 5 minutes then exit | ||
//long pid = ProcessHandle.current().pid(); //java 9+ | ||
//Use the old hack - doesn't need to be guaranteed all platforms, it's just for testing | ||
String pidHost = ManagementFactory.getRuntimeMXBean().getName(); | ||
long pid = Integer.parseInt(pidHost.substring(0,pidHost.indexOf('@'))); | ||
ElasticApmAttacher.attach(""+pid, new HashMap<String,String>(), new File(System.getProperty("ElasticApmAgent.jarfile"))); | ||
Thread.sleep(5*60*1000); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
apm-agent-common/src/main/java/co/elastic/apm/agent/configuration/ActivationMethod.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package co.elastic.apm.agent.configuration; | ||
|
||
public enum ActivationMethod { | ||
// Set explicitly by the process starting the agent | ||
K8S_ATTACH, // https://github.com/elastic/apm-mutating-webhook | ||
AWS_LAMBDA_LAYER, // Only if installed by using layers (as other metadata already identifies lambda) | ||
FLEET, // Fleet using 'java -jar apm-agent-attach-cli.jar ...' to attach (directly or through webhook) | ||
APM_AGENT_ATTACH_CLI, // 'java -jar apm-agent-attach-cli.jar ...' used | ||
PROGRAMMATIC_SELF_ATTACH, // ElasticApmAttacher.attach(); | ||
AZURE_FUNCTIONS, //? | ||
|
||
//Inferred | ||
JAVAAGENT_FLAG, // -javaagent:... command-line option used | ||
ENV_ATTACH, // JAVA_TOOL_OPTIONS env var used to specify -javaagent option | ||
|
||
UNKNOWN; | ||
|
||
public String toReferenceString() { | ||
return toString().replace('_', '-').toLowerCase(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...agent-core/src/test/java/co/elastic/apm/agent/configuration/ActivationTestExampleApp.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package co.elastic.apm.agent.configuration; | ||
|
||
public class ActivationTestExampleApp { | ||
|
||
public static void main(String[] args) throws InterruptedException { | ||
// Just sleep for 5 minutes then exit | ||
Thread.sleep(5*60*1000); | ||
} | ||
} |
Oops, something went wrong.