Skip to content

Commit

Permalink
config(Datadog): Add custom Datadog tags option (#1049)
Browse files Browse the repository at this point in the history
  • Loading branch information
shividhar authored and lwander committed Oct 5, 2018
1 parent 24fec29 commit 3ddb1fc
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 2 deletions.
5 changes: 4 additions & 1 deletion docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -3150,7 +3150,7 @@ hal config deploy ha clouddriver enable [parameters]
---
## hal config deploy ha echo

Manage and view Spinnaker configuration for the echo high availability service Manage and view Spinnaker configuration for the echo high availability service. When echo high availability is enabled, Halyard will deploy echo as two separate services in order to increase availability: echo-scheduler and echo-worker. The echo-scheduler service only handles Spinnaker cron-jobs and is isolated from the rest of Spinnaker.. The echo-worker handles everything else.
Manage and view Spinnaker configuration for the echo high availability service Manage and view Spinnaker configuration for the echo high availability service. When echo high availability is enabled, Halyard will deploy echo as two separate services in order to increase availability: echo-scheduler and echo-worker. The echo-scheduler service only handles Spinnaker cron-jobs and is isolated from the rest of Spinnaker. The echo-worker handles everything else.

#### Usage
```
Expand Down Expand Up @@ -3347,10 +3347,13 @@ hal config metric-stores datadog edit [parameters]
```

#### Parameters
* `--add-tag`: Add this tag to the list of Datadog tags.
* `--api-key`: Your datadog API key.
* `--app-key`: Your datadog app key. This is only required if you want Spinnaker to push pre-configured Spinnaker dashboards to your Datadog account.
* `--deployment`: If supplied, use this Halyard deployment. This will _not_ create a new deployment.
* `--no-validate`: (*Default*: `false`) Skip validation.
* `--remove-tag`: Remove this tag from the list of Datadog tags.
* `--tags`: (*Default*: `[]`) Your datadog custom tags. Please delimit the KVP with colons i.e. --tags app:test env:dev


---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ public class EchoHaServiceCommand extends AbstractNamedHaServiceCommand {
"When echo high availability is enabled, Halyard will deploy echo as two",
"separate services in order to increase availability: echo-scheduler and echo-worker.",
"The echo-scheduler service only handles Spinnaker cron-jobs and is isolated from",
"the rest of Spinnaker.. The echo-worker handles everything else."
"the rest of Spinnaker. The echo-worker handles everything else."
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
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 EditDatadogCommand extends AbstractEditMetricStoreCommand<DatadogStore> {
public MetricStores.MetricStoreType getMetricStoreType() {
Expand All @@ -42,11 +45,37 @@ public MetricStores.MetricStoreType getMetricStoreType() {
)
private String appKey;

@Parameter(
names = "--tags",
variableArity = true,
description = "Your datadog 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 Datadog tags."
)
private String addTag;

@Parameter(
names = "--remove-tag",
description = "Remove this tag from the list of Datadog tags."
)
private String removeTag;

@Override
protected MetricStore editMetricStore(DatadogStore datadogStore) {
datadogStore.setApiKey(isSet(apiKey) ? apiKey : datadogStore.getApiKey());
datadogStore.setAppKey(isSet(appKey) ? appKey : datadogStore.getAppKey());

try {
datadogStore.setTags(
updateStringList(datadogStore.getTags(), tags, addTag, removeTag));
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("Set either --tags or --[add/remove]-tag");
}

return datadogStore;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.ArrayList;
import java.util.List;

@EqualsAndHashCode(callSuper = true)
@Data
public class DatadogStore extends MetricStore {
Expand All @@ -40,4 +43,7 @@ public String getNodeName() {

@JsonProperty("app_key")
private String appKey;

@JsonProperty("tags")
private List<String> tags = new ArrayList<>();
}

0 comments on commit 3ddb1fc

Please sign in to comment.