Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow the troubleshooting commands to use the IPC endpoint #171

Merged
merged 1 commit into from
Apr 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changes
=======

# 0.20.0 / Unreleased

### Changes

* [FEATURE] Configs can now be given to jmxfetch using the https endpoint when running list_* troubleshooting commands. See [#171][].

# 0.19.0 / 03/19/2018

### Changes
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/org/datadog/jmxfetch/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ public static void main(String[] args) {

App app = new App(config);

// Get config from the ipc endpoint for "list_*" actions
if (!config.getAction().equals(AppConfig.ACTION_COLLECT)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if this might break stuff on agent5? Can you verify? Maybe we should add a flag to enable this behavior?

Copy link
Member Author

@arbll arbll Apr 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should not since the A5 does not give the IPC config parameters.

if (this.client == null) {

if (appConfig.remoteEnabled()) {
client = new HttpClient(appConfig.getIPCHost(), appConfig.getIPCPort(), false);
}

public boolean remoteEnabled() {
return (ipcHost != null && ipcPort > 0);
}

^ getJSONConfigs is a no-op in A5

app.getJSONConfigs();
}

// Initiate JMX Connections, get attributes that match the yaml configuration
app.init(false);

Expand Down Expand Up @@ -624,8 +629,6 @@ public void init(boolean forceNewConnection) {
clearInstances(instances);
clearInstances(brokenInstances);

Reporter reporter = appConfig.getReporter();

Iterator<Entry<String, YamlParser>> it = configs.entrySet().iterator();
Iterator<Entry<String, YamlParser>> itSD = adPipeConfigs.entrySet().iterator();
while (it.hasNext() || itSD.hasNext()) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/datadog/jmxfetch/HttpClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public HttpResponse request(String method, String body, String path) {
con.setRequestMethod(method.toUpperCase());
con.setRequestProperty("Authorization", "Bearer "+ this.token);
con.setRequestProperty("User-Agent", USER_AGENT);
if (method.toUpperCase() == "GET") {
if (method.toUpperCase().equals("GET")) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🍪

con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
} else {
con.setRequestProperty("Content-Type", "application/json");
Expand Down