semvec/pypi-packages huggingface dataset:
opentelemetry-resourcedetector-gcp 1.11.0a0
Google Cloud resource detector for OpenTelemetry
License: Apache-2.0
Requires Python: >=3.9

OpenTelemetry Google Cloud Resource Detector
============================================

.. image:: https://badge.fury.io/py/opentelemetry-resourcedetector-gcp.svg
    :target: https://badge.fury.io/py/opentelemetry-resourcedetector-gcp

.. 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 detecting GCP resources like GCE, GKE, etc.

To get started with instrumentation in Google Cloud, see `Generate traces and metrics with
Python <https://cloud.google.com/stackdriver/docs/instrumentation/setup/python>`_.

To learn more about instrumentation and observability, including opinionated recommendations
for Google Cloud Observability, visit `Instrumentation and observability
<https://cloud.google.com/stackdriver/docs/instrumentation/overview>`_.

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

.. code:: bash

    pip install opentelemetry-resourcedetector-gcp

Usage
-----

.. code:: python

    from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
    from opentelemetry.sdk.trace import TracerProvider
    from opentelemetry.sdk.trace.export import BatchSpanProcessor
    from opentelemetry import trace
    from opentelemetry.sdk.resources import SERVICE_INSTANCE_ID, Resource

    # This will use the GooglecloudResourceDetector under the covers.
    resource = Resource.create(
        attributes={
            # Use the PID as the service.instance.id to avoid duplicate timeseries
            # from different Gunicorn worker processes.
            SERVICE_INSTANCE_ID: f"worker-{os.getpid()}",
        }
    )
    traceProvider = TracerProvider(resource=resource)
    processor = BatchSpanProcessor(OTLPSpanExporter())
    traceProvider.add_span_processor(processor)
    trace.set_tracer_provider(traceProvider)

References
----------

* `Cloud Monitoring <https://cloud.google.com/monitoring>`_
* `OpenTelemetry Project <https://opentelemetry.io/>`_
opentelemetry-propagator-gcp 1.11.0
Google Cloud propagator for OpenTelemetry
License: Apache-2.0
Requires Python: >=3.9

OpenTelemetry Google Cloud Propagator
======================================

.. image:: https://badge.fury.io/py/opentelemetry-propagator-gcp.svg
    :target: https://badge.fury.io/py/opentelemetry-propagator-gcp

.. 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 propagating trace context in the Google
Cloud ``X-Cloud-Trace-Context`` format.

To get started with instrumentation in Google Cloud, see `Generate traces and metrics with
Python <https://cloud.google.com/stackdriver/docs/instrumentation/setup/python>`_.

To learn more about instrumentation and observability, including opinionated recommendations
for Google Cloud Observability, visit `Instrumentation and observability
<https://cloud.google.com/stackdriver/docs/instrumentation/overview>`_.

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

.. code:: bash

    pip install opentelemetry-propagator-gcp

Usage
-----

The ``CloudTraceOneWayPropagator`` reads the Google Cloud
``X-Cloud-Trace-Context`` format, but does not write the
``X-Cloud-Trace-Context`` header on outgoing requests. It is intended for use
with a CompositePropagator as below.

.. code-block:: python

    from opentelemetry.propagate import set_global_textmap
    from opentelemetry.propagators.composite import CompositePropagator
    from opentelemetry.propagators.cloud_trace_propagator import (
        CloudTraceOneWayPropagator,
    )
    set_global_textmap(
        CompositePropagator([
            CloudTraceOneWayPropagator(),
            propagate.get_global_textmap(),
        ]),
    )

The ``CloudTraceFormatPropagator`` reads and writes the
``X-Cloud-Trace-Context`` header formats. Note that when using this propagator,
the ``sampled`` bit is interpreted as the ``TRACE_TRUE`` flag, which may cause a
higher sampling rate than desired. See the `Trace documentation
<https://cloud.google.com/trace/docs/setup#force-trace>` for additional context.

.. code-block:: python

    from opentelemetry.propagate import set_global_textmap
    from opentelemetry.propagators.cloud_trace_propagator import (
        CloudTraceFormatPropagator,
    )

    # Set the X-Cloud-Trace-Context header
    set_global_textmap(CloudTraceFormatPropagator())
.. code-block:: python

    from opentelemetry.propagate import set_global_textmap
    from opentelemetry.propagators.cloud_trace_propagator import (
        CloudTraceFormatPropagator,
    )

    # Set the X-Cloud-Trace-Context header
    set_global_textmap(CloudTraceFormatPropagator())


References
----------

* `Cloud Trace <https://cloud.google.com/trace/>`_
* `OpenTelemetry Project <https://opentelemetry.io/>`_
opentelemetry-exporter-gcp-trace 1.11.0
Google Cloud Trace exporter for OpenTelemetry
License: Apache-2.0
Requires Python: >=3.9

OpenTelemetry Google Cloud Integration
======================================

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

.. 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.

To get started with instrumentation in Google Cloud, see `Generate traces and metrics with
Python <https://cloud.google.com/stackdriver/docs/instrumentation/setup/python>`_.

To learn more about instrumentation and observability, including opinionated recommendations
for Google Cloud Observability, visit `Instrumentation and observability
<https://cloud.google.com/stackdriver/docs/instrumentation/overview>`_.

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

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

.. code:: bash

    pip install opentelemetry-exporter-gcp-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 (
        SimpleSpanProcessor,
    )

    trace.set_tracer_provider(TracerProvider())

    cloud_trace_exporter = CloudTraceSpanExporter(
        project_id='my-gcloud-project',
    )
    trace.get_tracer_provider().add_span_processor(
        SimpleSpanProcessor(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/>`_
opentelemetry-exporter-gcp-monitoring 1.11.0a0
Google Cloud Monitoring exporter for OpenTelemetry
License: Apache-2.0
Requires Python: >=3.9

OpenTelemetry Google Cloud Monitoring Exporter
==============================================

.. image:: https://badge.fury.io/py/opentelemetry-exporter-gcp-monitoring.svg
    :target: https://badge.fury.io/py/opentelemetry-exporter-gcp-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 metrics to Google Cloud
Monitoring.

To get started with instrumentation in Google Cloud, see `Generate traces and metrics with
Python <https://cloud.google.com/stackdriver/docs/instrumentation/setup/python>`_.

To learn more about instrumentation and observability, including opinionated recommendations
for Google Cloud Observability, visit `Instrumentation and observability
<https://cloud.google.com/stackdriver/docs/instrumentation/overview>`_.

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

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

.. code:: bash

    pip install opentelemetry-exporter-gcp-monitoring

Usage
-----

.. code:: python

    import time

    from opentelemetry import metrics
    from opentelemetry.exporter.cloud_monitoring import (
        CloudMonitoringMetricsExporter,
    )
    from opentelemetry.sdk.metrics import MeterProvider
    from opentelemetry.sdk.metrics.export import PeriodicExportingMetricReader
    from opentelemetry.sdk.resources import Resource

    metrics.set_meter_provider(
        MeterProvider(
            metric_readers=[
                PeriodicExportingMetricReader(
                    CloudMonitoringMetricsExporter(), export_interval_millis=5000
                )
            ],
            resource=Resource.create(
                {
                    "service.name": "basic_metrics",
                    "service.namespace": "examples",
                    "service.instance.id": "instance123",
                }
            ),
        )
    )
    meter = metrics.get_meter(__name__)

    # Creates metric workload.googleapis.com/request_counter with monitored resource generic_task
    requests_counter = meter.create_counter(
        name="request_counter",
        description="number of requests",
        unit="1",
    )

    staging_labels = {"environment": "staging"}

    for i in range(20):
        requests_counter.add(25, staging_labels)
        time.sleep(5)


References
----------

* `Cloud Monitoring <https://cloud.google.com/monitoring>`_
* `OpenTelemetry Project <https://opentelemetry.io/>`_