forked from spinnaker/halyard
-
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.
feat(monitoring): add new relic monitoring daemon config (spinnaker#1442
) * feat(canary): add new relic monitoring daemon config * feat(monitoring): replace short description for metric store commands s/authentication method/metric store
- Loading branch information
Showing
9 changed files
with
261 additions
and
9 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
76 changes: 76 additions & 0 deletions
76
...ix/spinnaker/halyard/cli/command/v1/config/metricStores/newrelic/EditNewrelicCommand.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,76 @@ | ||
/* | ||
* Copyright 2019 New Relic Corporation. 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 com.netflix.spinnaker.halyard.cli.command.v1.config.metricStores.newrelic; | ||
|
||
import com.beust.jcommander.Parameter; | ||
import com.beust.jcommander.Parameters; | ||
import com.netflix.spinnaker.halyard.cli.command.v1.config.metricStores.AbstractEditMetricStoreCommand; | ||
import com.netflix.spinnaker.halyard.config.model.v1.metricStores.newrelic.NewrelicStore; | ||
import com.netflix.spinnaker.halyard.config.model.v1.node.MetricStore; | ||
import com.netflix.spinnaker.halyard.config.model.v1.node.MetricStores; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Parameters(separators = "=") | ||
public class EditNewrelicCommand extends AbstractEditMetricStoreCommand<NewrelicStore> { | ||
public MetricStores.MetricStoreType getMetricStoreType() { | ||
return MetricStores.MetricStoreType.NEWRELIC; | ||
} | ||
|
||
@Parameter(names = "--insert-key", description = "Your New Relic Insights insert key") | ||
private String insertKey; | ||
|
||
@Parameter( | ||
names = "--host", | ||
description = | ||
"The URL to post metric data to. In almost all cases, this is set correctly by default and should not be used.") | ||
private String host; | ||
|
||
@Parameter( | ||
names = "--tags", | ||
variableArity = true, | ||
description = | ||
"Your custom tags. Please delimit the KVP with colons i.e. --tags app:test env:dev") | ||
private List<String> tags = new ArrayList<>(); | ||
|
||
@Parameter( | ||
names = "--add-tag", | ||
description = | ||
"Add this tag to the list of tags. Use the format key:value i.e. --add-tag app:test") | ||
private String addTag; | ||
|
||
@Parameter( | ||
names = "--remove-tag", | ||
description = | ||
"Remove this tag from the list of tags. Use the name of the tag you want to remove i.e. --remove-tag app") | ||
private String removeTag; | ||
|
||
@Override | ||
protected MetricStore editMetricStore(NewrelicStore newrelicStore) { | ||
newrelicStore.setInsertKey(isSet(insertKey) ? insertKey : newrelicStore.getInsertKey()); | ||
newrelicStore.setHost(isSet(host) ? host : newrelicStore.getHost()); | ||
|
||
try { | ||
newrelicStore.setTags(updateStringList(newrelicStore.getTags(), tags, addTag, removeTag)); | ||
} catch (IllegalArgumentException e) { | ||
throw new IllegalArgumentException("Set either --tags or --[add/remove]-tag"); | ||
} | ||
|
||
return newrelicStore; | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...etflix/spinnaker/halyard/cli/command/v1/config/metricStores/newrelic/NewrelicCommand.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,34 @@ | ||
/* | ||
* Copyright 2019 New Relic Corporation. 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 com.netflix.spinnaker.halyard.cli.command.v1.config.metricStores.newrelic; | ||
|
||
import com.beust.jcommander.Parameters; | ||
import com.netflix.spinnaker.halyard.cli.command.v1.config.metricStores.MetricStoreCommand; | ||
import com.netflix.spinnaker.halyard.config.model.v1.node.MetricStores; | ||
|
||
@Parameters(separators = "=") | ||
public class NewrelicCommand extends MetricStoreCommand { | ||
public MetricStores.MetricStoreType getMetricStoreType() { | ||
return MetricStores.MetricStoreType.NEWRELIC; | ||
} | ||
|
||
public NewrelicCommand() { | ||
super(); | ||
registerSubcommand(new EditNewrelicCommand()); | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
...va/com/netflix/spinnaker/halyard/config/model/v1/metricStores/newrelic/NewrelicStore.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,50 @@ | ||
/* | ||
* Copyright 2019 New Relic Corporation. 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 com.netflix.spinnaker.halyard.config.model.v1.metricStores.newrelic; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnore; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.netflix.spinnaker.halyard.config.model.v1.node.MetricStore; | ||
import com.netflix.spinnaker.halyard.config.model.v1.node.MetricStores; | ||
import com.netflix.spinnaker.halyard.config.model.v1.node.Secret; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
|
||
@EqualsAndHashCode(callSuper = true) | ||
@Data | ||
public class NewrelicStore extends MetricStore { | ||
@Override | ||
public String getNodeName() { | ||
return "newrelic"; | ||
} | ||
|
||
@JsonIgnore | ||
private MetricStores.MetricStoreType metricStoreType = MetricStores.MetricStoreType.NEWRELIC; | ||
|
||
@Secret(alwaysDecrypt = true) | ||
@JsonProperty("insert_key") | ||
private String insertKey; | ||
|
||
@JsonProperty("host") | ||
private String host; | ||
|
||
@JsonProperty("tags") | ||
private List<String> tags = new ArrayList<>(); | ||
} |
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.