-
-
Notifications
You must be signed in to change notification settings - Fork 94
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
Metric deserialization refactor #439
Metric deserialization refactor #439
Conversation
fd2a31f
to
24b223a
Compare
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.
Almost there, just some thoughts
internal override MetricDefinition Deserialize(YamlMappingNode node) | ||
{ | ||
var rawResourceType = node.Children[new YamlScalarNode("resourceType")]; | ||
var resourceType = Enum.Parse<ResourceType>(rawResourceType.ToString()); |
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.
Thinking out loud - Should we use TryParse
here and throw a custom exception?
...or.Core.Scraping/Configuration/Serialization/Deserializers/GenericAzureMetricDeserializer.cs
Show resolved
Hide resolved
...or.Core.Scraping/Configuration/Serialization/Deserializers/GenericAzureMetricDeserializer.cs
Outdated
Show resolved
Hide resolved
...or.Core.Scraping/Configuration/Serialization/Deserializers/GenericAzureMetricDeserializer.cs
Outdated
Show resolved
Hide resolved
Docker image for this PR was built and is available on Docker Hub. You can pull it locally via the CLI: docker pull tomkerkhove/promitor-agent-scraper-ci:pr439 Want to verify the new version? Run it locally: docker run -d -p 8999:80 --name promitor-scraper-pr439 \
--env PROMITOR_AUTH_APPID='<azure-ad-app-id>' \
--env PROMITOR_AUTH_APPKEY='<azure-ad-app-key>' \
--volume C:/Promitor/metrics-declaration.yaml:/config/metrics-declaration.yaml \
tomkerkhove/promitor-agent-scraper-ci:pr439 |
…ng is more isolated
… to metrics deserialization
24b223a
to
0c5712a
Compare
Docker image for this PR was built and is available on Docker Hub. You can pull it locally via the CLI: docker pull tomkerkhove/promitor-agent-scraper-ci:pr439 Want to verify the new version? Run it locally: docker run -d -p 8999:80 --name promitor-scraper-pr439 \
--env PROMITOR_AUTH_APPID='<azure-ad-app-id>' \
--env PROMITOR_AUTH_APPKEY='<azure-ad-app-key>' \
--volume C:/Promitor/metrics-declaration.yaml:/config/metrics-declaration.yaml \
tomkerkhove/promitor-agent-scraper-ci:pr439 |
Docker image for this PR was built and is available on Docker Hub. You can pull it locally via the CLI: docker pull tomkerkhove/promitor-agent-scraper-ci:pr439 Want to verify the new version? Run it locally: docker run -d -p 8999:80 --name promitor-scraper-pr439 \
--env PROMITOR_AUTH_APPID='<azure-ad-app-id>' \
--env PROMITOR_AUTH_APPKEY='<azure-ad-app-key>' \
--volume C:/Promitor/metrics-declaration.yaml:/config/metrics-declaration.yaml \
tomkerkhove/promitor-agent-scraper-ci:pr439 |
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.
Looks good, thanks!
src/Promitor.Core.Scraping/Configuration/Serialization/Core/MetricsDeserializer.cs
Outdated
Show resolved
Hide resolved
Docker image for this PR was built and is available on Docker Hub. You can pull it locally via the CLI: docker pull tomkerkhove/promitor-agent-scraper-ci:pr439 Want to verify the new version? Run it locally: docker run -d -p 8999:80 --name promitor-scraper-pr439 \
--env PROMITOR_AUTH_APPID='<azure-ad-app-id>' \
--env PROMITOR_AUTH_APPKEY='<azure-ad-app-key>' \
--volume C:/Promitor/metrics-declaration.yaml:/config/metrics-declaration.yaml \
tomkerkhove/promitor-agent-scraper-ci:pr439 |
1 similar comment
Docker image for this PR was built and is available on Docker Hub. You can pull it locally via the CLI: docker pull tomkerkhove/promitor-agent-scraper-ci:pr439 Want to verify the new version? Run it locally: docker run -d -p 8999:80 --name promitor-scraper-pr439 \
--env PROMITOR_AUTH_APPID='<azure-ad-app-id>' \
--env PROMITOR_AUTH_APPKEY='<azure-ad-app-key>' \
--volume C:/Promitor/metrics-declaration.yaml:/config/metrics-declaration.yaml \
tomkerkhove/promitor-agent-scraper-ci:pr439 |
61d29df
to
4c7e173
Compare
Docker image for this PR was built and is available on Docker Hub. You can pull it locally via the CLI: docker pull tomkerkhove/promitor-agent-scraper-ci:pr439 Want to verify the new version? Run it locally: docker run -d -p 8999:80 --name promitor-scraper-pr439 \
--env PROMITOR_AUTH_APPID='<azure-ad-app-id>' \
--env PROMITOR_AUTH_APPKEY='<azure-ad-app-key>' \
--volume C:/Promitor/metrics-declaration.yaml:/config/metrics-declaration.yaml \
tomkerkhove/promitor-agent-scraper-ci:pr439 |
Fixes #416
Proposed Changes
The approach here is to move the deserializing of metric configuration from the Promitor YAML file in to a more decomposed approach. This allows for new metrics & scrapers to be added without risking merge conflicts as changes are isolated to specific files only pertaining to the metrics and deserialization thereof; not within a host of methods inside one specific file.
Documentation for 'adding a scraper' has also been updated to be more descriptive & prescriptive on the metric deserialization procedure when new metrics are added.