Skip to content

Commit

Permalink
separate trace/metrics packages out for staggered 1.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
aabmass committed Apr 2, 2021
1 parent 9c2e587 commit 94548c1
Show file tree
Hide file tree
Showing 27 changed files with 489 additions and 19 deletions.
4 changes: 2 additions & 2 deletions docs/cloud_monitoring/cloud_monitoring.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
OpenTelemetry Cloud Monitoring Exporter
=======================================

.. image:: https://badge.fury.io/py/opentelemetry-exporter-google-cloud.svg
:target: https://badge.fury.io/py/opentelemetry-exporter-google-cloud
.. image:: https://badge.fury.io/py/opentelemetry-exporter-cloud-monitoring.svg
:target: https://badge.fury.io/py/opentelemetry-exporter-cloud-monitoring

.. automodule:: opentelemetry.exporter.cloud_monitoring
:members:
Expand Down
4 changes: 2 additions & 2 deletions docs/cloud_trace/cloud_trace.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
OpenTelemetry Cloud Trace Exporter
==================================

.. image:: https://badge.fury.io/py/opentelemetry-exporter-google-cloud.svg
:target: https://badge.fury.io/py/opentelemetry-exporter-google-cloud
.. image:: https://badge.fury.io/py/opentelemetry-exporter-cloud-trace.svg
:target: https://badge.fury.io/py/opentelemetry-exporter-cloud-trace

.. automodule:: opentelemetry.exporter.cloud_trace
:members:
Expand Down
File renamed without changes.
91 changes: 91 additions & 0 deletions opentelemetry-exporter-cloud-monitoring/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
OpenTelemetry Google Cloud Integration
======================================

.. image:: https://badge.fury.io/py/opentelemetry-exporter-cloud-monitoring.svg
:target: https://badge.fury.io/py/opentelemetry-exporter-cloud-monitoring

.. image:: https://readthedocs.org/projects/google-cloud-opentelemetry/badge/?version=latest
:target: https://google-cloud-opentelemetry.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status

This library provides support for:

- Exporting traces to Google Cloud Trace
- Exporting metrics to Google Cloud Monitoring

For resource detection and GCP trace context propagation, see
`opentelemetry-tools-google-cloud
<https://pypi.org/project/opentelemetry-tools-google-cloud/>`_.

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

.. code:: bash
pip install opentelemetry-exporter-cloud-monitoring
Usage
-----

Traces

.. 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!')
Metrics

.. code:: python
import time
from opentelemetry import metrics
from opentelemetry.exporter.cloud_monitoring import (
CloudMonitoringMetricsExporter,
)
from opentelemetry.sdk.metrics import Counter, MeterProvider
metrics.set_meter_provider(MeterProvider())
meter = metrics.get_meter(__name__)
metrics.get_meter_provider().start_pipeline(
meter, CloudMonitoringMetricsExporter(), 5
)
requests_counter = meter.create_counter(
name="request_counter",
description="number of requests",
unit="1",
value_type=int
)
staging_labels = {"environment": "staging"}
for i in range(20):
requests_counter.add(25, staging_labels)
time.sleep(10)
References
----------

* `Cloud Trace <https://cloud.google.com/trace/>`_
* `OpenTelemetry Project <https://opentelemetry.io/>`_
36 changes: 36 additions & 0 deletions opentelemetry-exporter-cloud-monitoring/setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[metadata]
name = opentelemetry-exporter-cloud-monitoring
description = Google Cloud Monitoring exporter for OpenTelemetry
long_description = file: README.rst
long_description_content_type = text/x-rst
author = Google
author_email = [email protected]
url = https://github.com/GoogleCloudPlatform/opentelemetry-operations-python/tree/master/opentelemetry-exporter-cloud-monitoring
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.5
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8

[options]
python_requires = >=3.5
package_dir=
=src
packages=find_namespace:
install_requires =
google-cloud-monitoring <2.0.0
opentelemetry-api ~= 0.17b0
opentelemetry-sdk ~= 0.17b0

[options.packages.find]
where = src

[options.extras_require]
test =
67 changes: 67 additions & 0 deletions opentelemetry-exporter-cloud-trace/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Changelog

## Unreleased

## Version 0.17b0

Released 2021-02-04

## Version 0.16b1

Released 2021-01-14

- Add mapping between opentelemetry and google traces attributes
([#90](https://github.com/GoogleCloudPlatform/opentelemetry-operations-python/pull/90))

## Version 0.15b0

Released 2020-11-04

## Version 0.14b0

Released 2020-10-27

- Fix breakages for opentelemetry-python v0.14b0
([#79](https://github.com/GoogleCloudPlatform/opentelemetry-operations-python/pull/79),
[#83](https://github.com/GoogleCloudPlatform/opentelemetry-operations-python/pull/83))

## Version 0.13b0

Released 2020-09-17

## Version 0.12b0

Released 2020-08-17

- Add spankind support for trace exporter
([#58](https://github.com/GoogleCloudPlatform/opentelemetry-operations-python/pull/58))

## Version 0.11b0

Released 2020-08-05

- Add support for resources
([#853](https://github.com/open-telemetry/opentelemetry-python/pull/853))

## Version 0.10b0

Released 2020-06-23

- Add g.co/agent label for Google internal metrics tracking
([#833](https://github.com/open-telemetry/opentelemetry-python/pull/833))
- Adding trouble-shooting tips
([#827](https://github.com/open-telemetry/opentelemetry-python/pull/827))
- Added Cloud Trace context propagation
([#819](https://github.com/open-telemetry/opentelemetry-python/pull/819))
- Added tests to tox coverage files
([#804](https://github.com/open-telemetry/opentelemetry-python/pull/804))
- Add ability for exporter to add unique identifier
([#841](https://github.com/open-telemetry/opentelemetry-python/pull/841))
- Added tests to tox coverage files
([#804](https://github.com/open-telemetry/opentelemetry-python/pull/804))

## 0.9b0

Released 2020-06-10

- Initial release
Loading

0 comments on commit 94548c1

Please sign in to comment.