Skip to content

WIP#807

Draft
liustve wants to merge 7 commits into
mainfrom
extract-appsignals-serviceevents-packages
Draft

WIP#807
liustve wants to merge 7 commits into
mainfrom
extract-appsignals-serviceevents-packages

Conversation

@liustve

@liustve liustve commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

No description provided.

liustve added 2 commits June 29, 2026 14:01
Move the Application Signals pipeline out of aws-opentelemetry-distro into a
new top-level aws-opentelemetry-application-signals package (the base package
of the 3-package split). Shared low-level utilities relocate under
application_signals/internal/ so distro-core and serviceevents can depend on
them without an import cycle.

- internal/: metric attribute generator, span-processing util, ARN/SQS parsers,
  resource attribute configurator, semconv (aws_attributes, gen_ai_attributes),
  utils.is_account_id, configuration/sql_dialect_keywords.json
- processor/: attribute-propagating + span-metrics processors/builders, plus the
  new AwsMetricAttributesSpanProcessor (replaces the exporter-based approach)
- sampler/: always_record_sampler
- __init__: configure_application_signals() facade + helpers
- duck-type adapt_sampling to avoid distro.sampler import cycle
- exporter->processor: delete AwsMetricAttributesSpanExporter(+Builder), convert
  its test to drive on_end(); 162 package tests pass
…age split

Extract ServiceEvents out of aws-opentelemetry-distro into a new top-level
aws-opentelemetry-serviceevents package, and finish the distro-side wiring for
the 3-package split (distro -> application_signals <- serviceevents).

ServiceEvents:
- Move distro/serviceevents/** -> amazon.opentelemetry.serviceevents.**
- Repoint extract_api_path_value to application_signals.internal; own version.py
- Add ServiceEventsInstrumentor(BaseInstrumentor) wrapper + register
  opentelemetry_instrumentor / opentelemetry_post_instrument entry points
  (replaces the configurator's _init_serviceevents driving)
- Lazy distro imports (AWS_LOGS_OTLP_ENDPOINT_PATTERN, get_aws_session,
  OTLPAwsLogRecordExporter) kept as call-time imports (no import cycle)

Distro:
- Repoint 8 distro-core consumers of the moved shared utils to
  application_signals.internal.* (lambda/batch processors, bedrock/botocore
  patches, samplers, debugger)
- Slim aws_opentelemetry_configurator: use configure_application_signals() +
  create_always_record_sampler() + get_metric_export_interval(); drop exporter
  wrapping (metric attrs now via processor); remove local
  ApplicationSignalsExporterProvider/_get_metric_export_interval; remove
  _init_serviceevents/_is_serviceevents_enabled; prune now-unused imports
- pyproject: depend on aws-opentelemetry-application-signals==0.18.0.dev0 and
  aws-opentelemetry-serviceevents==0.18.0.dev0
- Update configurator test for new processor ordering + dropped exporter arg;
  drop 6 ServiceEvents tests (moved with the package)

Build/CI: build all 3 wheels (application_signals -> serviceevents -> distro),
install distro with --find-links; tox envs + .coveragerc paths for all 3.

Verified in a clean venv: 3 wheels build + install, all namespaces import,
no import cycle, entry points registered; application_signals 162/162,
serviceevents 716/716, distro core 1384 passed/25 skipped (configurator 62/62).
@liustve liustve changed the title extract-appsignals-serviceevents-packages WIP Jun 30, 2026
liustve added 5 commits June 30, 2026 12:46
…omments

- Contract-test Dockerfiles copy all aws_opentelemetry_*.whl and install the
  distro with --find-links so the application-signals/serviceevents deps resolve
  from the locally built wheels (not on PyPI)
- distro-wheel CI artifact (pr-build, main-build) ships all three wheels
- Remove explanatory inline comments added during the package split
Mirror the staging telemend-standalone pattern so per-package coverage no
longer leaks across packages:

- Each tox test env scopes pytest-cov to its OWN subpackage
  (--cov=.../amazon/opentelemetry/<pkg>) and uses that package's OWN
  .coveragerc (--cov-config), so thresholds are enforced per package:
  distro 95%, application-signals 90%, serviceevents 70%
- Add aws-opentelemetry-distro/.coveragerc (carries the distro 95% threshold
  + DI engine omits previously in the shared root .coveragerc)
- Drop the shared COVERAGE_RUN/--source=amazon scheme that measured the whole
  amazon namespace (all 3 packages) under one global threshold
- Fix orphaned-command bug: the distro pytest command's backslash line
  continuations ran as a stray command in non-distro envs; collapse to one line
- unit_tests CI action: per-package gating happens inside tox now, so the
  combined coverage step is report-only (no global re-check)

Verified in a clean 3-wheel venv: application-signals 162 passed @ 92.43%
(>=90), serviceevents 716 passed @ 97.91% (>=70), distro coverage report
contains zero application_signals/serviceevents lines (no leak).
Run each package's unit test suite in its own CI job instead of lumping all
three into a single job per Python version:

- unit_tests action filters tox envs by package_name
  (^<py>-test-<package>) and fails if no env matches, so distro,
  application-signals, and serviceevents each run independently
- pr-build/main-build unit-tests jobs gain a 'package' matrix dimension over
  the three packages (5 python-versions x 3 packages = 15 jobs)
- drop the cross-package coverage combine step from the action; per-package
  thresholds are enforced inside each tox env by pytest-cov
…stalled

The serviceevents unit suite runs in its own tox env where the distro is NOT
installed. Two problems surfaced:

- _build_log_otlp_exporter imported AWS_LOGS_OTLP_ENDPOINT_PATTERN from the
  distro configurator and get_aws_session/OTLPAwsLogRecordExporter from distro
  at call time, so initialize()-driven tests hard-failed without distro. Inline
  the endpoint regex locally and guard the distro imports with try/except
  ImportError, degrading to a plain OTLPLogExporter when distro is absent.
- Delete the SigV4 tests that patched amazon.opentelemetry.distro internals
  (TestBuildLogOtlpExporterSigV4 + the two SigV4 cases in test_direct_cw_otlp);
  they exercised the distro-integration path and cannot resolve their patch
  targets standalone. Kept the distro-free endpoint-routing tests.

Standalone serviceevents suite now: 713 passed, 97.43% coverage.
Make application-signals and serviceevents fully self-contained with zero
references to aws-opentelemetry-distro (source, tests, comments, docstrings):

- _build_log_otlp_exporter: drop the distro-dependent SigV4 branch entirely
  (the lazy get_aws_session / OTLPAwsLogRecordExporter imports); it now always
  returns a plain upstream OTLPLogExporter
- ast_transformation: reword SDK self-exclusion comments to describe the
  amazon.opentelemetry namespace instead of 'the distro'; the
  SDK_SELF_EXCLUDE prefix is unchanged
- test self-exclusion literals use amazon.opentelemetry.serviceevents.foo
- drop stale OTLPAwsLogRecordExporter / JS-distro comment mentions
- application_signals env-var docstring reworded to not mention the distro

Verified standalone (no distro installed): serviceevents 713 passed,
application-signals 162 passed. grep for 'distro' across both packages: zero.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant