@liflig/cdk
    Preparing search index...

    Class OpenTelemetryCollectors

    Methods to enable collection of Open Telemetry (otel) data of a FargateService using a docker container with an otel agent.

    An example of a Java auto-instrumentation agent in Docker can be found in liflig-rest-baseline Dockerfile.

    The agent must be configured to output metrics to a collector. That collector is what this construct provides. Usually, the agent is specified in the Dockerfile or as a dependency/library, and configured in the Dockerfile or in the application source code.

    Use this construct on a FargateService by constructing a new instance of OpenTelemetryCollectors and calling the addOpenTelemetryCollectorSidecar method on it.

    const service = FargateService(...);

    new OpenTelemetryCollectors(this, "OtelSidecar").addOpenTelemetryCollectorSidecar(service)

    The sidecar exposes these ports to your service:

    • udp 2000 : AWS XRay
    • tcp 4317 : OpenTelemetry collection GRPC
    • tcp 4318 : OpenTelemetry collection HTTP

    You can also disable the OpenTelemetry instrumentation agent for Java-based services, by setting the appropriate environment variable with disableOpenTelemetryJavaAgent:

    const service = FargateService(...);

    OpenTelemetryCollectors.disableOpenTelemetryJavaAgent(service)

    OpenTelemetryCollectors.addOpenTelemetryCollectorSidecar

    Hierarchy

    • Construct
      • OpenTelemetryCollectors
    Index

    Constructors

    Properties

    node: Node

    The tree node.

    Methods

    • The OpenTelemetry Java agent may run by default in the Docker image. This method will tell the agent to disable itself.

      You might want to do this to avoid overhead or error logs from failed connection attempts to the otel collector.

      Returns void

    • Returns a string representation of this construct.

      Returns string

    • The OpenTelemetry Java agent may run by default in the Docker image. This method will tell the agent to disable itself.

      You might want to do this to avoid overhead or error logs from failed connection attempts to the otel collector.

      Parameters

      Returns void

    • Checks if x is a construct.

      Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

      Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

      Parameters

      • x: any

        Any object

      Returns x is Construct

      true if x is an object created from a class which extends Construct.