# Path: e2e-test-server/e2e_test_server/constants.py
# INSTRUMENTING_MODULE_NAME = "opentelemetry-ops-e2e-test-server"
# 
# PROJECT_ID = os.environ["PROJECT_ID"]
# 
# TEST_ID = "test_id"
# 
# TRACE_ID = "trace_id"


import contextlib
import dataclasses
from typing import Callable, Iterator, Mapping
from google.rpc import code_pb2
from opentelemetry.exporter.cloud_trace import CloudTraceSpanExporter
from opentelemetry.propagators.cloud_trace_propagator import (
    CloudTraceFormatPropagator,
)
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor
from opentelemetry.sdk.trace.sampling import ALWAYS_ON
from opentelemetry.trace import SpanKind, Tracer, format_trace_id
from pydantic import BaseModel
from .constants import INSTRUMENTING_MODULE_NAME, PROJECT_ID, TEST_ID, TRACE_ID
    return Response(status_code=code_pb2.OK)


def basic_trace(request: Request) -> Response:
    """Create a basic trace"""

    with _tracer_setup() as tracer:
        with tracer.start_span(
            "basicTrace", attributes={TEST_ID: request.test_id}
        ) as span:
            trace_id = format_trace_id(span.get_span_context().trace_id)

    return Response(status_code=code_pb2.OK, headers={TRACE_ID: trace_id})


def complex_trace(request: Request) -> Response:
    """Create a complex trace"""

    with _tracer_setup() as tracer:
        with tracer.start_as_current_span(
            "complexTrace/root", attributes={TEST_ID: request.test_id}
        ) as root_span:
            trace_id = format_trace_id(root_span.get_span_context().trace_id)
            with tracer.start_as_current_span(
                "complexTrace/child1",
                attributes={TEST_ID: request.test_id},
                kind=SpanKind.SERVER,
            ):
                with tracer.start_as_current_span(
                    "complexTrace/child2",

# Path: e2e-test-server/e2e_test_server/constants.py
# INSTRUMENTING_MODULE_NAME = "opentelemetry-ops-e2e-test-server"
# 
# PROJECT_ID = os.environ["PROJECT_ID"]
# 
# TEST_ID = "test_id"
# 
# TRACE_ID = "trace_id"


# Path: e2e-test-server/e2e_test_server/scenarios.py
import contextlib
import dataclasses
from typing import Callable, Iterator, Mapping
from google.rpc import code_pb2
from opentelemetry.exporter.cloud_trace import CloudTraceSpanExporter
from opentelemetry.propagators.cloud_trace_propagator import (
    CloudTraceFormatPropagator,
)
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor
from opentelemetry.sdk.trace.sampling import ALWAYS_ON
from opentelemetry.trace import SpanKind, Tracer, format_trace_id
from pydantic import BaseModel
from .constants import INSTRUMENTING_MODULE_NAME, PROJECT_ID, TEST_ID, TRACE_ID

    return Response(status_code=code_pb2.OK)


def basic_trace(request: Request) -> Response:
    """Create a basic trace"""

    with _tracer_setup() as tracer:
        with tracer.start_span(
            "basicTrace", attributes={TEST_ID: request.test_id}
        ) as span:
            trace_id = format_trace_id(span.get_span_context().trace_id)

    return Response(status_code=code_pb2.OK, headers={TRACE_ID: trace_id})


def complex_trace(request: Request) -> Response:
    """Create a complex trace"""

    with _tracer_setup() as tracer:
        with tracer.start_as_current_span(
            "complexTrace/root", attributes={TEST_ID: request.test_id}
        ) as root_span:
            trace_id = format_trace_id(root_span.get_span_context().trace_id)
            with tracer.start_as_current_span(
                "complexTrace/child1",
                attributes={TEST_ID: request.test_id},
                kind=SpanKind.SERVER,
            ):
                with tracer.start_as_current_span(
                    "complexTrace/child2",

                    attributes={TEST_ID: request.test_id},