Skip to content

Commit

Permalink
Merge branch 'master' into fix/requests-none-header-argument
Browse files Browse the repository at this point in the history
  • Loading branch information
HiveTraum authored Jun 8, 2020
2 parents f330aca + b108596 commit 95d132a
Show file tree
Hide file tree
Showing 165 changed files with 4,578 additions and 277 deletions.
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ Meeting notes are available as a public [Google doc](https://docs.google.com/doc

Approvers ([@open-telemetry/python-approvers](https://github.com/orgs/open-telemetry/teams/python-approvers)):

- [Alex Boten](https://github.com/codeboten), LightStep
- [Carlos Alberto Cortez](https://github.com/carlosalberto), LightStep
- [Christian Neumüller](https://github.com/Oberon00), Dynatrace
- [Chris Kleinknecht](https://github.com/c24t), Google
- [Diego Hurtado](https://github.com/ocelotl)
- [Hector Hernandez](https://github.com/hectorhdzg), Microsoft
- [Leighton Chen](https://github.com/lzchen), Microsoft
- [Mauricio Vásquez](https://github.com/mauriciovasquezbernal), Kinvolk
Expand All @@ -115,9 +115,15 @@ Approvers ([@open-telemetry/python-approvers](https://github.com/orgs/open-telem

Maintainers ([@open-telemetry/python-maintainers](https://github.com/orgs/open-telemetry/teams/python-maintainers)):

- [Chris Kleinknecht](https://github.com/c24t), Google
- [Alex Boten](https://github.com/codeboten), LightStep
- [Yusuke Tsutsumi](https://github.com/toumorokoshi), Zillow Group

### Thanks to all the people who already contributed!

<a href="https://github.com/open-telemetry/opentelemetry-python/graphs/contributors">
<img src="https://contributors-img.web.app/image?repo=open-telemetry/opentelemetry-python" />
</a>

*Find more about the maintainer role in [community repository](https://github.com/open-telemetry/community/blob/master/community-membership.md#maintainer).*

## Release Schedule
Expand Down
4 changes: 3 additions & 1 deletion RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
This document explains how to publish all OT modules at version x.y.z. Ensure that you’re following semver when choosing a version number.

Release Process:
* [Checkout a clean repo](#checkout-a-clean-repo)
* [Create a new branch](#create-a-new-branch)
* [Open a Pull Request](#open-a-pull-request)
* [Create a Release](#Create-a-Release)
Expand All @@ -10,6 +11,8 @@ Release Process:
* [Check PyPI](#Check-PyPI)
* [Troubleshooting](#troubleshooting)

## Checkout a clean repo
- To avoid pushing untracked changes, check out the repo in a new dir

## Create a new branch
The following script does the following:
Expand Down Expand Up @@ -74,7 +77,6 @@ git commit -m

If for some reason the action failed, do it manually:

- To avoid pushing untracked changes, check out the repo in a new dir
- Switch to the release branch (important so we don't publish packages with "dev" versions)
- Build distributions with `./scripts/build.sh`
- Delete distributions we don't want to push (e.g. `testutil`)
Expand Down
1 change: 1 addition & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ pytest!=5.2.3
pytest-cov>=2.8
readme-renderer~=24.0
httpretty~=1.0
opentracing~=2.2.0
7 changes: 5 additions & 2 deletions docs-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sphinx-autodoc-typehints~=1.10.2
# Required by ext packages
asgiref~=3.0
ddtrace>=0.34.0
aiohttp ~= 3.0
aiohttp~= 3.0
Deprecated>=1.2.6
django>=2.2
PyMySQL~=0.9.3
Expand All @@ -18,4 +18,7 @@ pymongo~=3.1
redis>=2.6
sqlalchemy>=1.0
thrift>=0.10.0
wrapt >=1.0.0,<2.0.0
wrapt>=1.0.0,<2.0.0
psutil~=5.7.0
boto~=2.0
google-cloud-trace >=0.23.0
2 changes: 1 addition & 1 deletion docs/examples/basic_meter/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ There are three different examples:

* observer: Shows how to use the observer instrument.

The source files of these examples are available :scm_web:`here <docs/examples/metrics/>`.
The source files of these examples are available :scm_web:`here <docs/examples/basic_meter/>`.

Installation
------------
Expand Down
32 changes: 8 additions & 24 deletions docs/examples/basic_meter/basic_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,39 +24,23 @@
import time

from opentelemetry import metrics
from opentelemetry.sdk.metrics import Counter, Measure, MeterProvider
from opentelemetry.sdk.metrics import Counter, MeterProvider, ValueRecorder
from opentelemetry.sdk.metrics.export import ConsoleMetricsExporter
from opentelemetry.sdk.metrics.export.controller import PushController

stateful = True


def usage(argv):
print("usage:")
print("{} [mode]".format(argv[0]))
print("mode: stateful (default) or stateless")


if len(sys.argv) >= 2:
batcher_mode = sys.argv[1]
if batcher_mode not in ("stateful", "stateless"):
print("bad mode specified.")
usage(sys.argv)
sys.exit(1)
stateful = batcher_mode == "stateful"

print(
"Starting example, values will be printed to the console every 5 seconds."
)


# Stateful determines whether how metrics are collected: if true, metrics
# accumulate over the process lifetime. If false, metrics are reset at the
# beginning of each collection interval.
metrics.set_meter_provider(MeterProvider(stateful))
# The Meter is responsible for creating and recording metrics. Each meter has a
# unique name, which we set as the module's name here. The second argument
# determines whether how metrics are collected: if true, metrics accumulate
# over the process lifetime. If false, metrics are reset at the beginning of
# each collection interval.
metrics.set_meter_provider(MeterProvider())
meter = metrics.get_meter(__name__, batcher_mode == "stateful")
# unique name, which we set as the module's name here.
meter = metrics.get_meter(__name__)

# Exporter to export metrics to the console
exporter = ConsoleMetricsExporter()
Expand All @@ -80,7 +64,7 @@ def usage(argv):
description="size of requests",
unit="1",
value_type=int,
metric_type=Measure,
metric_type=ValueRecorder,
label_keys=("environment",),
)

Expand Down
4 changes: 2 additions & 2 deletions docs/examples/basic_meter/calling_conventions.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import time

from opentelemetry import metrics
from opentelemetry.sdk.metrics import Counter, Measure, MeterProvider
from opentelemetry.sdk.metrics import Counter, MeterProvider, ValueRecorder
from opentelemetry.sdk.metrics.export import ConsoleMetricsExporter
from opentelemetry.sdk.metrics.export.controller import PushController

Expand All @@ -43,7 +43,7 @@
description="size of requests",
unit="1",
value_type=int,
metric_type=Measure,
metric_type=ValueRecorder,
label_keys=("environment",),
)

Expand Down
2 changes: 0 additions & 2 deletions docs/examples/basic_meter/observer.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
from opentelemetry.sdk.metrics.export.batcher import UngroupedBatcher
from opentelemetry.sdk.metrics.export.controller import PushController

# Configure a stateful batcher
batcher = UngroupedBatcher(stateful=True)
metrics.set_meter_provider(MeterProvider())
meter = metrics.get_meter(__name__)
exporter = ConsoleMetricsExporter()
Expand Down
34 changes: 34 additions & 0 deletions docs/examples/cloud_trace_exporter/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Cloud Trace Exporter Example
============================

These examples show how to use OpenTelemetry to send tracing data to Cloud Trace.


Basic Example
-------------

To use this exporter you first need to:
* A Google Cloud project. You can `create one here. <https://console.cloud.google.com/projectcreate>`_
* Enable Cloud Trace API (aka StackDriver Trace API) in the project `here. <https://console.cloud.google.com/apis/library?q=cloud_trace>`_
* Enable `Default Application Credentials. <https://developers.google.com/identity/protocols/application-default-credentials>`_

* Installation

.. code-block:: sh
pip install opentelemetry-api
pip install opentelemetry-sdk
pip install opentelemetry-exporter-cloud-trace
* Run example

.. code-block:: sh
python basic_trace.py
Checking Output
--------------------------

After running any of these examples, you can go to `Cloud Trace overview <https://console.cloud.google.com/traces/list>`_ to see the results.

* `More information about exporters in general <https://opentelemetry-python.readthedocs.io/en/stable/getting-started.html#configure-exporters-to-emit-spans-elsewhere>`_
14 changes: 14 additions & 0 deletions docs/examples/cloud_trace_exporter/basic_trace.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from opentelemetry import trace
from opentelemetry.exporter.cloud_trace import CloudTraceSpanExporter
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import SimpleExportSpanProcessor

trace.set_tracer_provider(TracerProvider())

cloud_trace_exporter = CloudTraceSpanExporter()
trace.get_tracer_provider().add_span_processor(
SimpleExportSpanProcessor(cloud_trace_exporter)
)
tracer = trace.get_tracer(__name__)
with tracer.start_as_current_span("foo"):
print("Hello world!")
2 changes: 1 addition & 1 deletion docs/examples/opentelemetry-example-app/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

setuptools.setup(
name="opentelemetry-example-app",
version="0.8.dev0",
version="0.9.dev0",
author="OpenTelemetry Authors",
author_email="[email protected]",
classifiers=[
Expand Down
7 changes: 7 additions & 0 deletions docs/ext/boto/boto.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
OpenTelemetry Boto Integration
==============================

.. automodule:: opentelemetry.ext.boto
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/ext/cloud_trace/cloud_trace.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
OpenTelemetry Cloud Trace Exporter
==================================

.. automodule:: opentelemetry.exporter.cloud_trace
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/ext/system_metrics/system_metrics.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
OpenTelemetry System Metrics Instrumentation
============================================

.. automodule:: opentelemetry.ext.system_metrics
:members:
:undoc-members:
:show-inheritance:
43 changes: 43 additions & 0 deletions ext/opentelemetry-exporter-cloud-trace/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
OpenTelemetry Cloud Trace Exporters
===================================

This library provides classes for exporting trace data to Google Cloud Trace.

Installation
------------

::

pip install opentelemetry-exporter-cloud-trace

Usage
-----

.. code:: python
from opentelemetry import trace
from opentelemetry.exporter.cloud_trace import CloudTraceSpanExporter
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import (
SimpleExportSpanProcessor,
)
trace.set_tracer_provider(TracerProvider())
cloud_trace_exporter = CloudTraceSpanExporter(
project_id='my-gcloud-project',
)
trace.get_tracer_provider().add_span_processor(
SimpleExportSpanProcessor(cloud_trace_exporter)
)
tracer = trace.get_tracer(__name__)
with tracer.start_as_current_span('foo'):
print('Hello world!')
References
----------

* `Cloud Trace <https://cloud.google.com/trace/>`_
* `OpenTelemetry Project <https://opentelemetry.io/>`_
47 changes: 47 additions & 0 deletions ext/opentelemetry-exporter-cloud-trace/setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Copyright OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
[metadata]
name = opentelemetry-exporter-cloud-trace
description = Cloud Trace integration for OpenTelemetry
long_description = file: README.rst
long_description_content_type = text/x-rst
author = OpenTelemetry Authors
author_email = [email protected]
url = https://github.com/open-telemetry/opentelemetry-python/ext/opentelemetry-exporter-cloud-trace
platforms = any
license = Apache-2.0
classifiers =
Development Status :: 4 - Beta
Intended Audience :: Developers
License :: OSI Approved :: Apache Software License
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.4
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7

[options]
python_requires = >=3.4
package_dir=
=src
packages=find_namespace:
install_requires =
opentelemetry-api
opentelemetry-sdk
google-cloud-trace

[options.packages.find]
where = src
26 changes: 26 additions & 0 deletions ext/opentelemetry-exporter-cloud-trace/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os

import setuptools

BASE_DIR = os.path.dirname(__file__)
VERSION_FILENAME = os.path.join(
BASE_DIR, "src", "opentelemetry", "exporter", "cloud_trace", "version.py"
)
PACKAGE_INFO = {}
with open(VERSION_FILENAME) as f:
exec(f.read(), PACKAGE_INFO)

setuptools.setup(version=PACKAGE_INFO["__version__"])
Loading

0 comments on commit 95d132a

Please sign in to comment.