Skip to content

Commit

Permalink
Merge pull request #1 from skecskes/feature/refreshing-updates
Browse files Browse the repository at this point in the history
refresh repo
  • Loading branch information
skecskes authored Feb 7, 2024
2 parents c340ab1 + 5e26662 commit 7e72653
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 20 deletions.
13 changes: 7 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Contributing to Faust-Prometheus

Documentation for Faust-Prometheus is available in the Faust-Prometheus [repo]( https://github.com/woodmac/Faust-Prometheus/README.md )
Documentation for Faust-Prometheus is available in the Faust-Prometheus [repo]( https://github.com/skecskes/faust-prometheus/README.md )

The Faust-Prometheus team is following a very simple branching model. We use [master](https://github.com/woodmac/Faust-Prometheus/tree/master) as the production branch and all other branches for features or bugs. We do not maintain a dev only branch, staging, etc.
The Faust-Prometheus team is following a very simple branching model. We use [master](https://github.com/skecskes/faust-prometheus/tree/master) as the production branch and all other branches for features or bugs. We do not maintain a dev only branch, staging, etc.

Contributions will be accepted to the [master](https://github.com/woodmac/Faust-Prometheus/tree/master) only.
Contributions will be accepted to the [master](https://github.com/skecskes/faust-prometheus/tree/master) only.

## How to provide a pull request/patch for a new feature

1. If it is a major feature, please create an [Issue]( https://github.com/woodmac/Faust-Prometheus/issues ) and discuss it with the project leaders.
1. If it is a major feature, please create an [Issue]( https://github.com/skecskes/faust-prometheus/issues ) and discuss it with the project leaders.

2. If in step 1 you get an acknowledgement from the project leaders, use the
following procedure to submit a pull request:
Expand All @@ -25,8 +25,9 @@ Contributions will be accepted to the [master](https://github.com/woodmac/Faust-

f. We'll review your pull request and merge when approved!

For minor fixes just create a patch to the [master]( https://github.com/woodmac/Faust-Prometheus/tree/master ) branch on Github.
For minor fixes just create a patch to the [master]( https://github.com/skecskes/faust-prometheus/tree/master ) branch
on GitHub.

## Questions

If you have questions or want to report a bug please create an [Issue]( https://github.com/woodmac/Faust-Prometheus/issues)
If you have questions or want to report a bug please create an [Issue]( https://github.com/skecskes/faust-prometheus/issues)
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2020, Wood Mackenzie Ltd.
Copyright (c) 2023, Stefan Kecskes
All rights reserved.

Faust Prometheus is licensed under The BSD License (3 Clause, also known as
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# Faust Prometheus

This library uses sensors of Faust. Those sensors are events based. Our monitor implements that interface and hooks some actions when those events happen. That allows us to create our own prometheus `Counters`, `Gauges` and `Histograms`.
This library uses sensors of Faust. Those sensors are events based. Our monitor implements that interface and hooks some
actions when those events happen. That allows us to create our own prometheus `Counters`, `Gauges` and `Histograms`.
I created some predefined metrics, but we can expand on them in the future.

## Installation

To use this library in your faust project just add `faustprometheus` or install it through pip:
To use this library in your faust project just add `faust-prometheus` or install it through pip:


pip install faustprometheus
pip install faust-prometheus


## Usage
Expand Down
6 changes: 4 additions & 2 deletions faustprometheus/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ def __init__(self, app: AppT, pm_config: PrometheusMonitorConfig = None, **kwarg

# TODO: for now turn off default python garbage collection metrics.
# If needed later, look into implementing them with labels
def _python_gc_metrics(self, remove: bool = True):
@staticmethod
def _python_gc_metrics(remove: bool = True):
collectors = REGISTRY._names_to_collectors.values()
for name in list(collectors):
with suppress(KeyError):
Expand All @@ -100,7 +101,8 @@ def on_stream_event_in(self, tp: TP, offset: int, stream: StreamT,

return state

def _normalize(self, name: str,
@staticmethod
def _normalize(name: str,
*,
pattern: typing.Pattern = RE_NORMALIZE,
substitution: str = RE_NORMALIZE_SUBSTITUTION) -> str:
Expand Down
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
long_description = fh.read()

setup(
name='faustprometheus',
name='faust-prometheus',
version="0.0.6",
author='Wood Mackenzie',
author='Stefan Kecskes',
author_email='[email protected]',
description="WoodMac's Faust Prometheus Library",
description="Prometheus metrics for Faust stream processing framework",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/woodmac/faust-prometheus",
url="https://github.com/skecskes/faust-prometheus",
packages=find_packages(),
classifiers=[
"Programming Language :: Python :: 3.6",
Expand Down
9 changes: 5 additions & 4 deletions tests/test_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@

class TestPrometheusMonitor:

def time(self):
timefun = Mock(name='time()')
timefun.return_value = 101.1
return timefun
@staticmethod
def time():
time_fun = Mock(name='time()')
time_fun.return_value = 101.1
return time_fun

@patch.object(PrometheusMonitor, 'expose_metrics')
def prometheus_client(self, app, time=None):
Expand Down

0 comments on commit 7e72653

Please sign in to comment.