semvec/pypi-packages huggingface dataset:
stdin-to-cloudwatch 0.0.16
Intercepts json formatted metrics from process stdin and sends to AWS Cloudwatch
Requires Python: >=3

# stdin_to_cloudwatch

[![CircleCI](https://circleci.com/gh/jvalduvieco/stdin_to_cloudwatch/tree/master.svg?style=svg)](https://circleci.com/gh/jvalduvieco/stdin_to_cloudwatch/tree/master)
[![](https://img.shields.io/pypi/dm/stdin-to-cloudwatch.svg?style=plastic)](https://pypi.org/project/stdin-to-cloudwatch/)

This tool is intended to process input fromstdin and publish some metrics encoded in the log stream.
It looks for log lines that match a certain format and publishes to Cloudwatch metrics. The lines that not match are neither
filtered nor altered and are written to stdout.
The format for the metrics follows:
```json
{
  "Environ/SomeNamespace": 
    [
      {
        "AMetricName": 2558219, 
        "Units": "Milliseconds",
      }
    ]
}
```

Possible values for `Units` are:
```
"Seconds"|"Microseconds"|"Milliseconds"|"Bytes"|"Kilobytes"|"Megabytes"|"Gigabytes"|"Terabytes"|"Bits"|"Kilobits"|"Megabits"|"Gigabits"|"Terabits"|
"Percent"|"Count"|"Bytes/Second"|"Kilobytes/Second"|"Megabytes/Second"|"Gigabytes/Second"|"Terabytes/Second"|"Bits/Second"|"Kilobits/Second"|"Megabits/Second"|
"Gigabits/Second"|"Terabits/Second"|"Count/Second"|"None"
```

(Same as [`put-metric-data`](https://docs.aws.amazon.com/cli/latest/reference/cloudwatch/put-metric-data.html) units) 

## Usage
```
your_script | stdin_to_cloudwatch -i <django|none> -r <region> [-d <DimensionName=DimensionValue>]
```

Use `stdin_to_cloudwatch -h` for help.

AWS credentials are managed by boto3, so refer to boto [documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/guide/quickstart.html#configuration) for further information.

## Intention
Intention behind this tool is to decouple metrics publishing from the main app. With this tool publishing is a responsibility of infrastructure.
pygeneric 1.0.0b0
Generalize functools.singledispatch to multiple arguments.

========
Overview
========

What is pygeneric?
==================

`pygeneric` implements generic functions based on type dispatch in Python. A generic
function groups different implementations (or methods) under the same name.
The actual implementation is then chosen at runtime depending on the type of
each function argument.

The implementation is loosely inspired in the Julia language. We also shamelessly
steal some other features of Julia and adapted them to Python:

* Parametric types.
* A type conversion/promotion system integrated with arithmetic operations.
* A generic Object base class that delegates all binary operations to the
  corresponding generic functions (i.e., instead of implementing
  Object.__add__, we overload ``generic.op.add(Object, Object))``.

This package works with Python 3 and Python 2, but it is getting increasingly
more difficult to keep Python 2 support as we implement more advanced features.
Not all functionality works in Python 2, and sometimes extra precautions
are necessary. Pygeneric cannot handle old style classes and sometimes we are
limited by lack of some Python 3 only syntax. Python 2 also have some quirks
that we do not try to emulate (e.g., broken comparison operators), so pygeneric
uses an uniform Python 3 semantics.


Basic usage
===========

Most of the functionality present in this package works around the type dispatch
in generic functions. We declare a generic function using the syntax

.. code-block:: python

    from generic import generic, Number, Sequence

    @generic
    def func(x, y):
        print('Got %r and %r' % (x, y))


Type dispatch can be defined as

.. code-block:: python

    @func.register(Number, Number)
    def _(x, y):
        print('Got two numbers: %r and %r' % (x, y))


or

.. code-block:: python

    @func.overload
    def _(x: Number, y: Number):
        print('Got two numbers: %r and %r' % (x, y))



Depending on the types of each argument, the dispatcher will choose either one
of those two implementations

>>> func(42, 0.0)
Got two numbers: 42 and 0.0
>>> func("foo", "bar")
Got 'foo' and 'bar'


The type dispatch always chooses the most specialized method for the given
argument types.

Consider the two specialized dispatches

.. code-block:: python

    from numbers import Integral

    @func.overload
    def _(x: Integral, y: Number):
        print('Got one integer: %r and %s' % (x, y))

    @func.overload
    def _(x: Integral, y: Integral):
       print('Got two integers: %r and %s' % (x, y))


``func`` knows what to do

>>> func(1, 2)
Got two integers: 1 and 2
>>> func(1, 2.0)
Got one integer: 1 and 2.0
>>> func(2.0, 1)
Got two numbers: 2.0 and 1


Further information
===================

Did you find this feature useful? Then start using pygeneric now!
Check the documentation__ for additional information.

.. __documentation:: http://pythonhosted.org/pygeneric/