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

Report validation error if resources not specified #1107

Merged

Conversation

adamconnelly
Copy link
Contributor

@adamconnelly adamconnelly commented Jun 21, 2020

I've updated the MetricDefinitionDeserializer to report a validation error if neither resources nor resourceCollections is populated.

Fixes #806

A metric definition like the following:

- name: azure_lb_data_path_availability
  description: "The CPU of our containers in a container group."
  resourceType: Generic
  azureMetricConfiguration:
    metricName: VipAvailability
    aggregation:
      type: Average

Will now produce the following validation error:

[15:56:21 ERR] The following problems were found with the metric configuration:
Error 13:5: Either 'resources' or 'resourceCollections' must be specified.

@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:pr1107-linux

Want to verify the new version? Run it locally:

docker run -d -p 8999:80 --name promitor-agent-scraper-pr1107-linux \
                         --env PROMITOR_AUTH_APPID='<azure-ad-app-id>' \
                         --env-file C:/Promitor/az-mon-auth.creds \
                         --volume C:/Promitor/metrics-declaration.yaml:/config/metrics-declaration.yaml  \
                         --volume C:/Promitor/runtime-config.yaml:/config/runtime.yaml \
                         tomkerkhove/promitor-agent-scraper-ci:pr1107-linux

You can find a CI version of our Helm chart on hub.helm.sh

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.

@trafico-bot trafico-bot bot added the ✅ Approved Pull Request has been approved and can be merged label Jun 22, 2020
@adamconnelly
Copy link
Contributor Author

@tomkerkhove I'm happy to do that - I'm just not sure what the best thing to do is because you've already added the following entry to the changelog:

New validation rule to ensure at least one resource or resource collection is configured to scrape

I'm thinking it might be confusing if we put it in another entry that's pretty similar. I realise your entry is for the internal model validation, but what I've added is for the configuration validation, but maybe the distinction won't be important for users?

I'll go ahead and add changelog entries for my other two PRs anyhow - just need some guidance on this one.

@tomkerkhove
Copy link
Owner

That's a valid point, no need to take any action then!

Once the code quality check is passing we can merge this one, thanks!

@trafico-bot trafico-bot bot added 🔍 Ready for Review Pull Request is not reviewed yet and removed ✅ Approved Pull Request has been approved and can be merged labels Jun 23, 2020
@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:pr1107-linux

Want to verify the new version? Run it locally:

docker run -d -p 8999:80 --name promitor-agent-scraper-pr1107-linux \
                         --env PROMITOR_AUTH_APPID='<azure-ad-app-id>' \
                         --env-file C:/Promitor/az-mon-auth.creds \
                         --volume C:/Promitor/metrics-declaration.yaml:/config/metrics-declaration.yaml  \
                         --volume C:/Promitor/runtime-config.yaml:/config/runtime.yaml \
                         tomkerkhove/promitor-agent-scraper-ci:pr1107-linux

You can find a CI version of our Helm chart on hub.helm.sh

I've updated the MetricDefinitionDeserializer to report a validation error if neither `resources` or `resourceCollections` is populated.

Fixes tomkerkhove#806
@adamconnelly
Copy link
Contributor Author

Ok - should be sorted now @tomkerkhove

@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:pr1107-linux

Want to verify the new version? Run it locally:

docker run -d -p 8999:80 --name promitor-agent-scraper-pr1107-linux \
                         --env PROMITOR_AUTH_APPID='<azure-ad-app-id>' \
                         --env-file C:/Promitor/az-mon-auth.creds \
                         --volume C:/Promitor/metrics-declaration.yaml:/config/metrics-declaration.yaml  \
                         --volume C:/Promitor/runtime-config.yaml:/config/runtime.yaml \
                         tomkerkhove/promitor-agent-scraper-ci:pr1107-linux

You can find a CI version of our Helm chart on hub.helm.sh

@tomkerkhove tomkerkhove merged commit 2284def into tomkerkhove:master Jun 23, 2020
@trafico-bot trafico-bot bot added ✨ Merged Pull Request has been merged successfully and removed 🔍 Ready for Review Pull Request is not reviewed yet labels Jun 23, 2020
@tomkerkhove
Copy link
Owner

Thanks man!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ Merged Pull Request has been merged successfully
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide validation to ensure resources are defined
3 participants