Skip to content
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

Merged

Conversation

brandonh-msft
Copy link
Contributor

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.

@brandonh-msft brandonh-msft force-pushed the brandonh/feature/yaml-parser branch 2 times, most recently from fd2a31f to 24b223a Compare March 25, 2019 22:20
Copy link
Owner

@tomkerkhove tomkerkhove left a 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());
Copy link
Owner

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?

@promitor-bot
Copy link

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

@tomkerkhove tomkerkhove modified the milestones: v1.1.0, v1.0.0 Mar 26, 2019
@promitor-bot
Copy link

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

@promitor-bot
Copy link

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

Copy link
Owner

@tomkerkhove tomkerkhove left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

@promitor-bot
Copy link

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
@promitor-bot
Copy link

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

@promitor-bot
Copy link

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

@tomkerkhove tomkerkhove merged commit 2c72d10 into tomkerkhove:master Mar 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants