Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b657c27

Browse files
authored
Skeleton for azure monitor exporters (open-telemetry#151)
1 parent 7813924 commit b657c27

File tree

9 files changed

+162
-0
lines changed

9 files changed

+162
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
OpenTelemetry Azure Monitor Exporters
2+
=====================================
3+
4+
This library provides integration with Microsoft Azure Monitor.
5+
6+
References
7+
----------
8+
9+
* `Azure Monitor <https://docs.microsoft.com/azure/azure-monitor/>`_
10+
* `OpenTelemetry Project <https://opentelemetry.io/>`_
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from opentelemetry import trace
2+
from opentelemetry.ext.azure_monitor import AzureMonitorSpanExporter
3+
from opentelemetry.sdk.trace import Tracer
4+
from opentelemetry.sdk.trace.export import SimpleExportSpanProcessor
5+
6+
trace.set_preferred_tracer_implementation(lambda T: Tracer())
7+
tracer = trace.tracer()
8+
tracer.add_span_processor(
9+
SimpleExportSpanProcessor(AzureMonitorSpanExporter())
10+
)
11+
12+
with tracer.start_span("hello") as span:
13+
print("Hello, World!")
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Copyright 2019, OpenTelemetry Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
[metadata]
16+
name = opentelemetry-ext-azure-monitor
17+
description = Azure Monitor integration for OpenTelemetry
18+
long_description = file: README.rst
19+
long_description_content_type = text/x-rst
20+
author = OpenTelemetry Authors
21+
author_email = [email protected]
22+
url = https://github.com/open-telemetry/opentelemetry-python/ext/opentelemetry-ext-azure-monitor
23+
platforms = any
24+
license = Apache-2.0
25+
classifiers =
26+
Development Status :: 3 - Alpha
27+
Intended Audience :: Developers
28+
License :: OSI Approved :: Apache Software License
29+
Programming Language :: Python
30+
Programming Language :: Python :: 3
31+
Programming Language :: Python :: 3.4
32+
Programming Language :: Python :: 3.5
33+
Programming Language :: Python :: 3.6
34+
Programming Language :: Python :: 3.7
35+
36+
[options]
37+
python_requires = >=3.4
38+
package_dir=
39+
=src
40+
packages=find_namespace:
41+
install_requires =
42+
opentelemetry-api
43+
opentelemetry-sdk
44+
45+
[options.packages.find]
46+
where = src
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright 2019, OpenTelemetry Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
import os
15+
16+
import setuptools
17+
18+
BASE_DIR = os.path.dirname(__file__)
19+
VERSION_FILENAME = os.path.join(
20+
BASE_DIR, "src", "opentelemetry", "ext", "azure_monitor", "version.py"
21+
)
22+
PACKAGE_INFO = {}
23+
with open(VERSION_FILENAME) as f:
24+
exec(f.read(), PACKAGE_INFO)
25+
26+
setuptools.setup(version=PACKAGE_INFO["__version__"])
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright 2019, OpenTelemetry Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
"""
16+
The opentelemetry-ext-azure-monitor package provides integration with
17+
Microsoft Azure Monitor.
18+
"""
19+
20+
from opentelemetry.ext.azure_monitor.trace import AzureMonitorSpanExporter
21+
from opentelemetry.ext.azure_monitor.version import __version__ # noqa
22+
23+
__all__ = ["AzureMonitorSpanExporter"]
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Copyright 2019, OpenTelemetry Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
from opentelemetry.sdk.trace.export import SpanExporter, SpanExportResult
16+
17+
18+
class AzureMonitorSpanExporter(SpanExporter):
19+
def __init__(self):
20+
pass
21+
22+
def export(self, spans):
23+
for span in spans:
24+
print(span) # TODO: add actual implementation here
25+
return SpanExportResult.SUCCESS
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright 2019, OpenTelemetry Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
__version__ = "0.1.dev0"

ext/opentelemetry-ext-azure-monitor/tests/__init__.py

Whitespace-only changes.

tox.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ deps =
6666
commands_pre =
6767
pip install -e {toxinidir}/opentelemetry-api
6868
pip install -e {toxinidir}/opentelemetry-sdk
69+
pip install -e {toxinidir}/ext/opentelemetry-ext-azure-monitor
6970
pip install -e {toxinidir}/ext/opentelemetry-ext-wsgi
7071
pip install -e {toxinidir}/ext/opentelemetry-ext-http-requests
7172
pip install -e {toxinidir}/opentelemetry-example-app
@@ -78,6 +79,9 @@ commands =
7879
opentelemetry-api/tests/ \
7980
opentelemetry-sdk/src/opentelemetry \
8081
opentelemetry-sdk/tests/ \
82+
ext/opentelemetry-ext-azure-monitor/examples/ \
83+
ext/opentelemetry-ext-azure-monitor/src/ \
84+
ext/opentelemetry-ext-azure-monitor/tests/ \
8185
ext/opentelemetry-ext-http-requests/src/ \
8286
ext/opentelemetry-ext-http-requests/tests/ \
8387
ext/opentelemetry-ext-wsgi/tests/ \

0 commit comments

Comments
 (0)