Skip to content

New component: googlecloudlogentryencodingextension #37531

Open
@alexvanboxel

Description

@alexvanboxel

The purpose and use-cases of the new component

This extension can be used fo unmarshaling a Cloud Logging LogEntry message type.

The following configuration options are supported:

  • handle_json_payload_as (Optional): This controls how the json payload of the LogEntry is parsed into the body.
    The default json parses it as standard JSON, while text will the put the payload as a single string.
  • handle_proto_payload_as (Optional): This controls how the json payload of the LogEntry is parsed into the body.
    The default json parses it as standard JSON, while proto will use the well known protobuf types used in a
    LogEntry providing a better type handling, but sacrificing stability. Using text will the put the payload as a
    single string.

The encoding is mainly used in conjunction with the googlecloudpubsubreceiver. The receiver can be used to bring
Cloud Logging messages into an OpenTelemetry pipeline. You'll first need to set up a logging sink with
a Pub/Sub topic as its destination. This encoder can be configure to parse the LogEntry. An example config
could look like this:

extensions:
  googlecloudlogentry_encoding:
    handle_json_payload_as: "json"
    handle_proto_payload_as: "json"

receivers:
  googlecloudpubsub:
    project: otel-project
    subscription: projects/otel-project/subscriptions/otlp-logs
    encoding: googlecloudlogentry_encoding

Example configuration for the component

  googlecloudlogentry_encoding:
    handle_json_payload_as: "json"
    handle_proto_payload_as: "json"

receivers:
  googlecloudpubsub:
    project: otel-project
    subscription: projects/otel-project/subscriptions/otlp-logs
    encoding: googlecloudlogentry_encoding

Telemetry data types supported

logs

Code Owner(s)

alexvanboxel

Sponsor (optional)

@atoulme

Additional context

This encoder is currently part of the googlecloudpubsubreceiver. The main goal to extract this is that this component can have an alpha stability (due to the changing semantic conventions), and the googlepubsubreceiver and googlepubsubexporter reach GA stability.

The googlepubsubreceiver now support encoding extensions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions