| 1 |
// Copyright The OpenTelemetry Authors |
| 2 |
// SPDX-License-Identifier: Apache-2.0 |
| 3 |
|
| 4 |
// Package receiver defines components that allow the Collector to receive metrics, traces and logs. |
| 5 |
// |
| 6 |
// A receiver receives data from a source (either from a remote source via network |
| 7 |
// or scrapes from a local host) and pushes the data to the pipelines it is attached |
| 8 |
// to by calling the nextConsumer.Consume*() function. |
| 9 |
// |
| 10 |
// # Error Handling |
| 11 |
// |
| 12 |
// The nextConsumer.Consume*() function may return an error to indicate that the data was not |
| 13 |
// accepted. This error should be handled as documented in the consumererror package. |
| 14 |
// |
| 15 |
// Depending on the error type, the receiver must indicate to the source from which it received the |
| 16 |
// data the type of error in a protocol-dependent way, if that is supported by the receiving protocol. |
| 17 |
// For example, a receiver for the OTLP/HTTP protocol would use the HTTP status codes as defined in |
| 18 |
// the OTLP specification. |
| 19 |
// |
| 20 |
// # Acknowledgment and Checkpointing |
| 21 |
// |
| 22 |
// The receivers that receive data via a network protocol that support acknowledgments |
| 23 |
// MUST follow this order of operations: |
| 24 |
// - Receive data from some sender (typically from a network). |
| 25 |
// - Push received data to the pipeline by calling nextConsumer.Consume*() function. |
| 26 |
// - Acknowledge successful data receipt to the sender if Consume*() succeeded or |
| 27 |
// return a failure to the sender if Consume*() returned an error. |
| 28 |
// |
| 29 |
// This ensures there are strong delivery guarantees once the data is acknowledged |
| 30 |
// by the Collector. |
| 31 |
// |
| 32 |
// Similarly, receivers that use checkpointing to remember the position of last processed |
| 33 |
// data (e.g. via storage extension) MUST store the checkpoint only AFTER the Consume*() |
| 34 |
// call returns. |
| 35 |
package receiver // import "go.opentelemetry.io/collector/receiver" |