-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Handle Dynatrace Configurations with non-unique names
Some Dynatrace APIs/Configurations do not fulfill the monaco assumption of having a unique name. For these configurations it is possible or even required to create several configurations with the same name. This causes problems for monaco during deployment - being unable to update the correct configuration - and on download - being unable to download all configurations. This adds logic of addressing such non-unique-name configurations by their UUID - either from Dynatrace if downloaded, or generated from monaco if first uploaded. To stay backward compatible this handling of non-unique APIs is introduced in -v2 configuration folders, which existing configuration will keep functioning in the existing - but wrong if more than one configuration of a name exists - way. ## Commits: * feat: Flag APIs that don't work with unique names * feat: Add function to test and generate UUID * feat: Allow force updates by entity id * feat: Allow generating project unique uuids * feat: Use id json if name not unique * feat: Read/update config instead of overwriting * feat: Add deployment handler. add tests * fix: Skip deleting non-uniquely named entities * docs: Add info about non-unique name APIs * fix: Fix several golangci-lint complaints * feat: Resolve several review sugestions * feat: Remove uuid generator from project interface * feat: Mitigate entity duplication with v2 configs * test: Fix non-nullable attributes * feat: Flag APIs that don't work with unique names * feat: Add function to test and generate UUID * feat: Allow force updates by entity id * feat: Allow generating project unique uuids * feat: Use id json if name not unique * feat: Read/update config instead of overwriting * feat: Add deployment handler. add tests * fix: Skip deleting non-uniquely named entities * docs: Add info about non-unique name APIs * fix: Fix several golangci-lint complaints * feat: Resolve several review sugestions * feat: Remove uuid generator from project interface * feat: Mitigate entity duplication with v2 configs * test: Fix non-nullable attributes * feat: Explicitly test UUID format * docs: Add deprecation infos * docs: Fix broken link * docs: Update documentation/docs/Guides/add_new_api.md Co-authored-by: Nico Riedmann <[email protected]> * docs: Update documentation/docs/Guides/add_new_api.md Co-authored-by: Nico Riedmann <[email protected]> * feat: Fix comment; Remove obsolete func parameters * test: Add TestIsDeprecatedApi * feat: Remove NewIdValue function * feat: Undo deploy refactoring; * feat: Reduce calculated cyclomatic complexity * refactor: Simplify config upload error handling Move the logic of whether deployment errors of a single config are returned or just appended for later, out into the main execute method. This removes the need for executeConfig to make this decision and changes it to just return an error or not. With that the side-effect of executeConfig modifying the errors slice is removed. The previous if/else of handling the error is also simplified so that the appending of the new error, which has to happen in either case happens once, before returning if not explicitly continuing on errors. Fixes #642, fixes #377, fixes #254, fixes #306 Co-authored-by: Tobi Gremmer <[email protected]> Co-authored-by: tobigremmer-dt <[email protected]>
- Loading branch information
1 parent
191458b
commit de9304b
Showing
30 changed files
with
1,179 additions
and
330 deletions.
There are no files selected for viewing
43 changes: 22 additions & 21 deletions
43
...t-resources/integration-all-configs/project/custom-service-dotnet/warp-drive-service.json
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 |
---|---|---|
@@ -1,22 +1,23 @@ | ||
{ | ||
"name": "{{ .name }}", | ||
"enabled": true, | ||
"rules": [ | ||
{ | ||
"enabled": true, | ||
"fileName": "", | ||
"className": "com.dynatrace.easytravel.servicex", | ||
"matcher": "EQUALS", | ||
"methodRules": [ | ||
{ | ||
"methodName": "methody", | ||
"returnType": "void" | ||
} | ||
], | ||
"annotations": [] | ||
} | ||
], | ||
"queueEntryPoint": false, | ||
"queueEntryPointType": null, | ||
"processGroups": [] | ||
} | ||
"name": "{{ .name }}", | ||
"enabled": true, | ||
"rules": [ | ||
{ | ||
"enabled": true, | ||
"fileName": "", | ||
"className": "com.dynatrace.easytravel.servicex", | ||
"matcher": "EQUALS", | ||
"methodRules": [ | ||
{ | ||
"methodName": "methody", | ||
"returnType": "void", | ||
"visibility": "PUBLIC" | ||
} | ||
], | ||
"annotations": [] | ||
} | ||
], | ||
"queueEntryPoint": false, | ||
"queueEntryPointType": null, | ||
"processGroups": [] | ||
} |
33 changes: 17 additions & 16 deletions
33
.../test-resources/integration-all-configs/project/custom-service-go/warp-drive-service.json
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 |
---|---|---|
@@ -1,20 +1,21 @@ | ||
{ | ||
"name": "{{ .name }}", | ||
"enabled": true, | ||
"rules": [ | ||
"name": "{{ .name }}", | ||
"enabled": true, | ||
"rules": [ | ||
{ | ||
"enabled": true, | ||
"className": "AClass", | ||
"methodRules": [ | ||
{ | ||
"enabled": true, | ||
"className": "AClass", | ||
"methodRules": [ | ||
{ | ||
"methodName": "AMethod", | ||
"argumentTypes": [ | ||
"java.lang.String" | ||
], | ||
"returnType": "void" | ||
} | ||
] | ||
"methodName": "AMethod", | ||
"argumentTypes": [ | ||
"java.lang.String" | ||
], | ||
"returnType": "void", | ||
"visibility": "PUBLIC" | ||
} | ||
], | ||
"queueEntryPoint": false | ||
] | ||
} | ||
], | ||
"queueEntryPoint": false | ||
} |
43 changes: 22 additions & 21 deletions
43
...est-resources/integration-all-configs/project/custom-service-java/warp-drive-service.json
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 |
---|---|---|
@@ -1,25 +1,26 @@ | ||
{ | ||
"name": "{{ .name }}", | ||
"enabled": true, | ||
"rules": [ | ||
"name": "{{ .name }}", | ||
"enabled": true, | ||
"rules": [ | ||
{ | ||
"enabled": true, | ||
"fileName": "", | ||
"className": "com.dynatrace.expamle.enterprise.service.v1.WarpDrive", | ||
"matcher": "EQUALS", | ||
"methodRules": [ | ||
{ | ||
"enabled": true, | ||
"fileName": "", | ||
"className": "com.dynatrace.expamle.enterprise.service.v1.WarpDrive", | ||
"matcher": "EQUALS", | ||
"methodRules": [ | ||
{ | ||
"methodName": "enable", | ||
"argumentTypes": [ | ||
"com.dynatrace.expamle.enterprise.service.v1.WarpDrive" | ||
], | ||
"returnType": "javax.ws.rs.core.Response" | ||
} | ||
], | ||
"annotations": [] | ||
"methodName": "enable", | ||
"argumentTypes": [ | ||
"com.dynatrace.expamle.enterprise.service.v1.WarpDrive" | ||
], | ||
"returnType": "javax.ws.rs.core.Response", | ||
"visibility": "PUBLIC" | ||
} | ||
], | ||
"queueEntryPoint": false, | ||
"queueEntryPointType": null, | ||
"processGroups": [] | ||
], | ||
"annotations": [] | ||
} | ||
], | ||
"queueEntryPoint": false, | ||
"queueEntryPointType": null, | ||
"processGroups": [] | ||
} |
39 changes: 20 additions & 19 deletions
39
...t-resources/integration-all-configs/project/custom-service-nodejs/warp-drive-service.json
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 |
---|---|---|
@@ -1,20 +1,21 @@ | ||
{ | ||
"name": "{{ .name }}", | ||
"enabled": true, | ||
"rules": [ | ||
{ | ||
"enabled": true, | ||
"fileName": "AFile.js", | ||
"methodRules": [ | ||
{ | ||
"methodName": "AMethod", | ||
"argumentTypes": [ | ||
"java.lang.String" | ||
], | ||
"returnType": "void" | ||
} | ||
] | ||
} | ||
], | ||
"queueEntryPoint": false | ||
} | ||
"name": "{{ .name }}", | ||
"enabled": true, | ||
"rules": [ | ||
{ | ||
"enabled": true, | ||
"fileName": "AFile.js", | ||
"methodRules": [ | ||
{ | ||
"methodName": "AMethod", | ||
"argumentTypes": [ | ||
"java.lang.String" | ||
], | ||
"returnType": "void", | ||
"visibility": "PUBLIC" | ||
} | ||
] | ||
} | ||
], | ||
"queueEntryPoint": false | ||
} |
45 changes: 23 additions & 22 deletions
45
...test-resources/integration-all-configs/project/custom-service-php/warp-drive-service.json
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 |
---|---|---|
@@ -1,23 +1,24 @@ | ||
{ | ||
"name": "{{ .name }}", | ||
"enabled": true, | ||
"rules": [ | ||
{ | ||
"enabled": true, | ||
"fileName": "phpFile", | ||
"fileNameMatcher": "ENDS_WITH", | ||
"className": "", | ||
"matcher": "EQUALS", | ||
"methodRules": [ | ||
{ | ||
"methodName": "myMethod", | ||
"returnType": "void" | ||
} | ||
], | ||
"annotations": [] | ||
} | ||
], | ||
"queueEntryPoint": false, | ||
"queueEntryPointType": null, | ||
"processGroups": [] | ||
} | ||
"name": "{{ .name }}", | ||
"enabled": true, | ||
"rules": [ | ||
{ | ||
"enabled": true, | ||
"fileName": "phpFile", | ||
"fileNameMatcher": "ENDS_WITH", | ||
"className": "", | ||
"matcher": "EQUALS", | ||
"methodRules": [ | ||
{ | ||
"methodName": "myMethod", | ||
"returnType": "void", | ||
"visibility": "PUBLIC" | ||
} | ||
], | ||
"annotations": [] | ||
} | ||
], | ||
"queueEntryPoint": false, | ||
"queueEntryPointType": null, | ||
"processGroups": [] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
--- | ||
sidebar_position: 2 | ||
title: Migrating deprecated configuration types | ||
--- | ||
| ||
This guide shows you how to migrate deprecated configuration types. | ||
|
||
## *dashboard*, *request-naming-service*, *app-detection-rule* | ||
|
||
Initial *dashboard*, *request-naming-service*, *app-detection-rule* configurations were all affected by conflicts between their DT entities name attributes. | ||
|
||
Dashboards for example (same applies to *request-naming-service*, *app-detection-rule*) don't have a unique name within a Dynatrace environment. Unfortunately, Monaco depends on name uniqueness in order to identify resources. In the case of dashboards, this resulted in missed/invalid downloads and conflicts during deployments. The solution to this was generating custom UUIDs based on Monaco configuration metadata. As many advantages this brings, the one downside is that Monaco lost track of already deployed dashboards. A dashboard deployment would therefore result in a redeployment (and duplicating - isn't it ironic) of potentially dozens of dashboards in Dynatrace. | ||
|
||
The following guide is referencing *dashboard* configurations. However, the same applies to *request-naming-service* and *app-detection-rule* configurations. | ||
|
||
1) Existing *dashboard* configurations usually look similar to this: | ||
|
||
*config.yaml* | ||
``` | ||
--- | ||
config: | ||
- DashboardConfigId: config.json | ||
DashboardConfigId: | ||
- name: Monaco Test | ||
- owner: Monaco User | ||
- isShared: true | ||
``` | ||
With *DashboardConfigId* as the user defined key that links configuration details and config.json. *name*, *owner* and *isShared* are custom properties which are subsituted in config.json: | ||
*config.json* | ||
``` | ||
{ | ||
"dashboardMetadata": { | ||
"dashboardFilter": null, | ||
"name": "{{ .name }}", | ||
"owner": "{{ .owner }}", | ||
"shared": {{ .isShared }}, | ||
"tilesNameSize": null | ||
}, | ||
"tiles": [ | ||
... | ||
] | ||
} | ||
``` | ||
In a folder structure similar to this: | ||
``` | ||
workdir/ | ||
project/ | ||
app-detection-rule/ | ||
... | ||
dashboard/ | ||
config.json | ||
config.yaml | ||
environment.yaml | ||
``` | ||
2. Recommended: Since the user defined key (*DashboardConfigId* in our example) is used to automatically generate DT entity ids in version 2, the easiest way to migrate existing configuration is to substitute it with the actual Dynatrace enitity id. Dashboard entity ids can be looked up either via API or UI: | ||
*config.yaml* | ||
``` | ||
--- | ||
config: | ||
- <DT entity UUID>: config.json | ||
<DT entity UUID>: | ||
- name: Monaco Test | ||
- owner: Monaco User | ||
- isShared: true | ||
``` | ||
The configuration is now compatible with version 2 of the dashboard configuration type. | ||
Alternatively: Once a configuration is deprecated and a new version provided, all subsequent downloads create configurations of the new version. Existing configuration is kept, but not updated anymore: | ||
``` | ||
workdir/ | ||
project/ | ||
app-detection-rule-v2/ | ||
... | ||
dashboard/ | ||
config.json | ||
config.yaml | ||
dashboard-v2/ | ||
config.json | ||
config.yaml | ||
environment.yaml | ||
``` | ||
Although the newly downloaded *config.yaml* includes valid configuration keys, other custom properties (e.g. owner, ...) are dropped: | ||
*dashboard-v2/config.yaml* | ||
``` | ||
--- | ||
config: | ||
- <DT entity UUID>: config.json | ||
<DT entity UUID>: | ||
- name: Monaco Test | ||
``` | ||
This method however allows us to identify configuration instances by their name property and copy/paste their existing DT entity ids instead of retrieving them by API or UI. | ||
3. In order for Monaco to recognize version 2 configurations as such, the incremental version has to be appended to the config folder, *dashboard* becomes *dashboard-v2*: | ||
``` | ||
workdir/ | ||
project/ | ||
app-detection-rule-v2/ | ||
... | ||
dashboard-v2/ | ||
config.json | ||
config.yaml | ||
environment.yaml | ||
``` |
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.