Skip to content

New component: NATS as a Receiver and Exporter #39540

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

Open
yeongjonglim opened this issue Apr 22, 2025 · 4 comments
Open

New component: NATS as a Receiver and Exporter #39540

yeongjonglim opened this issue Apr 22, 2025 · 4 comments
Labels
never stale Issues marked with this label will be never staled and automatically removed Sponsor Needed New component seeking sponsor

Comments

@yeongjonglim
Copy link

The purpose and use-cases of the new component

NATS is a common tool being deployed as part of an IoT solution thanks to its simplicity to deploy in edge location. Usually the edge location would contain other components that are worth monitoring (for all traces, metrics and logs). On top of that, NATS support data replication from edge to cloud making it a great candidate to stream telemetry data over internet reliably. Here I would like to propose to have a component which export OTLP data to NATS and a receiver to consume the OTLP data from NATS.

Example configuration for the component

receivers:
  nats:
    server_url: nats://localhost:4222
    tls:
      insecure: false
      ca_file: server.crt
      cert_file: client.crt
      key_file: client.key
      min_version: "1.1"
      max_version: "1.2"
    logs:
      subject: telemetry.logs
      encoding: otlp_proto
    metrics:
      subject: telemetry.metrics
      encoding: otlp_proto
    traces:
      subject: telemetry.traces
      encoding: otlp_json
    auth:
      # Option 1: Basic auth
      username: ${env:NATS_USERNAME}
      password: ${env:NATS_PASSWORD}
      # Option 2: Token-based auth
      token: ${env:NATS_TOKEN}
      # Option 3: TLS cert-based auth
      tls:
        cert_file: /etc/otel/certs/client-cert.pem
        key_file: /etc/otel/certs/client-key.pem
        ca_file: /etc/otel/certs/ca.pem
      # Option 4: NKey auth
      nkey: ${env:NATS_NKEY}
      # Option 5: JWT auth
      jwt: {env:NATS_JWT}

exporters:
  nats:
    server_url: nats://localhost:4222
    tls:
      insecure: false
      ca_file: server.crt
      cert_file: client.crt
      key_file: client.key
      min_version: "1.1"
      max_version: "1.2"
    logs:
      subject: telemetry.logs
      encoding: otlp_proto
    metrics:
      subject: telemetry.metrics
      encoding: otlp_proto
    traces:
      subject: telemetry.traces
      encoding: otlp_json
    auth:
      # Option 1: Basic auth
      username: ${env:NATS_USERNAME}
      password: ${env:NATS_PASSWORD}
      # Option 2: Token-based auth
      token: ${env:NATS_TOKEN}
      # Option 3: TLS cert-based auth
      tls:
        cert_file: /etc/otel/certs/client-cert.pem
        key_file: /etc/otel/certs/client-key.pem
        ca_file: /etc/otel/certs/ca.pem
      # Option 4: NKey auth
      nkey: ${env:NATS_NKEY}
      # Option 5: JWT auth
      jwt: {env:NATS_JWT}

processors:
  resource:
    attributes:
      - key: edge_device
        value: junction_123
        action: upsert

service:
  pipelines:
    metrics:
      receivers: [nats]
      processors: [resource]
      exporters: [nats]

Telemetry data types supported

traces, metrics and logs

Code Owner(s)

Looking for a code owner

Sponsor (optional)

Looking for a sponsor — open to guidance from maintainers or anyone involved with NATS

Additional context

No response

@yeongjonglim yeongjonglim added needs triage New item requiring triage Sponsor Needed New component seeking sponsor labels Apr 22, 2025
@Amoolaa
Copy link

Amoolaa commented Apr 27, 2025

@ChrsMark ChrsMark added never stale Issues marked with this label will be never staled and automatically removed and removed needs triage New item requiring triage labels May 26, 2025
@ChrsMark
Copy link
Member

Looks like a legit proposal to have these receiver/exporter components. The tough part would be to find code-owners for this.

I'm going to remove the needs triage label now and leave this open to keep the request and the discussion open.

Pinging some NATS folks @ColinSullivan1 @derekcollison @wallyqs in case they are interested.

@ColinSullivan1
Copy link

Very cool. Thanks for reaching out. I may be able to contribute some time on this in late June / July. I've looked through a few of the exporters and receivers - would there be a particular receiver and producer that you would suggest looking at as an example?

@ChrsMark
Copy link
Member

I think a good example would be kafkareceiver and kafkaexporter :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
never stale Issues marked with this label will be never staled and automatically removed Sponsor Needed New component seeking sponsor
Projects
None yet
Development

No branches or pull requests

4 participants