From 60520365d176fa58e0b422591863ccec248a7249 Mon Sep 17 00:00:00 2001 From: Azfaar Qureshi Date: Fri, 27 Nov 2020 17:16:15 -0500 Subject: [PATCH] fixing lint errors --- .../README.md | 11 ++++----- .../examples/sampleapp.py | 24 +++++++++---------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/exporter/opentelemetry-exporter-prometheus-remote-write/README.md b/exporter/opentelemetry-exporter-prometheus-remote-write/README.md index 92a37f6314..8f8889bc35 100644 --- a/exporter/opentelemetry-exporter-prometheus-remote-write/README.md +++ b/exporter/opentelemetry-exporter-prometheus-remote-write/README.md @@ -18,7 +18,7 @@ The controller periodically collects data and passes it to the exporter. This exporter then converts the data into [`timeseries`](https://prometheus.io/docs/concepts/data_model/) and sends it to the Remote Write integrated backend through HTTP POST requests. The metrics collection datapath is shown below: -![Metrics collection datapath](https://user-images.githubusercontent.com/20804975/100286063-157f2a80-2f40-11eb-819d-f0aa46c1c2c8.png) +![controller_datapath_final](https://user-images.githubusercontent.com/20804975/100486582-79d1f380-30d2-11eb-8d17-d3e58e5c34e9.png) See the `example` folder for a demo usage of this exporter @@ -138,11 +138,10 @@ Users can add TLS to the exporter's HTTP Client by providing certificate and key * Histogram * LastValue * ValueObserver -* Summary ## Error Handling -In general, errors are returned to the calling function. The exception is for -the exporter's `export()` method where any error status code is logged as a +In general, errors are raised by the calling function. The exception is for +failed requests where any error status code is logged as a warning instead. This is because the exporter does not implement any retry logic @@ -172,5 +171,5 @@ If you would like to learn more about the exporter's structure and design decisi [Design Document](TODO: add link) -This document is not in this repo as it contains large images which will -significantly increase the size this repo. +This document is stored elsewhere as it contains large images which will +significantly increase the size of this repo. diff --git a/exporter/opentelemetry-exporter-prometheus-remote-write/examples/sampleapp.py b/exporter/opentelemetry-exporter-prometheus-remote-write/examples/sampleapp.py index 8dc25f3440..69f7a068ea 100644 --- a/exporter/opentelemetry-exporter-prometheus-remote-write/examples/sampleapp.py +++ b/exporter/opentelemetry-exporter-prometheus-remote-write/examples/sampleapp.py @@ -1,26 +1,27 @@ -from logging import INFO -from opentelemetry.sdk.metrics.export.aggregate import MinMaxSumCountAggregator -import psutil -import time -import random import logging +import random import sys +import time +from logging import INFO + +import psutil + from opentelemetry import metrics -from opentelemetry.sdk.metrics import MeterProvider from opentelemetry.exporter.prometheus_remote_write import ( PrometheusRemoteWriteMetricsExporter, ) -from opentelemetry.sdk.metrics.view import View, ViewConfig - +from opentelemetry.sdk.metrics import MeterProvider from opentelemetry.sdk.metrics.export.aggregate import ( HistogramAggregator, LastValueAggregator, MinMaxSumCountAggregator, SumAggregator, ) +from opentelemetry.sdk.metrics.view import View, ViewConfig logging.basicConfig(stream=sys.stdout, level=logging.INFO) logger = logging.getLogger(__name__) + metrics.set_meter_provider(MeterProvider()) meter = metrics.get_meter(__name__) exporter = PrometheusRemoteWriteMetricsExporter( @@ -114,18 +115,17 @@ def get_ram_usage_callback(observer): label_keys=["os_type"], view_config=ViewConfig.LABEL_KEYS, ) -# This view has ViewConfig set to UNGROUPED, meaning all recorded metrics take -# the labels directly without and consideration for label_keys + counter_view3 = View( request_last_value, LastValueAggregator, - label_keys=["environment"], # is not used due to ViewConfig.UNGROUPED + label_keys=["environment"], view_config=ViewConfig.UNGROUPED, ) size_view = View( requests_size_histogram, HistogramAggregator, - label_keys=["environment"], # is not used due to ViewConfig.UNGROUPED + label_keys=["environment"], aggregator_config={"bounds": [20, 40, 60, 80, 100]}, view_config=ViewConfig.UNGROUPED, )