Skip to content

Commit

Permalink
Add entry point test case
Browse files Browse the repository at this point in the history
  • Loading branch information
ocelotl committed Jul 23, 2024
1 parent 457585a commit abda71b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ dependencies = [
[project.optional-dependencies]
instruments = []

[project.entry-points.opentelemetry_instrumentor]
aws_lambda= "opentelemetry.instrumentation.aws_lambda:AwsLambdaInstrumentor"

[project.urls]
Homepage = "https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/instrumentation/opentelemetry-instrumentation-aws-lambda"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import os
from dataclasses import dataclass
from importlib import import_module, reload
Expand All @@ -37,6 +38,7 @@
from opentelemetry.trace.propagation.tracecontext import (
TraceContextTextMapPropagator,
)
from opentelemetry.util._importlib_metadata import entry_points

from .mocks.api_gateway_http_api_event import (
MOCK_LAMBDA_API_GATEWAY_HTTP_API_EVENT,
Expand Down Expand Up @@ -516,3 +518,16 @@ def test_no_op_tracer_provider(self):
spans = self.memory_exporter.get_finished_spans()
assert spans is not None
self.assertEqual(len(spans), 0)

def test_load_entry_point(self):
self.assertIs(
next(
iter(
entry_points(
group="opentelemetry_instrumentor",
name="aws_lambda"
)
)
).load(),
AwsLambdaInstrumentor
)

0 comments on commit abda71b

Please sign in to comment.