diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 181f23806..0c88b42da 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -19,7 +19,6 @@ cd ./aws-opentelemetry-distro python3 -m build --outdir ../dist cd ../dist pkg_version=$(grep '__version__' ../aws-opentelemetry-distro/src/amazon/opentelemetry/distro/version.py | awk -F '"' '{print $2}') -pip wheel --no-deps aws_opentelemetry_distro-${pkg_version}.tar.gz pip install aws_opentelemetry_distro-${pkg_version}-py3-none-any.whl --force-reinstall cd .. ``` diff --git a/aws-opentelemetry-distro/pyproject.toml b/aws-opentelemetry-distro/pyproject.toml index 5cc1227f1..c1bc0bc11 100644 --- a/aws-opentelemetry-distro/pyproject.toml +++ b/aws-opentelemetry-distro/pyproject.toml @@ -13,6 +13,7 @@ requires-python = ">=3.8" dependencies = [ "opentelemetry-api ~= 1.12", "opentelemetry-instrumentation == 0.43b0", + "opentelemetry-distro == 0.43b0", "opentelemetry-sdk ~= 1.13", "opentelemetry-distro == 0.43b0", "opentelemetry-sdk-extension-aws ~= 2.0.1", diff --git a/aws-opentelemetry-distro/src/amazon/opentelemetry/distro/aws_opentelemetry_configurator.py b/aws-opentelemetry-distro/src/amazon/opentelemetry/distro/aws_opentelemetry_configurator.py index fb2b77ea9..addf4b377 100644 --- a/aws-opentelemetry-distro/src/amazon/opentelemetry/distro/aws_opentelemetry_configurator.py +++ b/aws-opentelemetry-distro/src/amazon/opentelemetry/distro/aws_opentelemetry_configurator.py @@ -27,6 +27,9 @@ _OTelSDKConfigurator, ) from opentelemetry.sdk.environment_variables import _OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED +from opentelemetry.sdk.extension.aws.resource.ec2 import AwsEc2ResourceDetector +from opentelemetry.sdk.extension.aws.resource.ecs import AwsEcsResourceDetector +from opentelemetry.sdk.extension.aws.resource.eks import AwsEksResourceDetector from opentelemetry.sdk.metrics import MeterProvider from opentelemetry.sdk.metrics._internal.instrument import ( Counter, @@ -37,7 +40,7 @@ UpDownCounter, ) from opentelemetry.sdk.metrics.export import AggregationTemporality, PeriodicExportingMetricReader -from opentelemetry.sdk.resources import Resource +from opentelemetry.sdk.resources import Resource, get_aggregated_resources from opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk.trace.export import BatchSpanProcessor, SpanExporter from opentelemetry.sdk.trace.id_generator import IdGenerator @@ -88,7 +91,14 @@ def _initialize_components(auto_instrumentation_version): # populate version if using auto-instrumentation if auto_instrumentation_version: auto_resource[ResourceAttributes.TELEMETRY_AUTO_VERSION] = auto_instrumentation_version - resource = Resource.create(auto_resource) + + resource = get_aggregated_resources( + [ + AwsEc2ResourceDetector(), + AwsEksResourceDetector(), + AwsEcsResourceDetector(), + ] + ).merge(Resource.create(auto_resource)) _init_tracing( exporters=trace_exporters, diff --git a/aws-opentelemetry-distro/src/amazon/opentelemetry/distro/aws_span_metrics_processor_builder.py b/aws-opentelemetry-distro/src/amazon/opentelemetry/distro/aws_span_metrics_processor_builder.py index 4f94af7b7..794fc0b84 100644 --- a/aws-opentelemetry-distro/src/amazon/opentelemetry/distro/aws_span_metrics_processor_builder.py +++ b/aws-opentelemetry-distro/src/amazon/opentelemetry/distro/aws_span_metrics_processor_builder.py @@ -57,6 +57,10 @@ def build(self) -> AwsSpanMetricsProcessor: error_histogram: Histogram = meter.create_histogram(_ERROR) fault_histogram: Histogram = meter.create_histogram(_FAULT) latency_histogram: Histogram = meter.create_histogram(_LATENCY, unit=_LATENCY_UNITS) + # TODO: Remove the Histogram name override after the CWAgent is fixed with metric name case-insensitive. + error_histogram.name = _ERROR + fault_histogram.name = _FAULT + latency_histogram.name = _LATENCY return AwsSpanMetricsProcessor( error_histogram, fault_histogram, latency_histogram, self._generator, self._resource