-
Notifications
You must be signed in to change notification settings - Fork 347
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Using Metrics 2.0.0. Updated HTTP Monitoring to use a YAML config. Ke…
…eping separate samples for Metrics and HTTP Monitoring
- Loading branch information
1 parent
5c79ae6
commit 16464d5
Showing
41 changed files
with
573 additions
and
820 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
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
54 changes: 0 additions & 54 deletions
54
...lytics/src/main/java/org/wso2/msf4j/analytics/httpmonitoring/HTTPMonitoringComponent.java
This file was deleted.
Oops, something went wrong.
82 changes: 82 additions & 0 deletions
82
...analytics/src/main/java/org/wso2/msf4j/analytics/httpmonitoring/HTTPMonitoringConfig.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,82 @@ | ||
/* | ||
* Copyright (c) 2016, WSO2 Inc. (http://wso2.com) All Rights Reserved. | ||
* | ||
* Licensed 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 org.wso2.msf4j.analytics.httpmonitoring; | ||
|
||
/** | ||
* Configuration for HTTP Monitoring | ||
*/ | ||
public class HTTPMonitoringConfig { | ||
|
||
private String type = "thrift"; | ||
|
||
private String receiverURL = "tcp://localhost:7611"; | ||
|
||
private String authURL; | ||
|
||
private String username = "admin"; | ||
|
||
private String password = "admin"; | ||
|
||
private String dataAgentConfigPath = null; | ||
|
||
public String getType() { | ||
return type; | ||
} | ||
|
||
public void setType(String type) { | ||
this.type = type; | ||
} | ||
|
||
public String getReceiverURL() { | ||
return receiverURL; | ||
} | ||
|
||
public void setReceiverURL(String receiverURL) { | ||
this.receiverURL = receiverURL; | ||
} | ||
|
||
public String getAuthURL() { | ||
return authURL; | ||
} | ||
|
||
public void setAuthURL(String authURL) { | ||
this.authURL = authURL; | ||
} | ||
|
||
public String getUsername() { | ||
return username; | ||
} | ||
|
||
public void setUsername(String username) { | ||
this.username = username; | ||
} | ||
|
||
public String getPassword() { | ||
return password; | ||
} | ||
|
||
public void setPassword(String password) { | ||
this.password = password; | ||
} | ||
|
||
public String getDataAgentConfigPath() { | ||
return dataAgentConfigPath; | ||
} | ||
|
||
public void setDataAgentConfigPath(String dataAgentConfigPath) { | ||
this.dataAgentConfigPath = dataAgentConfigPath; | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
...cs/src/main/java/org/wso2/msf4j/analytics/httpmonitoring/HTTPMonitoringConfigBuilder.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,42 @@ | ||
/* | ||
* Copyright (c) 2016, WSO2 Inc. (http://wso2.com) All Rights Reserved. | ||
* | ||
* Licensed 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 org.wso2.msf4j.analytics.httpmonitoring; | ||
|
||
import org.wso2.carbon.metrics.core.utils.Utils; | ||
import org.yaml.snakeyaml.Yaml; | ||
|
||
import java.util.Optional; | ||
|
||
/** | ||
* Build {@link HTTPMonitoringConfig} from the YAML file | ||
*/ | ||
public final class HTTPMonitoringConfigBuilder { | ||
|
||
public static HTTPMonitoringConfig build() { | ||
Optional<String> metricsConfigFileContent = Utils.readFile("httpmonitoring.conf", "httpmonitoring.yml"); | ||
if (metricsConfigFileContent.isPresent()) { | ||
try { | ||
Yaml yaml = new Yaml(); | ||
return yaml.loadAs(metricsConfigFileContent.get(), HTTPMonitoringConfig.class); | ||
} catch (RuntimeException e) { | ||
throw new RuntimeException("Failed to populate HTTP Monitoring Configuration", e); | ||
} | ||
} else { | ||
return new HTTPMonitoringConfig(); | ||
} | ||
} | ||
|
||
} |
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
Oops, something went wrong.