in ssiog/monitoring.py [0:0]
def initialize_monitoring_provider(exporter_type="console", export_interval_millis=10000):
"""Initializes and returns a configured OpenTelemetry MeterProvider
for Cloud Monitoring with GCP resource detection."""
if exporter_type == "console":
exporter = ConsoleMetricExporter()
elif exporter_type == "cloud":
exporter = CloudMonitoringMetricsExporter()
else:
raise ValueError(f"Unsupported exporter type: {exporter_type}")
metrics.set_meter_provider(
MeterProvider(
metric_readers=[
PeriodicExportingMetricReader(
exporter,
export_interval_millis=export_interval_millis,
)
],
# TODO (raj-prince): Implement gcp resource detector.
resource = get_aggregated_resources([GoogleCloudResourceDetector(raise_on_error=True)]