Skip to content
Draft
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions packages/statsd_input_otel/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
Elastic License 2.0

URL: https://www.elastic.co/licensing/elastic-license

## Acceptance

By using the software, you agree to all of the terms and conditions below.

## Copyright License

The licensor grants you a non-exclusive, royalty-free, worldwide,
non-sublicensable, non-transferable license to use, copy, distribute, make
available, and prepare derivative works of the software, in each case subject to
the limitations and conditions below.

## Limitations

You may not provide the software to third parties as a hosted or managed
service, where the service provides users with access to any substantial set of
the features or functionality of the software.

You may not move, change, disable, or circumvent the license key functionality
in the software, and you may not remove or obscure any functionality in the
software that is protected by the license key.

You may not alter, remove, or obscure any licensing, copyright, or other notices
of the licensor in the software. Any use of the licensor's trademarks is subject
to applicable law.

## Patents

The licensor grants you a license, under any patent claims the licensor can
license, or becomes able to license, to make, have made, use, sell, offer for
sale, import and have imported the software, in each case subject to the
limitations and conditions in this license. This license does not cover any
patent claims that you cause to be infringed by modifications or additions to
the software. If you or your company make any written claim that the software
infringes or contributes to infringement of any patent, your patent license for
the software granted under these terms ends immediately. If your company makes
such a claim, your patent license ends immediately for work on behalf of your
company.

## Notices

You must ensure that anyone who gets a copy of any part of the software from you
also gets a copy of these terms.

If you modify the software, you must include in any modified copies of the
software prominent notices stating that you have modified the software.

## No Other Rights

These terms do not imply any licenses other than those expressly granted in
these terms.

## Termination

If you use the software in violation of these terms, such use is not licensed,
and your licenses will automatically terminate. If the licensor provides you
with a notice of your violation, and you cease all violation of this license no
later than 30 days after you receive that notice, your licenses will be
reinstated retroactively. However, if you violate these terms after such
reinstatement, any additional violation of these terms will cause your licenses
to terminate automatically and permanently.

## No Liability

*As far as the law allows, the software comes as is, without any warranty or
condition, and the licensor will not be liable to you for any damages arising
out of these terms or the use or nature of the software, under any kind of
legal claim.*

## Definitions

The **licensor** is the entity offering these terms, and the **software** is the
software the licensor makes available under these terms, including any portion
of it.

**you** refers to the individual or entity agreeing to these terms.

**your company** is any legal entity, sole proprietorship, or other kind of
organization that you work for, plus all organizations that have control over,
are under the control of, or are under common control with that
organization. **control** means ownership of substantially all the assets of an
entity, or the power to direct its management and policies by vote, contract, or
otherwise. Control can be direct or indirect.

**your licenses** are all the licenses granted to you for the software under
these terms.

**use** means anything you do with the software requiring one of your licenses.

**trademark** means trademarks, service marks, and similar rights.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: '2.3'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 CRITICAL File contains duplicate content

Why: The docker-compose.yml file has been corrupted - it contains duplicate content starting at line 9, which makes it invalid YAML.

Suggested change
version: '2.3'
version: '2.3'
services:
statsd_input_otel:
image: docker.elastic.co/observability/stream:v0.18.0
volumes:
- ./sample_logs:/sample_logs:ro
command: log --start-signal=SIGHUP --delay=10s --addr elastic-agent:8125 -p=udp /sample_logs/test-statsd.log

Why is Claude responding? | Type @claude to interact further

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 CRITICAL Duplicate docker-compose content causes invalid YAML

Why: The file contains the entire docker-compose definition duplicated, making it invalid YAML that will fail to parse.

Suggested change
version: '2.3'
version: '2.3'
services:
statsd_input_otel:
image: docker.elastic.co/observability/stream:v0.18.0
volumes:
- ./sample_logs:/sample_logs:ro
command: log --start-signal=SIGHUP --delay=10s --addr elastic-agent:8125 -p=udp /sample_logs/test-statsd.log

Why is Claude responding? | Type @claude to interact further

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

services:
statsd_input_otel:
image: docker.elastic.co/observability/stream:v0.18.0
volumes:
- ./sample_logs:/sample_logs:ro
command: log --start-signal=SIGHUP --delay=10s --addr elastic-agent:8125 -p=udp /sample_logs/test-statsd.log
ports:
- 8125
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
python.counter:1|c
python.gauge.foo:10|g
python.timer.total:0.07200241|ms
python.counter:1|c
python.gauge.foo:10|g
python.timer.total:0.29730797|ms
python.counter:1|c
python.gauge.foo:10|g
python.timer.total:0.30040741|ms
python.counter:1|c
python.gauge.foo:10|g
python.timer.total:0.29134750|ms
3 changes: 3 additions & 0 deletions packages/statsd_input_otel/_dev/deploy/variants.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
variants:
default: {}
default: default
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
connectors:
forward: {}
exporters:
elasticsearch/componentid-0:
endpoints:
- https://elasticsearch:9200
inputs: []
output_permissions:
default:
_elastic_agent_checks:
cluster:
- monitor
_elastic_agent_monitoring:
indices: []
uuid-for-permissions-on-related-indices:
indices:
- names:
- metrics-*-*
privileges:
- auto_configure
- create_doc
processors:
resourcedetection/componentid-0:
detectors:
- system
transform/componentid-1:
metric_statements:
- context: datapoint
statements:
- set(attributes["data_stream.type"], "metrics")
- set(attributes["data_stream.dataset"], "statsd_otel_input.statsdreceiver")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 MEDIUM Dataset name inconsistent with package name

Why: The package is named 'statsd_input_otel' but the dataset uses 'statsd_otel_input'. This inconsistency may cause confusion with metric routing.

Suggested change
- set(attributes["data_stream.dataset"], "statsd_otel_input.statsdreceiver")
- set(attributes["data_stream.dataset"], "statsd_input_otel.statsdreceiver")

Why is Claude responding? | Type @claude to interact further

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 HIGH data_stream.dataset uses old package name

Why: Package was renamed from statsd_otel_input to statsd_input_otel but expected file wasn't updated. Policy tests will fail.

Suggested change
- set(attributes["data_stream.dataset"], "statsd_otel_input.statsdreceiver")
- set(attributes["data_stream.dataset"], "statsd_input_otel.statsdreceiver")

Why is Claude responding? | Type @claude to interact further

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

- set(attributes["data_stream.namespace"], "ep")
receivers:
statsd/componentid-0:
aggregation_interval: 60s
enable_metric_type: false
endpoint: localhost:8125
is_monotonic_counter: false
transport: udp
secret_references: []
service:
pipelines:
metrics:
exporters:
- elasticsearch/componentid-0
receivers:
- forward
metrics/componentid-0:
exporters:
- forward
processors:
- resourcedetection/componentid-0
- transform/componentid-1
receivers:
- statsd/componentid-0
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
vars:
endpoint: "localhost:8125"
transport: udp
aggregation_interval: 60s
enable_metric_type: false
is_monotonic_counter: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
vars:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 CRITICAL Duplicate vars key makes YAML invalid

Why: The file contains two 'vars:' declarations (lines 1-2), making it invalid YAML. This will cause test failures.

Suggested change
vars:
vars:
endpoint: "0.0.0.0:8125"

Why is Claude responding? | Type @claude to interact further

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 CRITICAL Duplicate 'vars:' key causes invalid YAML

Why: The file has 'vars:' defined twice, which is invalid YAML and will fail to parse during tests.

Suggested change
vars:
vars:
endpoint: "0.0.0.0:8125"

Why is Claude responding? | Type @claude to interact further

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

endpoint: "{{Hostname}}:{{Port}}"
23 changes: 23 additions & 0 deletions packages/statsd_input_otel/agent/input/input.yml.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
receivers:
statsd:
endpoint: {{endpoint}}
{{#if transport}}
transport: {{transport}}
{{/if}}
{{#if aggregation_interval}}
aggregation_interval: {{aggregation_interval}}
{{/if}}
{{#if enable_metric_type}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 HIGH Boolean fields with default false won't be rendered

Why: Handlebars {{#if false}} evaluates to false, so enable_metric_type and is_monotonic_counter won't appear when set to false.

Suggested change
{{#if enable_metric_type}}
receivers:
statsd:
endpoint: {{endpoint}}
{{#if transport}}
transport: {{transport}}
{{/if}}
{{#if aggregation_interval}}
aggregation_interval: {{aggregation_interval}}
{{/if}}
enable_metric_type: {{enable_metric_type}}
is_monotonic_counter: {{is_monotonic_counter}}
processors:
resourcedetection/system:
detectors: ["system"]
service:
pipelines:
metrics:
receivers: [statsd]
processors: [resourcedetection/system]

Why is Claude responding? | Type @claude to interact further

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 HIGH Boolean false values won't render in template

Why: Handlebars {{#if false}} evaluates to false, so enable_metric_type and is_monotonic_counter won't appear in the generated config when set to false. The policy test expects these values but the template won't produce them.

Suggested change
{{#if enable_metric_type}}
receivers:
statsd:
endpoint: {{endpoint}}
{{#if transport}}
transport: {{transport}}
{{/if}}
{{#if aggregation_interval}}
aggregation_interval: {{aggregation_interval}}
{{/if}}
enable_metric_type: {{enable_metric_type}}
is_monotonic_counter: {{is_monotonic_counter}}
processors:
resourcedetection/system:
detectors: ["system"]
service:
pipelines:
metrics:
receivers: [statsd]
processors: [resourcedetection/system]

Why is Claude responding? | Type @claude to interact further

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 MEDIUM Boolean conditionals may not work as expected

Why: Using #if on boolean false values won't render the block, but test-default.expected shows these properties included with false values.

Suggested change
{{#if enable_metric_type}}
enable_metric_type: {{enable_metric_type}}
is_monotonic_counter: {{is_monotonic_counter}}

Why is Claude responding? | Type @claude to interact further

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

enable_metric_type: {{enable_metric_type}}
{{/if}}
{{#if is_monotonic_counter}}
is_monotonic_counter: {{is_monotonic_counter}}
{{/if}}
processors:
resourcedetection/system:
detectors: ["system"]
service:
pipelines:
metrics:
receivers: [statsd]
processors: [resourcedetection/system]
6 changes: 6 additions & 0 deletions packages/statsd_input_otel/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# newer versions go on top
- version: "0.1.0"
changes:
- description: Initial draft of the package
type: enhancement
link: https://github.com/elastic/integrations/issues/17108
61 changes: 61 additions & 0 deletions packages/statsd_input_otel/docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# StatsD OpenTelemetry Input Package

## Overview
The StatsD OpenTelemetry Input Package for Elastic enables collection of metrics from StatsD-compatible applications through OpenTelemetry protocols using the [statsdreceiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/statsdreceiver#statsd-receiver).


### How it works
This package receives telemetry data from StatsD-compatible applications by configuring the StatsD endpoint in the Input Package, which then gets applied to the statsdreceiver present in the EDOT collector, which then forwards the data to Elastic Agent. The Elastic Agent processes and enriches the data before sending it to Elasticsearch for indexing and analysis.

The StatsD receiver listens on a UDP (default), TCP, or Unix socket endpoint for incoming StatsD messages and parses them into OTLP equivalent metric representations.


### Supported metric types

**Counter (c)**
: Measurement which accumulates over period of time until flushed.

**Gauge (g)**
: Measurement which can increase, decrease or be set to a value.

**Timer (ms)**
: Time measurement (in milliseconds) of an event.

**Histogram (h)**
: Time measurement, alias for timer.


### Supported tag extensions

The StatsD receiver supports the following tag formats:

**DogStatsD**
`<metric name>:<value>|<type>|@<sample-rate>|#<tag-key>:<tag-value>,<tag-key>:<tag-value>`

**InfluxDB**
`<metric name>,<tag-key>=<tag-value>,<tag-key>=<tag-value>:<value>|<type>|@<sample-rate>`

**Graphite 1.1.x**
`<metric name>;<tag-key>=<tag-value>;<tag-key>=<tag-value>:<value>|<type>|@<sample-rate>`


## Configuration options

**Endpoint**
: Address and port to listen on. Default is `localhost:8125` for UDP and TCP transports.

**Transport Protocol**
: Protocol used by the StatsD server. Supported values are `udp` (default), `tcp`, and `unixgram`.

**Aggregation Interval**
: The aggregation time that the receiver aggregates the metrics, similar to the flush interval in StatsD server. Default is `60s`.

**Enable Metric Type**
: When enabled, emits the StatsD metric type (gauge, counter, timer, histogram) as a label on the metric.

**Monotonic Counter**
: When enabled, sets all counter metrics as monotonic.


## Metrics reference
For a complete list of all available metrics and their detailed descriptions, refer to the [StatsD Receiver documentation](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/statsdreceiver) in the upstream OpenTelemetry Collector repository.
15 changes: 15 additions & 0 deletions packages/statsd_input_otel/img/statsd_otellogo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
67 changes: 67 additions & 0 deletions packages/statsd_input_otel/manifest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
format_version: 3.5.0
name: statsd_otel_input
title: "StatsD OpenTelemetry Input Package"
version: 0.1.0
source:
license: "Elastic-2.0"
description: "StatsD OpenTelemetry Input Package"
type: input
categories:
- observability
- opentelemetry
- custom
conditions:
kibana:
version: "^9.2.0"
elastic:
subscription: "basic"
icons:
- src: /img/statsd_otellogo.svg
title: StatsD OTel logo
size: 32x32
type: image/svg+xml
policy_templates:
- name: statsdreceiver
type: metrics
title: StatsD OpenTelemetry Input
description: Collect StatsD metrics using OpenTelemetry Collector
input: otelcol
template_path: input.yml.hbs
vars:
- name: endpoint
type: text
required: true
title: Endpoint
description: Address and port to listen on for StatsD metrics.
default: localhost:8125
- name: transport
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚪ LOW Consider using type: select for transport validation

Why: Using select with defined options prevents invalid transport values at configuration time.

Suggested change
- name: transport
- name: transport
type: select
required: false
title: Transport Protocol
description: Protocol used by the StatsD server.
options:
- value: udp
text: UDP
- value: tcp
text: TCP
- value: unixgram
text: Unix Datagram Socket
default: udp
show_user: false

Why is Claude responding? | Type @claude to interact further

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚪ LOW Consider using select type for transport

Why: A select type provides validation and better UX by showing only valid options (udp, tcp, unixgram) in the Fleet UI.

Suggested change
- name: transport
- name: transport
type: select
required: false
title: Transport Protocol
description: Protocol used by the StatsD server.
default: udp
show_user: false
options:
- text: UDP
value: udp
- text: TCP
value: tcp
- text: Unix Datagram
value: unixgram

Why is Claude responding? | Type @claude to interact further

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 MEDIUM Use select type for transport field

Why: Using text type allows arbitrary invalid values; select type provides validation and better UX.

Suggested change
- name: transport
- name: transport
type: select
required: false
title: Transport Protocol
description: Protocol used by the StatsD server.
default: udp
show_user: false
options:
- value: udp
text: UDP
- value: tcp
text: TCP
- value: unixgram
text: Unix Socket

Why is Claude responding? | Type @claude to interact further

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

type: text
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 CRITICAL Duplicate YAML keys in transport variable

Why: Duplicate mapping keys cause YAML parsing errors and fail elastic-package validation.

Suggested change
type: text
- name: transport
type: select
required: false
title: Transport Protocol
description: Protocol used by the StatsD server. Supported values are udp, tcp, and unixgram.
default: udp
show_user: false
options:
- text: UDP
value: udp
- text: TCP
value: tcp
- text: Unix Socket
value: unixgram

Why is Claude responding? | Type @claude to interact further

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

required: false
title: Transport Protocol
description: Protocol used by the StatsD server. Supported values are udp, tcp, and unixgram.
default: udp
show_user: false
- name: aggregation_interval
type: duration
required: false
title: Aggregation Interval
description: The aggregation time that the receiver aggregates the metrics (similar to the flush interval in StatsD server).
default: 60s
show_user: false
- name: enable_metric_type
type: bool
required: false
title: Enable Metric Type
description: Emit the StatsD metric type (gauge, counter, timer, histogram) as a label.
default: false
show_user: false
- name: is_monotonic_counter
type: bool
required: false
title: Monotonic Counter
description: Set all counter metrics as monotonic.
default: false
show_user: false
owner:
github: elastic/obs-infraobs-integrations
type: elastic