Skip to content

Commit

Permalink
Provide better docs on contributing (#1233)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkerkhove authored Aug 20, 2020
1 parent de5244c commit a880b17
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Are you a Promitor user? Let us know and [get listed](https://forms.gle/hjcpaaVF
All contribution guidelines can be found [here](./.github/CONTRIBUTING.md). We
welcome bug reports, improvement suggestions and pull requests.

Want to see support for a scraper that is not [already supported](https://promitor.io/configuration/metrics/)?
Want to see support for a scraper that is not [already supported](https://promitor.io/configuration/v2.x/metrics/#supported-azure-services)?
You can contribute by [adding one yourself](adding-a-new-scraper.md)!

Information about making changes to Promitor can be found [here](development-guide.md).
Expand Down
18 changes: 14 additions & 4 deletions adding-a-new-scraper.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ discuss your scenario_

------------------------

## Configuration
## Implementing a Scaler

### Configuration

<!-- markdownlint-disable MD013 -->
1. Add your new scraping type to the `Promitor.Core.Scraping.Configuration.Model.ResourceType`.
Expand All @@ -38,7 +40,7 @@ discuss your scenario_
Going forward in this guide, `TResourceDefinition` will refer to your newly created
configuration type.

## Validation
### Validation

For every scraper type we provide validation for the configuration so that Promitor
fails to start up.
Expand All @@ -53,15 +55,15 @@ This requires the following steps:
for the ResourceType you created in step #1 above.
3. Provide a unit test for every validation rule that was added in `.\src\Promitor.Tests.Unit\Validation\Metrics\ResourceTypes`

## Scraping
### Scraping

We'll add a new scraper that pulls the metrics from Azure Monitor:

1. Implement a scraper, that inherits from `AzureMonitorScraper<TResourceDefinition>`, which will specify what resource to scrape with Azure Monitor.
2. Hook your new scraper in our `MetricScraperFactory` which determines what scraper
to use for the passed configuration.

## Resource Discovery
### Resource Discovery

We'll add dynamic resource discovery support by using Azure Resource Graph:

Expand Down Expand Up @@ -91,3 +93,11 @@ Please provide documentation on the following:

This should be provided in a new file under `docs\configuration\v2.x\metrics` and be listed
under the supported providers on `docs/configuration/v2.x/metrics/index.md` in alphabetical order.

## See It In Action

Now that you are done, make sure you run Promitor locally so verify that it generates the correct metrics!

When opening the pull request (PR), feel free to copy the generated Prometheus metrics for review.

Learn how to run it in our [development guide](development-guide.md#running-promitor).
12 changes: 8 additions & 4 deletions development-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@ The promitor repository is made up of a number of different directories:
- `/.github` - contains github specific files including issue and PR templates.
- `/.vscode` - contains shared configuration files for [VS Code](https://code.visualstudio.com/).
- `/build` - contains the configuration files for Promitor's CI process.
- `/changelog` - contains the source code for building <https://changelog.promitor.io>
- `/charts` - contains Promitor's [Helm](https://helm.sh/) chart.
- `/config` - contains the configuration to run Promitor locally or in the CI
- `/deploy` - contains the automation that is being used to manage Promitor, such
as the automated updates concerning new Docker images in a pull request.
- `/docs` - contains the source code (mainly markdown files) for building the
<https://promitor.io>.
- `/media` - contains all media such as images and sources of schematics used in the docs
- `/src` - contains the .NET source code for the Promitor application.

## Helm Chart
Expand All @@ -27,7 +30,8 @@ To work on the Helm chart, you need the following tools:

- [Helm](https://helm.sh).
- A working Kubernetes cluster. For local development you can use [Docker Desktop](https://www.docker.com/products/docker-desktop)
which has an option to install a local cluster for you, or a tool like [Minikube](https://github.com/kubernetes/minikube).
which has an option to install a local cluster for you, or a tool such as [Minikube](https://github.com/kubernetes/minikube)
or [kind](https://kind.sigs.k8s.io/).

The chart's README contains information about how to install the chart in your Kubernetes
cluster. For local development, you can substitute the relative path to the chart
Expand Down Expand Up @@ -98,7 +102,7 @@ and set the following environment variables:
Azure Monitor API.
- `PROMITOR_AUTH_APPKEY` - your service principal secret.

Next, edit [src/metrics.yaml](src/metrics.yaml) and set the following
Next, edit [config/promitor/scraper/metrics.yaml](config/promitor/scraper/metrics.yaml) and set the following
keys:

- `azureMetadata.tenantId` - your Azure tenant Id.
Expand All @@ -109,7 +113,7 @@ keys:
Configure at least one scraper under the `metrics` section and finally, run the
Promitor.Docker project.

You can find more information about how to configure Promitor [here](https://promitor.io/configuration/v1.x/metrics/).
You can find more information about how to configure Promitor [here](https://promitor.io/configuration/v2.x/metrics/).

**NOTE:** Please make sure not to commit your changes to `docker-compose.override.yml`
or `metrics.yaml`. If you do, you may end up publishing your Azure credentials
Expand All @@ -120,5 +124,5 @@ by accident.
To build the Docker image, run the following command from the `/src` directory:

```shell
docker build . --file .\Promitor.Agents.Scraper\Dockerfile --tag promitor --no-cache
docker build . --file .\Promitor.Agents.Scraper\Dockerfile.linux --tag promitor --no-cache
```
File renamed without changes.

0 comments on commit a880b17

Please sign in to comment.