Skip to content

Commit

Permalink
fixing lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Azfaar Qureshi committed Nov 28, 2020
1 parent d943098 commit 6052036
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Original file line number Diff line number Diff line change
@@ -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(
Expand Down Expand Up @@ -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,
)
Expand Down

0 comments on commit 6052036

Please sign in to comment.