-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Update dashboard validation for Manifest V2 #10398
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
from .commands.console import abort | ||
from .constants import get_root | ||
from .datastructures import JSONDict | ||
from .manifest_validator.constants import V1, V2 | ||
from .utils import load_manifest | ||
|
||
NON_INTEGRATION_PATHS = [ | ||
|
@@ -23,6 +24,10 @@ class Manifest: | |
This also supports the case of querying file information about the Agent | ||
""" | ||
|
||
# add version constants to avoid extra imports | ||
V1 = V1 | ||
V2 = V2 | ||
|
||
@staticmethod | ||
def load_manifest(check): | ||
""" | ||
|
@@ -50,6 +55,7 @@ class Agent: | |
def __init__(self, check_name, manifest_json): | ||
self._check_name = check_name | ||
self._manifest_json = manifest_json | ||
self.version = None | ||
|
||
def get_config_spec(self): | ||
return os.path.join(get_root(), 'pkg', 'config', 'conf_spec.yaml') | ||
|
@@ -64,10 +70,20 @@ class ManifestV1: | |
def __init__(self, check_name, manifest_json): | ||
self._check_name = check_name | ||
self._manifest_json = JSONDict(manifest_json) | ||
self.version = V1 | ||
|
||
def get_path(self, path): | ||
return self._manifest_json.get(path) | ||
|
||
def get_display_name(self): | ||
return self._manifest_json['display_name'] | ||
|
||
def get_app_id(self): | ||
return None | ||
|
||
def get_app_uuid(self): | ||
return None | ||
|
||
def get_metric_prefix(self): | ||
return self._manifest_json['metric_prefix'] | ||
|
||
|
@@ -93,10 +109,20 @@ class ManifestV2: | |
def __init__(self, check_name, manifest_json): | ||
self._check_name = check_name | ||
self._manifest_json = JSONDict(manifest_json) | ||
self.version = V2 | ||
|
||
def get_path(self, path): | ||
return self._manifest_json.get(path) | ||
Comment on lines
+114
to
+115
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are we using this get_path anywhere? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, but at one point in my PR I did - thought it would be useful to have so I left it. |
||
|
||
def get_display_name(self): | ||
return self._manifest_json.get_path("/assets/integration/source_type_name") | ||
|
||
def get_app_id(self): | ||
return self._manifest_json['app_id'] | ||
|
||
def get_app_uuid(self): | ||
return self._manifest_json['app_uuid'] | ||
|
||
def get_metric_prefix(self): | ||
return self._manifest_json.get_path("/assets/integration/metrics/prefix") or '' | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where are these used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/DataDog/integrations-core/pull/10398/files#diff-e5ca44e5d121dd8240c03bc3064b8c0cc2a3f84fb899aa11c3516328bc635838R129
In the other file, by adding these enums here, it avoids an extra import statement which will also be helpful in other use cases