Compare commits
2 Commits
9bf3e1abf8
...
a82f72e30f
Author | SHA1 | Date |
---|---|---|
Massaki Archambault | a82f72e30f | |
Massaki Archambault | 1d3d5e3926 |
19
.drone.yml
19
.drone.yml
|
@ -70,3 +70,22 @@ steps:
|
||||||
depends_on:
|
depends_on:
|
||||||
- build-arm64
|
- build-arm64
|
||||||
- build-amd64
|
- build-amd64
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: kubernetes
|
||||||
|
name: publish-pypi
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
branch:
|
||||||
|
- master
|
||||||
|
event:
|
||||||
|
- tag
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: publish pypi
|
||||||
|
image: plugins/pypi
|
||||||
|
settings:
|
||||||
|
username:
|
||||||
|
from_secret: pypi_username
|
||||||
|
password:
|
||||||
|
from_secret: pypi_username
|
|
@ -2,4 +2,5 @@ FROM python:3.10
|
||||||
COPY . /tmp/package
|
COPY . /tmp/package
|
||||||
RUN pip install --no-cache-dir /tmp/package && \
|
RUN pip install --no-cache-dir /tmp/package && \
|
||||||
rm -r /tmp/package
|
rm -r /tmp/package
|
||||||
|
EXPOSE 8000
|
||||||
ENTRYPOINT ["ecommerce-exporter"]
|
ENTRYPOINT ["ecommerce-exporter"]
|
|
@ -1,6 +1,6 @@
|
||||||
# ecommerce-exporter
|
# ecommerce-exporter
|
||||||
|
|
||||||
ecommerce-exporter is a [prometheus](https://prometheus.io/) exporter that webscrape the storefront of various ecommerces and expose the price of their products as prometheus metrics. These metrics can then be used to graph the pricing evolution over time, send alerts when the price drop, or to easily compare the price of a product on many ecommerces at once.
|
ecommerce-exporter is a [prometheus](https://prometheus.io/) exporter that webscrape the storefront of various e-commerces and expose the price of their products as prometheus metrics. These metrics can then be used to graph the pricing evolution over time, send alerts when the price drop, or to easily compare the price of a product on many e-commerces at once.
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
|
@ -13,14 +13,14 @@ This is the recommended way of running the exporter.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Download the [example configuration file](ecommerce-exporter.example.yml) and edit it to configure the ecommerce sites you wish to scrape. You can configure multiple products and multiple targets in the same configuration file.
|
Download the [example configuration file](ecommerce-exporter.example.yml) and edit it to configure the e-commerce sites you wish to scrape. You can configure multiple products and multiple targets in the same configuration file.
|
||||||
|
|
||||||
Assuming you named your configuration file `ecommerce-exporter.yml`, you can use the following command to run the exporter with docker:
|
Assuming you named your configuration file `ecommerce-exporter.yml`, you can use the following command to run the exporter with docker:
|
||||||
``` sh
|
``` sh
|
||||||
docker run -v "$PWD/ecommerce-exporter.yml:/ecommerce-exporter.yml" -p 8000:8000 badjware/ecommerce-exporter
|
docker run -v "$PWD/ecommerce-exporter.yml:/ecommerce-exporter.yml" -p 8000:8000 badjware/ecommerce-exporter
|
||||||
```
|
```
|
||||||
|
|
||||||
The prices of the configured products will start being scraped and exposed on http://localhost:8000/metrics. You can then configure [prometheus](https://prometheus.io/) to scrape that endpoint. It is recommended to set the scrape interval to be the same as the webscrape interval of the exporter (15m by default).
|
The prices of the configured products will start being scraped and exposed on http://localhost:8000/metrics. You can then configure [prometheus to scrape that endpoint](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config). It is recommended to set the scrape interval to be the same as the webscrape interval of the exporter (15m by default).
|
||||||
|
|
||||||
A full list of available flags can be printed using `-h`:
|
A full list of available flags can be printed using `-h`:
|
||||||
```
|
```
|
||||||
|
@ -63,7 +63,7 @@ Below is a table with examples of some CSS selectors that match the html element
|
||||||
|
|
||||||
| site | selector |
|
| site | selector |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| amazon.ca | `.a-offscreen::text` |
|
| amazon.ca | `.priceToPay .a-offscreen::text` |
|
||||||
| canadacomputer.com | `.price-show-panel .h2-big strong::text` |
|
| canadacomputer.com | `.price-show-panel .h2-big strong::text` |
|
||||||
| memoryexpress.com | `.GrandTotal` |
|
| memoryexpress.com | `.GrandTotal` |
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
[metadata]
|
[metadata]
|
||||||
name = ecommerce-exporter
|
name = ecommerce-exporter
|
||||||
|
description = ecommerce-exporter is a prometheus exporter that export the price of products in e-commerce site as prometheus metrics.
|
||||||
author = badjware
|
author = badjware
|
||||||
author_email = marchambault.badjware.dev
|
author_email = marchambault.badjware.dev
|
||||||
|
licence = MIT Licence
|
||||||
|
classifers =
|
||||||
|
Programming Language :: Python
|
||||||
platform = any
|
platform = any
|
||||||
|
|
||||||
[options]
|
[options]
|
||||||
|
|
5
setup.py
5
setup.py
|
@ -1,7 +1,12 @@
|
||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
from setuptools import find_packages
|
from setuptools import find_packages
|
||||||
|
|
||||||
|
with open('README.md') as f:
|
||||||
|
readme = f.read()
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
use_scm_version=True,
|
use_scm_version=True,
|
||||||
packages=find_packages(),
|
packages=find_packages(),
|
||||||
|
long_description=readme,
|
||||||
|
long_description_content_type='text/markdown',
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue