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

Codegen for Azure Monitor #14057

Merged
merged 13 commits into from
Oct 13, 2020
Merged
Show file tree
Hide file tree
Changes from 12 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
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
# PRLabel: %Monitor - LogAnalytics
/sdk/loganalytics/ @alexeldeib

# PRLabel: %Monitor - Exporter
/sdk/monitor/opentelemetry-exporter-azuremonitor @rakshith91 @lmazuel @hectorhdzg @lzchen

# PRLabel: %Consumption
/sdk/consumption/ @sandeepnl

Expand Down
2 changes: 2 additions & 0 deletions eng/.docsettings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ known_content_issues:
- ['sdk/storage/azure-storage-queue/swagger/README.md', '#4554']
- ['sdk/storage/README.md', '#4554']
- ['sdk/textanalytics/azure-ai-textanalytics/samples/README.md', '#4554']
- ['sdk/monitor/opentelemetry-exporter-azuremonitor/swagger/README.md', '#4554']
rakshith91 marked this conversation as resolved.
Show resolved Hide resolved
- ['sdk/monitor/opentelemetry-exporter-azuremonitor/README.md', '#4554']

# nspckg and common.
- ['sdk/appconfiguration/azure-appconfiguration/README.md', 'nspkg and common']
Expand Down
55 changes: 55 additions & 0 deletions sdk/monitor/opentelemetry-exporter-azuremonitor/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Release History

## Unreleased

## 0.5b.0
Released 2020-09-24

- Change epoch for live metrics
([#115](https://github.com/microsoft/opentelemetry-azure-monitor-python/pull/115))
- Dropping support for Python 3.4
([#117](https://github.com/microsoft/opentelemetry-azure-monitor-python/pull/117))

## 0.4b.0
Released 2020-06-29

- Added live metrics
([#96](https://github.com/microsoft/opentelemetry-azure-monitor-python/pull/96))
- Remove dependency metrics from auto-collection
([#92](https://github.com/microsoft/opentelemetry-azure-monitor-python/pull/92))
- Change default local storage directory
([#100](https://github.com/microsoft/opentelemetry-azure-monitor-python/pull/100))
- Implement proxies in exporter configuration
([#101](https://github.com/microsoft/opentelemetry-azure-monitor-python/pull/101))
- Remove request failed per second metrics from auto-collection
([#102](https://github.com/microsoft/opentelemetry-azure-monitor-python/pull/102))

## 0.3b.1
Released 2020-05-21

- Fix metrics exporter serialization bug
([#92](https://github.com/microsoft/opentelemetry-azure-monitor-python/pull/92))

## 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
21 changes: 21 additions & 0 deletions sdk/monitor/opentelemetry-exporter-azuremonitor/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2017 Microsoft
rakshith91 marked this conversation as resolved.
Show resolved Hide resolved

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
6 changes: 6 additions & 0 deletions sdk/monitor/opentelemetry-exporter-azuremonitor/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
include *.md
include opentelemetry/__init__.py
include opentelemetry/exporter/__init__.py
include LICENSE.txt
recursive-include tests *.py
recursive-include samples *.py *.md
13 changes: 13 additions & 0 deletions sdk/monitor/opentelemetry-exporter-azuremonitor/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Azure Opentelemetry Exporter for Monitor

## Getting started

## Key concepts

## Examples

## Troubleshooting

## Next steps
rakshith91 marked this conversation as resolved.
Show resolved Hide resolved

## Contributing
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-e ../../../tools/azure-devtools
-e ../../../tools/azure-sdk-tools
../../core/azure-core
-e ../../identity/azure-identity
aiohttp>=3.0; python_version >= '3.5'

14 changes: 14 additions & 0 deletions sdk/monitor/opentelemetry-exporter-azuremonitor/mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[mypy]
python_version = 3.6
warn_return_any = True
warn_unused_configs = True
ignore_missing_imports = True

# Per-module options:

[mypy-opentelemetry.exporter.azuremonitor._generated.*]
ignore_errors = True

[mypy-azure.core.*]
ignore_errors = True

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------

from ._generated._azure_monitor_exporter import AzureMonitorExporter
from ._version import VERSION

__all__ = ['AzureMonitorExporter']
__version__ = VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._azure_monitor_exporter import AzureMonitorExporter
__all__ = ['AzureMonitorExporter']

try:
from ._patch import patch_sdk # type: ignore
patch_sdk()
except ImportError:
pass
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from typing import TYPE_CHECKING

from azure.core import PipelineClient
from msrest import Deserializer, Serializer

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any

from ._configuration import AzureMonitorExporterConfiguration
from .operations import AzureMonitorExporterOperationsMixin
from . import models


class AzureMonitorExporter(AzureMonitorExporterOperationsMixin):
"""Opentelemetry Exporter for Azure Monitor.

:param host: Breeze endpoint: https://dc.services.visualstudio.com.
:type host: str
"""

def __init__(
self,
host="https://dc.services.visualstudio.com", # type: str
**kwargs # type: Any
):
# type: (...) -> None
base_url = '{Host}/v2'
self._config = AzureMonitorExporterConfiguration(host, **kwargs)
self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)


def close(self):
# type: () -> None
self._client.close()

def __enter__(self):
# type: () -> AzureMonitorExporter
self._client.__enter__()
return self

def __exit__(self, *exc_details):
# type: (Any) -> None
self._client.__exit__(*exc_details)
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from typing import TYPE_CHECKING

from azure.core.configuration import Configuration
from azure.core.pipeline import policies

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any

VERSION = "unknown"

class AzureMonitorExporterConfiguration(Configuration):
"""Configuration for AzureMonitorExporter.

Note that all parameters used to create this instance are saved as instance
attributes.

:param host: Breeze endpoint: https://dc.services.visualstudio.com.
:type host: str
"""

def __init__(
self,
host="https://dc.services.visualstudio.com", # type: str
**kwargs # type: Any
):
# type: (...) -> None
if host is None:
raise ValueError("Parameter 'host' must not be None.")
super(AzureMonitorExporterConfiguration, self).__init__(**kwargs)

self.host = host
kwargs.setdefault('sdk_moniker', 'azuremonitorexporter/{}'.format(VERSION))
self._configure(**kwargs)

def _configure(
self,
**kwargs # type: Any
):
# type: (...) -> None
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._azure_monitor_exporter_async import AzureMonitorExporter
__all__ = ['AzureMonitorExporter']
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from typing import Any

from azure.core import AsyncPipelineClient
from msrest import Deserializer, Serializer

from ._configuration_async import AzureMonitorExporterConfiguration
from .operations_async import AzureMonitorExporterOperationsMixin
from .. import models


class AzureMonitorExporter(AzureMonitorExporterOperationsMixin):
"""Opentelemetry Exporter for Azure Monitor.

:param host: Breeze endpoint: https://dc.services.visualstudio.com.
:type host: str
"""

def __init__(
self,
host: str = "https://dc.services.visualstudio.com",
**kwargs: Any
) -> None:
base_url = '{Host}/v2'
self._config = AzureMonitorExporterConfiguration(host, **kwargs)
self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)


async def close(self) -> None:
await self._client.close()

async def __aenter__(self) -> "AzureMonitorExporter":
await self._client.__aenter__()
return self

async def __aexit__(self, *exc_details) -> None:
await self._client.__aexit__(*exc_details)
Loading