Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure sdk migration #285

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 31 additions & 9 deletions CHANGELOG.md → azure-monitor-opentelemetry/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
# Changelog
# Release History

## Unreleased
## 1.0.0b13 (Unreleased)

## [1.0.0b12](https://github.com/microsoft/ApplicationInsights-Python/releases/tag/v1.0.0b12) - 2023-05-05
### Features Added

### Breaking Changes

### Bugs Fixed

### Other Changes

## 1.0.0b12(2023-05-05)

### Features Added

- Remove most configuration for Public Preview
([#277](https://github.com/microsoft/ApplicationInsights-Python/pull/277))
- Infer telemetry category disablement from exporter environment variables
([#278](https://github.com/microsoft/ApplicationInsights-Python/pull/278))

## [1.0.0b11](https://github.com/microsoft/ApplicationInsights-Python/releases/tag/v1.0.0b11) - 2023-04-12
## 1.0.0b11 (2023-04-12)

### Features Added

- Reverse default behavior of instrumentations and implement configuration for exclusion
([#253](https://github.com/microsoft/ApplicationInsights-Python/pull/253))
Expand All @@ -26,12 +38,16 @@
- Update exporter version to 1.0.0b13 and OTel sdk/api to 1.17
([#270](https://github.com/microsoft/ApplicationInsights-Python/pull/270))

## [1.0.0b10](https://github.com/microsoft/ApplicationInsights-Python/releases/tag/v1.0.0b10) - 2023-02-23
## 1.0.0b10 (2023-02-23)

### Features Added

- Fix source and wheel distribution, include MANIFEST.in and use `pkgutils` style `__init__.py`
([#250](https://github.com/microsoft/ApplicationInsights-Python/pull/250))

## [1.0.0b9](https://github.com/microsoft/ApplicationInsights-Python/releases/tag/v1.0.0b9) - 2023-02-22
## 1.0.0b9 (2023-02-22)

### Features Added

- Made build.sh script executable from publish workflow
([#213](https://github.com/microsoft/ApplicationInsights-Python/pull/213))
Expand Down Expand Up @@ -82,12 +98,16 @@
- Configuration via env vars and argument validation.
([#262](https://github.com/microsoft/ApplicationInsights-Python/pull/262))

## [1.0.0b8](https://github.com/microsoft/ApplicationInsights-Python/releases/tag/v1.0.0b8) - 2022-09-26
## 1.0.0b8 (2022-09-26)

### Features Added

- Changing instrumentation dependencies to ~=0.33b0
([#203](https://github.com/microsoft/ApplicationInsights-Python/pull/203))

## [1.0.0b7](https://github.com/microsoft/ApplicationInsights-Python/releases/tag/v1.0.0b7) - 2022-09-26
## 1.0.0b7 (2022-09-26)

### Features Added

- Moved and updated README
([#201](https://github.com/microsoft/ApplicationInsights-Python/pull/201))
Expand All @@ -96,7 +116,9 @@
- Added publishing action
([#193](https://github.com/microsoft/ApplicationInsights-Python/pull/193))

## [1.0.0b6](https://github.com/microsoft/ApplicationInsights-Python/releases/tag/v1.0.0b6) - 2022-08-30
## 1.0.0b6 (2022-08-30)

### Features Added

- Drop support for Python 3.6
([#190](https://github.com/microsoft/ApplicationInsights-Python/pull/190))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
AzureMonitorMetricExporter,
AzureMonitorTraceExporter,
)
from azure.monitor.opentelemetry.util.configurations import _get_configurations
from azure.monitor.opentelemetry.util._configurations import _get_configurations
from opentelemetry._logs import get_logger_provider, set_logger_provider
from opentelemetry.instrumentation.dependencies import (
get_dist_dependency_conflicts,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
recursive-include tests *.py
recursive-include samples *.py
include *.md
include LICENSE
include azure/__init__.py
include azure/monitor/__init__.py
include azure/monitor/opentelemetry/py.typed
2 changes: 2 additions & 0 deletions azure-monitor-opentelemetry/dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-e ../../../tools/azure-sdk-tools
-e ../../../tools/azure-devtools
4 changes: 4 additions & 0 deletions azure-monitor-opentelemetry/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[tool.azure-sdk-build]
type_check_samples = false
verifytypes = false
pyright = false
82 changes: 82 additions & 0 deletions azure-monitor-opentelemetry/samples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
page_type: sample
languages:
- python
products:
- azure
- azure-template
urlFragment: azure-template-samples
---

# Azure Template samples

Provide an overview of all the samples and explain how to run them.

For guidance on the samples README, visit the [sample guide](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/sample_guide.md#package-sample-readme).


|**File Name**|**Description**|
|----------------|-------------|
|[logging/correlated_logs.py][correlated_logs] | Produce logs correlated with spans |
|[logging/custom_properties.py][custom_properties] | Add custom propterties to logs |
|[logging/exception_logs.py][exception_logs] | Produce exception logs |
|[logging/logs_with_traces.py][logs_with_traces] | Produce correlated logs inside an instrumented http library's distributed tracing |
|[logging/simple.py][logging_simple] | Produce logs |

|[metrics/attributes.py][attributes] | Add attributes to custom metrics counters |
|[metrics/instruments.py][instruments] | Create observable instruments |

|[tracing/django/manage.py][django] | Instrument a django app |
|[tracing/db_psycopg2.py][db_psycopg2] | Instrument the PscyoPG2 library |
|[tracing/http_fastapi.py][http_fastapi] | Instrument a FastAPI app |
|[tracing/http_flask.py][http_flask] | Instrument a Flask app |
|[tracing/http_requests.py][http_requests] | Instrument the Requests library |
|[tracing/http_urllib.py][http_urllib] | Instrument the URLLib library |
|[tracing/http_urllib3.py][http_urllib3] | Instrument the URLLib library |
|[tracing/manual.py][manual] | Manually add instrumentation |
|[tracing/sampling.py][sampling] | Sample distributed tracing telemetry |
|[tracing/tracing_simple.py][tracing_simple] | Produce manual spans |

## Prerequisites

* Python 3.7 or later is required to use this package.

## Setup

1. Install the Azure Monitor OpenTelemetry Distro for Python with [pip][pip]:

```sh
pip install azure-monitor-opentelemetry
```

2. Clone or download the repository containing this sample code. Alternatively, you can download the sample file directly.

## Running the samples

Navigate to the directory that the sample(s) are saved in, and follow the usage described in the file. For example, `python logging/simple.py`.

## Next steps

To learn more, see the [Azure Monitor OpenTelemetry Distro documentation][distro_docs] and [OpenTelemetry documentation][otel_docs]

<!-- Links -->
[distro_docs]: [https://learn.microsoft.com/en-us/azure/azure-monitor/app/opentelemetry-enable?tabs=python]
[otel_docs]: [https://opentelemetry.io/docs/]
[correlated_logs]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/monitor/azure-monitor-opentelemetry/samples/logging/correlated_logs.py
[custom_properties]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/monitor/azure-monitor-opentelemetry/samples/logging/custom_properties.py
[exception_logs]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/monitor/azure-monitor-opentelemetry/samples/logging/exception_logs.py
[logs_with_traces]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/monitor/azure-monitor-opentelemetry/samples/logging/logs_with_traces.py
[logging_simple]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/monitor/azure-monitor-opentelemetry/samples/logging/simple.py
[attributes]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/monitor/azure-monitor-opentelemetry/samples/metrics/attributes.py
[instruments]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/monitor/azure-monitor-opentelemetry/samples/metrics/instruments.py
[django]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/monitor/azure-monitor-opentelemetry/samples/tracing/django/manage.py
[db_psycopg2]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/monitor/azure-monitor-opentelemetry/samples/tracing/db_psycopg2.py
[http_fastapi]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/monitor/azure-monitor-opentelemetry/samples/tracing/http_fastapi.py
[http_flask]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/monitor/azure-monitor-opentelemetry/samples/tracing/http_flask.py
[http_requests]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/monitor/azure-monitor-opentelemetry/samples/tracing/http_requests.py
[http_urllib]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/monitor/azure-monitor-opentelemetry/samples/tracing/http_urllib.py
[http_urllib3]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/monitor/azure-monitor-opentelemetry/samples/tracing/http_urllib3.py
[manual]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/monitor/azure-monitor-opentelemetry/samples/tracing/manual.py
[sampling]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/monitor/azure-monitor-opentelemetry/samples/tracing/sampling.py
[tracing_simple]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/monitor/azure-monitor-opentelemetry/samples/tracing/simple.py
[pip]: https://pypi.org/project/pip/
2 changes: 2 additions & 0 deletions azure-monitor-opentelemetry/sdk_packaging.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[packaging]
auto_update = false
2 changes: 0 additions & 2 deletions azure-monitor-opentelemetry/setup.cfg

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from unittest import TestCase
from unittest.mock import patch

from azure.monitor.opentelemetry.util.configurations import (
from azure.monitor.opentelemetry.util._configurations import (
LOGGING_EXPORT_INTERVAL_MS_ENV_VAR,
SAMPLING_RATIO_ENV_VAR,
_get_configurations,
Expand Down