Skip to content

Commit 6d1d0a3

Browse files
authored
[receiver/prometheusremotewrite] Add component skeleton (#35295)
**Description:** Add skeleton for Prometheus Remote-Write Receiver. With the release of PrometheusRemoteWritev2, there's commitment from the Prometheus team to implement and maintain this component :) prometheus/prometheus#12633 (comment) **Link to tracking Issue:** #33782 Signed-off-by: Arthur Silva Sens <[email protected]>
1 parent 795694c commit 6d1d0a3

File tree

16 files changed

+292
-0
lines changed

16 files changed

+292
-0
lines changed

.chloggen/prw-receiver.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: new_component
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
7+
component: receiver/prometheusremotewrite
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: |
11+
Add a new receiver for Prometheus Remote Write.
12+
13+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
14+
issues: [33782]
15+
16+
# (Optional) One or more lines of additional information to render under the primary note.
17+
# These lines will be padded with 2 spaces and then inserted directly into the document.
18+
# Use pipe (|) for multiline entries.
19+
subtext:
20+
21+
# If your change doesn't affect end users or the exported elements of any package,
22+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
23+
# Optional: The change log or logs in which this entry should be included.
24+
# e.g. '[user]' or '[user, api]'
25+
# Include 'user' if the change is relevant to end users.
26+
# Include 'api' if there is a change to a library API.
27+
# Default: '[user]'
28+
change_logs: [user]

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ receiver/otlpjsonfilereceiver/ @open-teleme
271271
receiver/podmanreceiver/ @open-telemetry/collector-contrib-approvers @rogercoll
272272
receiver/postgresqlreceiver/ @open-telemetry/collector-contrib-approvers @djaglowski
273273
receiver/prometheusreceiver/ @open-telemetry/collector-contrib-approvers @Aneurysm9 @dashpole
274+
receiver/prometheusremotewritereceiver/ @open-telemetry/collector-contrib-approvers @dashpole @ArthurSens
274275
receiver/pulsarreceiver/ @open-telemetry/collector-contrib-approvers @dmitryax @dao-jun
275276
receiver/purefareceiver/ @open-telemetry/collector-contrib-approvers @jpkrohling @dgoscn @chrroberts-pure
276277
receiver/purefbreceiver/ @open-telemetry/collector-contrib-approvers @jpkrohling @dgoscn @chrroberts-pure

.github/ISSUE_TEMPLATE/bug_report.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ body:
266266
- receiver/podman
267267
- receiver/postgresql
268268
- receiver/prometheus
269+
- receiver/prometheusremotewrite
269270
- receiver/pulsar
270271
- receiver/purefa
271272
- receiver/purefb

.github/ISSUE_TEMPLATE/feature_request.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ body:
260260
- receiver/podman
261261
- receiver/postgresql
262262
- receiver/prometheus
263+
- receiver/prometheusremotewrite
263264
- receiver/pulsar
264265
- receiver/purefa
265266
- receiver/purefb

.github/ISSUE_TEMPLATE/other.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ body:
260260
- receiver/podman
261261
- receiver/postgresql
262262
- receiver/prometheus
263+
- receiver/prometheusremotewrite
263264
- receiver/pulsar
264265
- receiver/purefa
265266
- receiver/purefb

.github/ISSUE_TEMPLATE/unmaintained.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ body:
265265
- receiver/podman
266266
- receiver/postgresql
267267
- receiver/prometheus
268+
- receiver/prometheusremotewrite
268269
- receiver/pulsar
269270
- receiver/purefa
270271
- receiver/purefb
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include ../../Makefile.Common
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!-- status autogenerated section -->
2+
| Status | |
3+
| ------------- |-----------|
4+
| Stability | [development]: metrics |
5+
| Distributions | |
6+
| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Areceiver%2Fprometheusremotewrite%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Areceiver%2Fprometheusremotewrite) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Areceiver%2Fprometheusremotewrite%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Areceiver%2Fprometheusremotewrite) |
7+
| [Code Owners](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#becoming-a-code-owner) | [@dashpole](https://www.github.com/dashpole), [@ArthurSens](https://www.github.com/ArthurSens) |
8+
9+
[development]: https://github.com/open-telemetry/opentelemetry-collector#development
10+
<!-- end autogenerated section -->
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright The OpenTelemetry Authors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
package prometheusremotewritereceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusremotewritereceiver"
5+
6+
import (
7+
"go.opentelemetry.io/collector/component"
8+
)
9+
10+
// Config holds common fields and embedded protocol-specific configurations
11+
type Config struct{}
12+
13+
var _ component.Config = (*Config)(nil)
14+
15+
// Validate checks the receiver configuration is valid
16+
func (cfg *Config) Validate() error {
17+
return nil
18+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Copyright The OpenTelemetry Authors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
package prometheusremotewritereceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusremotewritereceiver"
5+
6+
import (
7+
"context"
8+
9+
"go.opentelemetry.io/collector/component"
10+
"go.opentelemetry.io/collector/consumer"
11+
"go.opentelemetry.io/collector/receiver"
12+
13+
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusremotewritereceiver/internal/metadata"
14+
)
15+
16+
// NewFactory creates a new Prometheus receiver factory.
17+
func NewFactory() receiver.Factory {
18+
return receiver.NewFactory(
19+
metadata.Type,
20+
createDefaultConfig,
21+
receiver.WithMetrics(createMetricsReceiver, metadata.MetricsStability))
22+
}
23+
24+
func createDefaultConfig() component.Config {
25+
return &Config{}
26+
}
27+
28+
// createMetrics creates a metrics receiver based on provided config.
29+
func createMetricsReceiver(
30+
_ context.Context,
31+
set receiver.Settings,
32+
cfg component.Config,
33+
nextConsumer consumer.Metrics,
34+
) (receiver.Metrics, error) {
35+
rCfg := cfg.(*Config)
36+
return newRemoteWriteReceiver(set, rCfg, nextConsumer)
37+
}

0 commit comments

Comments
 (0)