pip install sb-opentelemetry-extension-exporter-otlp-proto-http
Usage:
from opentelemetry import metrics
from opentelemetry.sdk.resources import SERVICE_NAME, Resource
from opentelemetry.sdk.metrics import MeterProvider
from opentelemetry.sdk.metrics.export import PeriodicExportingMetricReader
from opentelemetry.extension.exporter.otlp.proto.http.metric_exporter import OTLPMetricExporter
resource = Resource(attributes={
SERVICE_NAME: "service",
})
metric_reader = PeriodicExportingMetricReader(OTLPMetricExporter())
provider = MeterProvider(resource=resource, metric_readers=[metric_reader])
# Sets the global default meter provider
metrics.set_meter_provider(provider)
This project is licensed under the MIT LICENSE.