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

Skeleton for azure monitor exporters #151

Merged
merged 10 commits into from
Sep 25, 2019
Merged
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
10 changes: 10 additions & 0 deletions ext/opentelemetry-ext-azure-monitor/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
OpenTelemetry Azure Monitor Exporters
=====================================

This library provides integration with Microsoft Azure Monitor.

References
----------

* `Azure Monitor <https://docs.microsoft.com/azure/azure-monitor/>`_
* `OpenTelemetry Project <https://opentelemetry.io/>`_
13 changes: 13 additions & 0 deletions ext/opentelemetry-ext-azure-monitor/examples/trace.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from opentelemetry import trace
from opentelemetry.ext.azure_monitor import AzureMonitorSpanExporter
from opentelemetry.sdk.trace import Tracer
from opentelemetry.sdk.trace.export import SimpleExportSpanProcessor

trace.set_preferred_tracer_implementation(lambda T: Tracer())
tracer = trace.tracer()
tracer.add_span_processor(
SimpleExportSpanProcessor(AzureMonitorSpanExporter())
)

with tracer.start_span("hello") as span:
print("Hello, World!")
46 changes: 46 additions & 0 deletions ext/opentelemetry-ext-azure-monitor/setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Copyright 2019, OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
[metadata]
name = opentelemetry-ext-azure-monitor
description = Azure Monitor integration for OpenTelemetry
long_description = file: README.rst
long_description_content_type = text/x-rst
author = OpenTelemetry Authors
author_email = cncf-opentelemetry-contributors@lists.cncf.io
url = https://github.com/open-telemetry/opentelemetry-python/ext/opentelemetry-ext-azure-monitor
platforms = any
license = Apache-2.0
classifiers =
Development Status :: 3 - Alpha
Intended Audience :: Developers
License :: OSI Approved :: Apache Software License
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.4
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7

[options]
python_requires = >=3.4
package_dir=
=src
packages=find_namespace:
install_requires =
opentelemetry-api
opentelemetry-sdk

[options.packages.find]
where = src
26 changes: 26 additions & 0 deletions ext/opentelemetry-ext-azure-monitor/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2019, OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os

import setuptools

BASE_DIR = os.path.dirname(__file__)
VERSION_FILENAME = os.path.join(
BASE_DIR, "src", "opentelemetry", "ext", "azure_monitor", "version.py"
)
PACKAGE_INFO = {}
with open(VERSION_FILENAME) as f:
exec(f.read(), PACKAGE_INFO)

setuptools.setup(version=PACKAGE_INFO["__version__"])
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2019, OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""
The opentelemetry-ext-azure-monitor package provides integration with
Microsoft Azure Monitor.
"""

from opentelemetry.ext.azure_monitor.trace import AzureMonitorSpanExporter
from opentelemetry.ext.azure_monitor.version import __version__ # noqa

__all__ = ["AzureMonitorSpanExporter"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2019, OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from opentelemetry.sdk.trace.export import SpanExporter, SpanExportResult


class AzureMonitorSpanExporter(SpanExporter):
def __init__(self):
pass

def export(self, spans):
for span in spans:
print(span) # TODO: add actual implementation here
reyang marked this conversation as resolved.
Show resolved Hide resolved
return SpanExportResult.SUCCESS
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2019, OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "0.1.dev0"
Empty file.
4 changes: 4 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ deps =
commands_pre =
pip install -e {toxinidir}/opentelemetry-api
pip install -e {toxinidir}/opentelemetry-sdk
pip install -e {toxinidir}/ext/opentelemetry-ext-azure-monitor
pip install -e {toxinidir}/ext/opentelemetry-ext-wsgi
pip install -e {toxinidir}/ext/opentelemetry-ext-http-requests
pip install -e {toxinidir}/opentelemetry-example-app
Expand All @@ -78,6 +79,9 @@ commands =
opentelemetry-api/tests/ \
opentelemetry-sdk/src/opentelemetry \
opentelemetry-sdk/tests/ \
ext/opentelemetry-ext-azure-monitor/examples/ \
ext/opentelemetry-ext-azure-monitor/src/ \
ext/opentelemetry-ext-azure-monitor/tests/ \
ext/opentelemetry-ext-http-requests/src/ \
ext/opentelemetry-ext-http-requests/tests/ \
ext/opentelemetry-ext-wsgi/tests/ \
Expand Down