Skip to content
This repository was archived by the owner on Sep 4, 2022. It is now read-only.

Commit

Permalink
feat(cisco-dis)
Browse files Browse the repository at this point in the history
  • Loading branch information
nemoshlag committed Mar 2, 2022
1 parent cd93fd3 commit 8394e31
Show file tree
Hide file tree
Showing 18 changed files with 114 additions and 187 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"restructuredtext.confPath": ""
}
47 changes: 46 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,46 @@
# otel-fso-launcher
# otel-py

[![Apache License][license-image]][license-image]

Alpha version

This package provides a Cisco Launcher for OpenTelemetry python

## Installation

pip

```sh
pip install cisco-otel-py
```

poetry
```sh
poetry add cisco-otel-py
```

## Usage
```python
from cisco_otel_py import trace

trace.init()
```

## Configuration

Advanced options can be configured as a parameter to the init() method:

| Parameter | Env | Type | Default | Description |
| --------------- | ---------------------- | ------- | ------------- | ----------------------------------------------------------------- |
| ciscoToken | CISCO_TOKEN | string | - | Cisco account token |
| serviceName | OTEL_SERVICE_NAME | string | `application` | Application name that will be set for traces |
| debug | CISCO_DEBUG | string | `false` | Debug logs |
| payloadsEnabled | CISCO_PAYLOADS_ENABLED | boolean | `false` | The number in bytes of the maximum payload to capture for request |
| maxPayloadSize | CISCO_MAX_PAYLOAD_SIZE | number | `1024` | The number in bytes of the maximum payload to capture for request |

Exporter options

| Parameter | Env | Type | Default | Description |
| ----------------- | ----------------------- | ------ | ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| collectorEndpoint | OTEL_COLLECTOR_ENDPOINT | string | `http://localhost:4317` | The address of the trace collector to send traces to |
| type. | OTEL_EXPORTER_TYPE | string | `otlp-grpc` | The exporter type to use (Currently `otlp-grpc`, `otlp-http` are supported). Multiple exporter option available via init function see example below |
Empty file removed README.rst
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
limitations under the License.
"""


from .trace import init

__version__ = '0.1.0'
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
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.
"""
"""
21 changes: 21 additions & 0 deletions cisco_otel_py/cmd/bootstrap.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"""
Copyright The Cisco 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
https://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.instrumentation.bootstrap import run as otel_bootstrap


def run() -> None:
otel_bootstrap()
26 changes: 26 additions & 0 deletions cisco_otel_py/cmd/trace.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""
Copyright The Cisco 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
https://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.instrumentation.bootstrap import run as otel_bootstrap
from opentelemetry.instrumentation.auto_instrumentation import run as otel_run


def run() -> None:
otel_run()


def boot() -> None:
otel_bootstrap()
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions otel_fso_launcher/sample.py → cisco_otel_py/sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
See the License for the specific language governing permissions and
limitations under the License.
"""

import trace


def start():
"""short sanity"""
trace.init()
Expand Down
3 changes: 2 additions & 1 deletion otel_fso_launcher/trace.py → cisco_otel_py/trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
See the License for the specific language governing permissions and
limitations under the License.
"""

import os

from opentelemetry import trace
Expand All @@ -23,7 +24,7 @@
ConsoleSpanExporter,
)
from pkg_resources import iter_entry_points
from otel_fso_launcher import consts
from cisco_otel_py import consts


def init() -> TracerProvider:
Expand Down
Binary file removed dist/otel_fso_launcher-0.1.0-py3-none-any.whl
Binary file not shown.
Binary file removed otel_fso_launcher/__pycache__/trace.cpython-39.pyc
Binary file not shown.
57 changes: 0 additions & 57 deletions otel_fso_launcher/cmd/bootstrap.py

This file was deleted.

60 changes: 0 additions & 60 deletions otel_fso_launcher/cmd/trace.py

This file was deleted.

15 changes: 9 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
[tool.poetry]
name = "otel-py"
name = "cisco-otel-py"
version = "0.1.0"
description = ""
authors = ["SDK <[email protected]>"]
description = "a minimal python Cisco Launcher for OpenTelemetry"
license = "Apache-2.0"
authors = ["Cisco Epsagon Team <[email protected]>"]
readme = readme.md
repository = "https://github.com/epsagon/otel-py"

[tool.poetry.scripts]
otel-py = 'otel_fso_launcher.cmd.trace:run'
otel-py-bootstrap = 'otel_fso_launcher.cmd.bootstrap:run'
otel-py-boot = 'otel_fso_launcher.cmd.trace:boot'
otel-py = 'cisco_otel_py.cmd.trace:run'
otel-py-bootstrap = 'cisco_otel_py.cmd.bootstrap:run'
otel-py-boot = 'cisco_otel_py.cmd.trace:boot'

[tool.poetry.dependencies]
python = "^3.9"
Expand Down
59 changes: 0 additions & 59 deletions requirements.txt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
limitations under the License.
"""

import otel_fso_launcher
import cisco_otel_py


def test_version():
assert otel_fso_launcher.__version__ == '0.1.0'
assert cisco_otel_py.__version__ == '0.1.0'

0 comments on commit 8394e31

Please sign in to comment.