This repository has been archived by the owner on Nov 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #89 from lzchen/release
- Loading branch information
Showing
44 changed files
with
1,330 additions
and
265 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Changelog | ||
|
||
## Unreleased | ||
|
||
## 0.3b.0 | ||
Released 2020-05-19 | ||
|
||
- Implement max size logic for local storage | ||
([#74](https://github.com/microsoft/opentelemetry-azure-monitor-python/pull/74)) | ||
- Remove label sets + add is_remote to spancontext | ||
([#75](https://github.com/microsoft/opentelemetry-azure-monitor-python/pull/75)) | ||
- Adding live metrics manager | ||
([#78](https://github.com/microsoft/opentelemetry-azure-monitor-python/pull/78)) | ||
- Handle status 439 - Too Many Requests over extended time | ||
([#80](https://github.com/microsoft/opentelemetry-azure-monitor-python/pull/80)) | ||
- Fix breaking changes from OT release 0.7b.0 | ||
([#86](https://github.com/microsoft/opentelemetry-azure-monitor-python/pull/86)) | ||
|
||
## 0.2b.0 | ||
Released 2020-03-31 | ||
|
||
- Initial beta release | ||
|
||
## 0.1a.0 | ||
Released 2019-11-06 | ||
|
||
- Initial alpha release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# OpenTelemetry Azure Monitor SDKs and Exporters | ||
|
||
[![PyPI version](https://badge.fury.io/py/opentelemetry-azure-monitor.svg)](https://badge.fury.io/py/opentelemetry-azure-monitor) | ||
|
||
## Installation | ||
|
||
```sh | ||
pip install opentelemetry-azure-monitor | ||
``` | ||
|
||
# References | ||
|
||
[Azure Monitor](https://docs.microsoft.com/azure/azure-monitor/) | ||
|
||
[OpenTelemetry Project](https://opentelemetry.io/) | ||
|
||
[OpenTelemetry Python Client](https://github.com/open-telemetry/opentelemetry-python) | ||
|
||
[Azure Monitor Python Gitter](https://gitter.im/Microsoft/azure-monitor-python) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. | ||
import psutil | ||
from opentelemetry import metrics | ||
from opentelemetry.sdk.metrics import MeterProvider | ||
from opentelemetry.sdk.metrics.export.controller import PushController | ||
|
||
from azure_monitor import AzureMonitorMetricsExporter | ||
|
||
metrics.set_meter_provider(MeterProvider()) | ||
meter = metrics.get_meter(__name__) | ||
exporter = AzureMonitorMetricsExporter( | ||
connection_string="InstrumentationKey=<INSTRUMENTATION KEY HERE>" | ||
) | ||
controller = PushController(meter=meter, exporter=exporter, interval=2) | ||
|
||
|
||
# Callback to gather cpu usage | ||
def get_cpu_usage_callback(observer): | ||
for (number, percent) in enumerate(psutil.cpu_percent(percpu=True)): | ||
labels = {"cpu_number": str(number)} | ||
observer.observe(percent, labels) | ||
|
||
|
||
meter.register_observer( | ||
callback=get_cpu_usage_callback, | ||
name="cpu_percent", | ||
description="per-cpu usage", | ||
unit="1", | ||
value_type=float, | ||
label_keys=("cpu_number",), | ||
) | ||
|
||
|
||
# Callback to gather RAM memory usage | ||
def get_ram_usage_callback(observer): | ||
ram_percent = psutil.virtual_memory().percent | ||
observer.observe(ram_percent, {}) | ||
|
||
|
||
meter.register_observer( | ||
callback=get_ram_usage_callback, | ||
name="ram_percent", | ||
description="RAM memory usage", | ||
unit="1", | ||
value_type=float, | ||
label_keys=(), | ||
) | ||
|
||
input("Metrics will be printed soon. Press a key to finish...\n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.