Skip to content

Several small bug fix #36

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 ..
```
Expand Down
1 change: 1 addition & 0 deletions aws-opentelemetry-distro/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down