boundary-analyzer 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- boundary_analyzer/__init__.py +0 -0
- boundary_analyzer/__main__.py +7 -0
- boundary_analyzer/auto_setup/__init__.py +4 -0
- boundary_analyzer/auto_setup/django_wrapper.py +48 -0
- boundary_analyzer/auto_setup/djangorest_wrapper.py +44 -0
- boundary_analyzer/auto_setup/fastapi_wrapper.py +59 -0
- boundary_analyzer/auto_setup/flask_wrapper.py +53 -0
- boundary_analyzer/auto_setup/setup_instrumentation.py +805 -0
- boundary_analyzer/auto_setup/starlette_wrapper.py +43 -0
- boundary_analyzer/auto_setup/tornado_wrapper.py +38 -0
- boundary_analyzer/cli.py +390 -0
- boundary_analyzer/dashboard/__init__.py +0 -0
- boundary_analyzer/dashboard/app.py +1778 -0
- boundary_analyzer/dashboard/charts.py +910 -0
- boundary_analyzer/detection/db_table_extractor.py +241 -0
- boundary_analyzer/detection/endpoint_extractor.py +150 -0
- boundary_analyzer/detection/endpoint_normalizer.py +142 -0
- boundary_analyzer/detection/mapping_builder.py +137 -0
- boundary_analyzer/llm/__init__.py +11 -0
- boundary_analyzer/llm/analysis.py +323 -0
- boundary_analyzer/llm/client.py +100 -0
- boundary_analyzer/llm/context.py +229 -0
- boundary_analyzer/llm/instrumentation.py +52 -0
- boundary_analyzer/llm/prompts.py +152 -0
- boundary_analyzer/metrics/cohesion_rules.py +20 -0
- boundary_analyzer/metrics/scom.py +207 -0
- boundary_analyzer/metrics/threshold_ultimate.py +121 -0
- boundary_analyzer/parsing/trace_reader.py +114 -0
- boundary_analyzer/pipeline/__init__.py +0 -0
- boundary_analyzer/pipeline/run_pipeline.py +189 -0
- boundary_analyzer/pipeline/step_01_collect_traces.py +88 -0
- boundary_analyzer/pipeline/step_02_read_traces.py +29 -0
- boundary_analyzer/pipeline/step_03_find_endpoints.py +38 -0
- boundary_analyzer/pipeline/step_04_find_db_tables.py +43 -0
- boundary_analyzer/pipeline/step_05_build_mapping.py +55 -0
- boundary_analyzer/pipeline/step_06_compute_scom.py +74 -0
- boundary_analyzer/pipeline/step_07_rank_and_flag.py +99 -0
- boundary_analyzer/pipeline/step_08_make_report.py +80 -0
- boundary_analyzer/reporting/__init__.py +0 -0
- boundary_analyzer/reporting/report_builder.py +122 -0
- boundary_analyzer/settings_loader.py +166 -0
- boundary_analyzer/test_data/__init__.py +0 -0
- boundary_analyzer/test_data/generate_test_traces.py +306 -0
- boundary_analyzer/validation/__init__.py +0 -0
- boundary_analyzer/validation/compare_metrics.py +250 -0
- boundary_analyzer-0.2.0.dist-info/METADATA +50 -0
- boundary_analyzer-0.2.0.dist-info/RECORD +50 -0
- boundary_analyzer-0.2.0.dist-info/WHEEL +5 -0
- boundary_analyzer-0.2.0.dist-info/entry_points.txt +3 -0
- boundary_analyzer-0.2.0.dist-info/top_level.txt +1 -0
|
File without changes
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"""
|
|
2
|
+
otel_instrumentation.py – Django / Django REST Framework
|
|
3
|
+
==========================================================
|
|
4
|
+
This file sets up OpenTelemetry tracing for your Django application.
|
|
5
|
+
|
|
6
|
+
HOW IT WORKS:
|
|
7
|
+
- Every HTTP request Django handles becomes a span.
|
|
8
|
+
- Every ORM database query also becomes a span.
|
|
9
|
+
- All spans are sent to Jaeger.
|
|
10
|
+
|
|
11
|
+
YOU DO NOT NEED TO EDIT THIS FILE.
|
|
12
|
+
Add these 2 lines BEFORE django.setup() in your manage.py or wsgi.py:
|
|
13
|
+
|
|
14
|
+
from otel_instrumentation import init_tracing
|
|
15
|
+
init_tracing()
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
from opentelemetry import trace
|
|
19
|
+
from opentelemetry.sdk.trace import TracerProvider
|
|
20
|
+
from opentelemetry.sdk.trace.export import BatchSpanProcessor
|
|
21
|
+
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
|
|
22
|
+
from opentelemetry.sdk.resources import Resource
|
|
23
|
+
from opentelemetry.instrumentation.django import DjangoInstrumentor
|
|
24
|
+
from opentelemetry.instrumentation.sqlalchemy import SQLAlchemyInstrumentor
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def init_tracing():
|
|
28
|
+
"""
|
|
29
|
+
Call this function ONCE, before django.setup() is called.
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
resource = Resource.create({"service.name": "{{SERVICE_NAME}}"})
|
|
33
|
+
|
|
34
|
+
exporter = OTLPSpanExporter(
|
|
35
|
+
endpoint="http://{{JAEGER_HOST}}:{{JAEGER_GRPC_PORT}}"
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
provider = TracerProvider(resource=resource)
|
|
39
|
+
provider.add_span_processor(BatchSpanProcessor(exporter))
|
|
40
|
+
trace.set_tracer_provider(provider)
|
|
41
|
+
|
|
42
|
+
# Automatically trace every Django view / URL
|
|
43
|
+
DjangoInstrumentor().instrument()
|
|
44
|
+
|
|
45
|
+
# Automatically trace every ORM query
|
|
46
|
+
SQLAlchemyInstrumentor().instrument()
|
|
47
|
+
|
|
48
|
+
print(f"[OTel] Tracing enabled → Jaeger at {{JAEGER_HOST}}:{{JAEGER_GRPC_PORT}}")
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"""
|
|
2
|
+
otel_instrumentation.py – Django REST Framework
|
|
3
|
+
=================================================
|
|
4
|
+
Same setup as Django — DRF sits on top of Django,
|
|
5
|
+
so we instrument at the Django level.
|
|
6
|
+
|
|
7
|
+
Add these 2 lines BEFORE django.setup():
|
|
8
|
+
|
|
9
|
+
from otel_instrumentation import init_tracing
|
|
10
|
+
init_tracing()
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
# Django REST Framework uses the same Django instrumentation
|
|
14
|
+
from opentelemetry import trace
|
|
15
|
+
from opentelemetry.sdk.trace import TracerProvider
|
|
16
|
+
from opentelemetry.sdk.trace.export import BatchSpanProcessor
|
|
17
|
+
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
|
|
18
|
+
from opentelemetry.sdk.resources import Resource
|
|
19
|
+
from opentelemetry.instrumentation.django import DjangoInstrumentor
|
|
20
|
+
from opentelemetry.instrumentation.sqlalchemy import SQLAlchemyInstrumentor
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def init_tracing():
|
|
24
|
+
"""
|
|
25
|
+
Initialize tracing for Django REST Framework.
|
|
26
|
+
DRF is built on top of Django, so we instrument Django directly.
|
|
27
|
+
"""
|
|
28
|
+
resource = Resource.create({"service.name": "{{SERVICE_NAME}}"})
|
|
29
|
+
|
|
30
|
+
exporter = OTLPSpanExporter(
|
|
31
|
+
endpoint="http://{{JAEGER_HOST}}:{{JAEGER_GRPC_PORT}}"
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
provider = TracerProvider(resource=resource)
|
|
35
|
+
provider.add_span_processor(BatchSpanProcessor(exporter))
|
|
36
|
+
trace.set_tracer_provider(provider)
|
|
37
|
+
|
|
38
|
+
# Instrument every DRF/Django view automatically
|
|
39
|
+
DjangoInstrumentor().instrument()
|
|
40
|
+
|
|
41
|
+
# Instrument every database query automatically
|
|
42
|
+
SQLAlchemyInstrumentor().instrument()
|
|
43
|
+
|
|
44
|
+
print(f"[OTel] Tracing enabled → Jaeger at {{JAEGER_HOST}}:{{JAEGER_GRPC_PORT}}")
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"""
|
|
2
|
+
otel_instrumentation.py – FastAPI
|
|
3
|
+
===================================
|
|
4
|
+
This file sets up OpenTelemetry tracing for your FastAPI application.
|
|
5
|
+
|
|
6
|
+
HOW IT WORKS:
|
|
7
|
+
- Every HTTP request becomes a span (recorded event).
|
|
8
|
+
- Every database query (via SQLAlchemy) also becomes a span.
|
|
9
|
+
- All spans are sent to Jaeger so we can see and analyze them.
|
|
10
|
+
|
|
11
|
+
YOU DO NOT NEED TO EDIT THIS FILE.
|
|
12
|
+
Just call init_tracing() at the top of your main.py (before app = FastAPI()).
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from opentelemetry import trace
|
|
16
|
+
from opentelemetry.sdk.trace import TracerProvider
|
|
17
|
+
from opentelemetry.sdk.trace.export import BatchSpanProcessor
|
|
18
|
+
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
|
|
19
|
+
from opentelemetry.sdk.resources import Resource
|
|
20
|
+
from opentelemetry.instrumentation.fastapi import FastAPIInstrumentor
|
|
21
|
+
from opentelemetry.instrumentation.sqlalchemy import SQLAlchemyInstrumentor
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def init_tracing(app=None):
|
|
25
|
+
"""
|
|
26
|
+
Call this function ONCE at the start of your app.
|
|
27
|
+
|
|
28
|
+
If you pass your FastAPI app object, HTTP routes will be traced automatically.
|
|
29
|
+
Example:
|
|
30
|
+
app = FastAPI()
|
|
31
|
+
init_tracing(app)
|
|
32
|
+
|
|
33
|
+
If you do not pass the app, call FastAPIInstrumentor().instrument_app(app)
|
|
34
|
+
after creating it.
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
# Tell Jaeger the name of this service
|
|
38
|
+
resource = Resource.create({"service.name": "{{SERVICE_NAME}}"})
|
|
39
|
+
|
|
40
|
+
# Send traces to Jaeger via gRPC
|
|
41
|
+
exporter = OTLPSpanExporter(
|
|
42
|
+
endpoint="http://{{JAEGER_HOST}}:{{JAEGER_GRPC_PORT}}"
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
provider = TracerProvider(resource=resource)
|
|
46
|
+
provider.add_span_processor(BatchSpanProcessor(exporter))
|
|
47
|
+
trace.set_tracer_provider(provider)
|
|
48
|
+
|
|
49
|
+
# Instrument database queries automatically
|
|
50
|
+
SQLAlchemyInstrumentor().instrument()
|
|
51
|
+
|
|
52
|
+
# Instrument the FastAPI app if provided
|
|
53
|
+
if app is not None:
|
|
54
|
+
FastAPIInstrumentor.instrument_app(app)
|
|
55
|
+
else:
|
|
56
|
+
# Will instrument the first FastAPI app created after this call
|
|
57
|
+
FastAPIInstrumentor().instrument()
|
|
58
|
+
|
|
59
|
+
print(f"[OTel] Tracing enabled → Jaeger at {{JAEGER_HOST}}:{{JAEGER_GRPC_PORT}}")
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"""
|
|
2
|
+
otel_instrumentation.py – Flask
|
|
3
|
+
================================
|
|
4
|
+
This file sets up OpenTelemetry tracing for your Flask application.
|
|
5
|
+
|
|
6
|
+
HOW IT WORKS:
|
|
7
|
+
- Every HTTP request your app receives becomes a "span" (a recorded event).
|
|
8
|
+
- Every database query also becomes a span.
|
|
9
|
+
- All spans are sent to Jaeger so we can see them.
|
|
10
|
+
|
|
11
|
+
YOU DO NOT NEED TO EDIT THIS FILE.
|
|
12
|
+
Just call init_tracing() at the top of your main app file.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from opentelemetry import trace
|
|
16
|
+
from opentelemetry.sdk.trace import TracerProvider
|
|
17
|
+
from opentelemetry.sdk.trace.export import BatchSpanProcessor
|
|
18
|
+
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
|
|
19
|
+
from opentelemetry.sdk.resources import Resource
|
|
20
|
+
from opentelemetry.instrumentation.flask import FlaskInstrumentor
|
|
21
|
+
from opentelemetry.instrumentation.sqlalchemy import SQLAlchemyInstrumentor
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def init_tracing():
|
|
25
|
+
"""
|
|
26
|
+
Call this function ONCE at the start of your app.
|
|
27
|
+
It configures OpenTelemetry to send traces to Jaeger.
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
# 'resource' tells Jaeger which service these traces belong to
|
|
31
|
+
resource = Resource.create({"service.name": "{{SERVICE_NAME}}"})
|
|
32
|
+
|
|
33
|
+
# 'exporter' sends the traces to Jaeger over gRPC
|
|
34
|
+
exporter = OTLPSpanExporter(
|
|
35
|
+
endpoint="http://{{JAEGER_HOST}}:{{JAEGER_GRPC_PORT}}"
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
# 'provider' is the main tracing engine
|
|
39
|
+
provider = TracerProvider(resource=resource)
|
|
40
|
+
|
|
41
|
+
# 'processor' batches spans and sends them to the exporter
|
|
42
|
+
provider.add_span_processor(BatchSpanProcessor(exporter))
|
|
43
|
+
|
|
44
|
+
# Register the provider globally
|
|
45
|
+
trace.set_tracer_provider(provider)
|
|
46
|
+
|
|
47
|
+
# Automatically trace every Flask HTTP request
|
|
48
|
+
FlaskInstrumentor().instrument()
|
|
49
|
+
|
|
50
|
+
# Automatically trace every SQLAlchemy database query
|
|
51
|
+
SQLAlchemyInstrumentor().instrument()
|
|
52
|
+
|
|
53
|
+
print(f"[OTel] Tracing enabled → Jaeger at {{JAEGER_HOST}}:{{JAEGER_GRPC_PORT}}")
|