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 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/microsoft/opentelemetry-a…
…zure-monitor-python into v0.6b.x
- Loading branch information
Showing
19 changed files
with
300 additions
and
97 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 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 |
---|---|---|
@@ -1,21 +1 @@ | ||
# OpenTelemetry Azure Monitor SDKs and Exporters (Private preview) | ||
|
||
[![PyPI version](https://badge.fury.io/py/opentelemetry-azure-monitor.svg)](https://badge.fury.io/py/opentelemetry-azure-monitor) | ||
|
||
The OpenTelemetry Azure Monitor SDK and exporter are in private preview. They are not recommended for a production environment. | ||
|
||
## 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) | ||
Deprecated, go for official version https://pypi.org/project/azure-opentelemetry-exporter-azuremonitor/. |
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,33 @@ | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. | ||
# pylint: disable=import-error | ||
# pylint: disable=no-member | ||
# pylint: disable=no-name-in-module | ||
import time | ||
|
||
import requests | ||
from opentelemetry import metrics | ||
from opentelemetry.instrumentation.requests import RequestsInstrumentor | ||
from opentelemetry.sdk.metrics import MeterProvider | ||
|
||
from azure_monitor import AzureMonitorMetricsExporter | ||
|
||
# Use the default sdk implementation | ||
metrics.set_meter_provider(MeterProvider(stateful=False)) | ||
|
||
# Track telemetry from the requests library | ||
RequestsInstrumentor().instrument() | ||
meter = RequestsInstrumentor().meter | ||
exporter = AzureMonitorMetricsExporter( | ||
connection_string="InstrumentationKey=<INSTRUMENTATION KEY HERE>" | ||
) | ||
# Export standard metrics from requests library to Azure Monitor | ||
metrics.get_meter_provider().start_pipeline(meter, exporter, 5) | ||
|
||
for x in range(10): | ||
for y in range(10): | ||
requests.get("http://example.com") | ||
time.sleep(2) | ||
time.sleep(5) | ||
|
||
input("Press any key to exit...") |
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.