Google Cloud Monitoring exporter for OpenTelemetry
Project description
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
Release history Release notifications | RSS feed
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.0.0a0.tar.gz
.
File metadata
- Download URL: opentelemetry-exporter-gcp-monitoring-1.0.0a0.tar.gz
- Upload date:
- Size: 15.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0cbb6dfa54d6f1e821e90f3c97db84c17b86c30bd854dc0542f58c1e30f2d478 |
|
MD5 | f572ac45b375eda8cb5273097d11eaf3 |
|
BLAKE2b-256 | 45fa658eb1a826573560d07307efe7ebd840273bc9600bdb89b06b61b0882985 |
Provenance
File details
Details for the file opentelemetry_exporter_gcp_monitoring-1.0.0a0-py3-none-any.whl
.
File metadata
- Download URL: opentelemetry_exporter_gcp_monitoring-1.0.0a0-py3-none-any.whl
- Upload date:
- Size: 12.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b5e80491fc1afd721bbabecab6a559fa951053164ff287904a384d764860a0f |
|
MD5 | b24f2a0b1fe67e1105af5f7419f157c0 |
|
BLAKE2b-256 | 13b14aa1cfe2146cd066b01b19b54e6c56bcf7da39903de2e9006e5d33bbe9c3 |