forked from odigos-io/odigos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from alonkeyval/setup-style-fixes
Setup style fixes
- Loading branch information
Showing
482 changed files
with
16,820 additions
and
11,031 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Check links | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
check-links: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- uses: lycheeverse/lychee-action@v1.10.0 | ||
with: | ||
args: >- | ||
-v -n "*.md" "**/*.md" | ||
--exclude "http://localhost*" | ||
fail: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ node_modules | |
.DS_Store | ||
go.work.sum | ||
cli/odigos | ||
.venv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,82 +1,15 @@ | ||
import threading | ||
import atexit | ||
import os | ||
import opentelemetry.sdk._configuration as sdk_config | ||
from opentelemetry.sdk.resources import Resource | ||
from opentelemetry.sdk.resources import ProcessResourceDetector, OTELResourceDetector | ||
from .lib_handling import reorder_python_path, reload_distro_modules | ||
from .version import VERSION | ||
from opamp.http_client import OpAMPHTTPClient | ||
from initializer.components import initialize_components | ||
|
||
class OdigosPythonConfigurator(sdk_config._BaseConfigurator): | ||
|
||
def _configure(self, **kwargs): | ||
_initialize_components() | ||
|
||
|
||
def _initialize_components(): | ||
trace_exporters, metric_exporters, log_exporters = sdk_config._import_exporters( | ||
sdk_config._get_exporter_names("traces"), | ||
sdk_config._get_exporter_names("metrics"), | ||
sdk_config._get_exporter_names("logs"), | ||
) | ||
|
||
auto_resource = { | ||
"telemetry.distro.name": "odigos", | ||
"telemetry.distro.version": VERSION, | ||
} | ||
|
||
resource_attributes_event = threading.Event() | ||
client = start_opamp_client(resource_attributes_event) | ||
resource_attributes_event.wait(timeout=30) # Wait for the resource attributes to be received for 30 seconds | ||
|
||
received_value = client.resource_attributes | ||
|
||
if received_value: | ||
auto_resource.update(received_value) | ||
|
||
resource = Resource.create(auto_resource) \ | ||
.merge(OTELResourceDetector().detect()) \ | ||
.merge(ProcessResourceDetector().detect()) | ||
|
||
initialize_traces_if_enabled(trace_exporters, resource) | ||
initialize_metrics_if_enabled(metric_exporters, resource) | ||
initialize_logging_if_enabled(log_exporters, resource) | ||
|
||
MINIMUM_PYTHON_SUPPORTED_VERSION = (3, 8) | ||
|
||
# Reorder the python sys.path to ensure that the user application's dependencies take precedence over the agent's dependencies. | ||
# This is necessary because the user application's dependencies may be incompatible with those used by the agent. | ||
reorder_python_path() | ||
# Reload distro modules to ensure the new path is used. | ||
reload_distro_modules() | ||
|
||
def initialize_traces_if_enabled(trace_exporters, resource): | ||
traces_enabled = os.getenv(sdk_config.OTEL_TRACES_EXPORTER, "none").strip().lower() | ||
if traces_enabled != "none": | ||
id_generator_name = sdk_config._get_id_generator() | ||
id_generator = sdk_config._import_id_generator(id_generator_name) | ||
sdk_config._init_tracing(exporters=trace_exporters, id_generator=id_generator, resource=resource) | ||
|
||
def initialize_metrics_if_enabled(metric_exporters, resource): | ||
metrics_enabled = os.getenv(sdk_config.OTEL_METRICS_EXPORTER, "none").strip().lower() | ||
if metrics_enabled != "none": | ||
sdk_config._init_metrics(metric_exporters, resource) | ||
|
||
def initialize_logging_if_enabled(log_exporters, resource): | ||
logging_enabled = os.getenv(sdk_config.OTEL_LOGS_EXPORTER, "none").strip().lower() | ||
if logging_enabled != "none": | ||
sdk_config._init_logging(log_exporters, resource) | ||
|
||
|
||
def start_opamp_client(event): | ||
condition = threading.Condition(threading.Lock()) | ||
client = OpAMPHTTPClient(event, condition) | ||
client.start() | ||
class OdigosPythonConfigurator(sdk_config._BaseConfigurator): | ||
|
||
def shutdown(): | ||
client.shutdown() | ||
|
||
# Ensure that the shutdown function is called on program exit | ||
atexit.register(shutdown) | ||
|
||
return client | ||
def _configure(self, **kwargs): | ||
trace_exporters, metric_exporters, log_exporters = sdk_config._import_exporters( | ||
sdk_config._get_exporter_names("traces"), | ||
sdk_config._get_exporter_names("metrics"), | ||
sdk_config._get_exporter_names("logs"), | ||
) | ||
initialize_components(trace_exporters, metric_exporters, log_exporters) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.