Skip to content

Commit

Permalink
move ambiguous version.py files
Browse files Browse the repository at this point in the history
  • Loading branch information
aabmass committed Apr 5, 2021
1 parent 88b7786 commit 6067bd8
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 84 deletions.
42 changes: 8 additions & 34 deletions opentelemetry-exporter-cloud-monitoring/README.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
OpenTelemetry Google Cloud Integration
======================================
OpenTelemetry Google Cloud Monitoring Exporter
==============================================

.. image:: https://badge.fury.io/py/opentelemetry-exporter-cloud-monitoring.svg
:target: https://badge.fury.io/py/opentelemetry-exporter-cloud-monitoring
Expand All @@ -8,14 +8,14 @@ OpenTelemetry Google Cloud Integration
: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
This library provides support for 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/>`_.
<https://pypi.org/project/opentelemetry-tools-google-cloud/>`_. For the
Google Cloud Trace exporter, see `opentelemetry-exporter-cloud-trace
<https://pypi.org/project/opentelemetry-exporter-cloud-trace/>`_.

Installation
------------
Expand All @@ -27,32 +27,6 @@ Installation
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
Expand Down Expand Up @@ -87,5 +61,5 @@ Metrics
References
----------

* `Cloud Trace <https://cloud.google.com/trace/>`_
* `Cloud Monitoring <https://cloud.google.com/monitoring>`_
* `OpenTelemetry Project <https://opentelemetry.io/>`_
7 changes: 6 additions & 1 deletion opentelemetry-exporter-cloud-monitoring/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@

BASE_DIR = os.path.dirname(__file__)
VERSION_FILENAME = os.path.join(
BASE_DIR, "src", "opentelemetry", "exporter", "google", "version.py",
BASE_DIR,
"src",
"opentelemetry",
"exporter",
"cloud_monitoring",
"version.py",
)
PACKAGE_INFO = {}
with open(VERSION_FILENAME) as f:
Expand Down
45 changes: 5 additions & 40 deletions opentelemetry-exporter-cloud-trace/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ OpenTelemetry Google Cloud Integration
: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
This library provides support for exporting traces to Google Cloud Trace.

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

Installation
------------
Expand All @@ -27,8 +27,6 @@ Installation
Usage
-----

Traces

.. code:: python
from opentelemetry import trace
Expand All @@ -51,39 +49,6 @@ Traces
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
----------

Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-exporter-cloud-trace/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

BASE_DIR = os.path.dirname(__file__)
VERSION_FILENAME = os.path.join(
BASE_DIR, "src", "opentelemetry", "exporter", "google", "version.py",
BASE_DIR, "src", "opentelemetry", "exporter", "cloud_trace", "version.py",
)
PACKAGE_INFO = {}
with open(VERSION_FILENAME) as f:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@
from google.cloud.trace_v2.proto import trace_pb2
from google.protobuf.timestamp_pb2 import Timestamp
from google.rpc import code_pb2, status_pb2
from opentelemetry.exporter.google.version import (
__version__ as google_ext_version,
)
from opentelemetry.exporter.cloud_trace.version import __version__
from opentelemetry.sdk.resources import Resource
from opentelemetry.sdk.trace import Event
from opentelemetry.sdk.trace.export import Span, SpanExporter, SpanExportResult
Expand Down Expand Up @@ -417,7 +415,7 @@ def _extract_attributes(
_strip_characters(
pkg_resources.get_distribution("opentelemetry-sdk").version
),
_strip_characters(google_ext_version),
_strip_characters(__version__),
)
)
return trace_pb2.Span.Attributes(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@
_strip_characters,
_truncate_str,
)
from opentelemetry.exporter.google.version import (
__version__ as google_ext_version,
)
from opentelemetry.exporter.cloud_trace.version import __version__
from opentelemetry.sdk.resources import Resource
from opentelemetry.sdk.trace import Event
from opentelemetry.sdk.trace import _Span as Span
Expand Down Expand Up @@ -90,7 +88,7 @@ def setUpClass(cls):
_strip_characters(
pkg_resources.get_distribution("opentelemetry-sdk").version
),
_strip_characters(google_ext_version),
_strip_characters(__version__),
)
)
cls.example_trace_id = "6e0c63257de34c92bf9efcd03927272e"
Expand Down

0 comments on commit 6067bd8

Please sign in to comment.