Skip to main content

Google Cloud Monitoring exporter for OpenTelemetry

Project description

https://badge.fury.io/py/opentelemetry-exporter-gcp-monitoring.svg Documentation Status

This library provides support for exporting metrics to Google Cloud Monitoring.

For resource detection and GCP trace context propagation, see opentelemetry-tools-google-cloud. For the Google Cloud Trace exporter, see opentelemetry-exporter-gcp-trace.

Installation

pip install opentelemetry-exporter-gcp-monitoring

Usage

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

File details

Details for the file opentelemetry-exporter-gcp-monitoring-1.2.0a0.tar.gz.

File metadata

File hashes

Hashes for opentelemetry-exporter-gcp-monitoring-1.2.0a0.tar.gz
Algorithm Hash digest
SHA256 98ef1a761d3fd95012df614974aa7f7a205a8ca70a0b1cac1e690aba938c6450
MD5 3424bb898d2e8034c01a4bb7a63c0d88
BLAKE2b-256 daf2b04e46e0666dc3f680c821ca0a629f527f4fa97d96ef9254c746a5659ca5

See more details on using hashes here.

Provenance

File details

Details for the file opentelemetry_exporter_gcp_monitoring-1.2.0a0-py3-none-any.whl.

File metadata

File hashes

Hashes for opentelemetry_exporter_gcp_monitoring-1.2.0a0-py3-none-any.whl
Algorithm Hash digest
SHA256 91fc6c43505cd0fceaba4eed47f25c72e26377dc23897d983507aec3086e3353
MD5 74b2f6206382081e0c6532cd92e380c9
BLAKE2b-256 e329ab6a64130464a635a223b6af7f8e606b1ffe73ecb314cb7c5c7392d8311c

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page