Adding a new scraper type
This guide walks you through the process of adding a new scraper type.
- Add your new scraping type to the
- Describe the resource for which you're creating scraping metrics by creating
<New-Type>MetricDefinitionand inherit from
Promitor.Core.Scraping.Configuration.Model.Metrics.MetricDefinition- this class should go in
- Create a new Deserializer in
.\src\Promitor.Core.Scraping\Configuration\Serialization\Deserializers. This must inherit from
Promitor.Core.Scraping.Factories.MetricDeserializerFactoryto handle your new resource type by returning a new instance of the Deserializer you created in the previous step.
- Provide a unit test in
.\src\Promitor.Scraper.Tests.Unit\Serialization\MetricsDeclaration\that tests the deserialization based on our sample
Going forward in this guide,
TMetricDefinition will refer to your newly created configuration type.
For every scraper type we provide validation for the configuration so that Promitor fails to start up.
This requires the following steps:
- Create a new validator that implements
TMetricDefinitionis the definition you made in step #2 above. This validator should reside in
.\src\Promitor.Scraper.Host\Validation\MetricDefinitions\ResourceTypes. You can look at the contents of
ServiceBusQueueMetricValidatorfor an idea of the validation inputs, steps, and outputs typical of validator implementation.
- Add construction and usage of this validator to
.\src\Promitor.Scraper.Host\Validation\Factories\MetricValidatorFactory.csfor the ResourceType you created in step #1 above.
- Provide a unit test for every validation rule that was added in
- Implement a scraper that inherits from
Scraper<TMetricDefinition>. This one will specify how to call Azure Monitor.
- Hook your new scraper in our
MetricScraperFactorywhich determines what scraper to use for the passed configuration
Features are great to have but without clear & well-written documentation they are somewhat useless.
It would be good if you could provide documentation on the following:
- What Azure service it supports and how to use it
- What fields need to be configured and what they are for
- An example configuration
This should be provided in a new file under