Improve OC Receiver Documentation (#203)
* First round of receiver and opencensus receiver documentation. * Undo go mod/sum changes * Address initial set of comments. * Address next set of comments. * Address next set of comments. * Fix use of server instead of receiver in comment and explain settings can be mix and matched. * Merged master and fixed mispell error caugh with new tools
This commit is contained in:
parent
a1ecc6f948
commit
166027710f
56
README.md
56
README.md
|
|
@ -122,14 +122,29 @@ exporting will resume.
|
|||
## <a name="config"></a>Configuration
|
||||
|
||||
The OpenTelemetry Service (both the Agent and Collector) is configured via a
|
||||
YAML file. In general, you need to configure one or more receivers as well as
|
||||
one or more exporters. In addition, diagnostics can also be configured.
|
||||
YAML file. In general, at least one enabled receiver and one enabled exporter
|
||||
needs to be configured.
|
||||
|
||||
*Note* This documentation is still in progress. For any questions, please reach out in the
|
||||
[OpenTelemetry Gitter](https://gitter.im/open-telemetry/opentelemetry-service) or
|
||||
refer to the [issues page](https://github.com/open-telemetry/opentelemetry-service/issues).
|
||||
|
||||
There are four main parts to a config:
|
||||
```yaml
|
||||
receivers:
|
||||
...
|
||||
exporters:
|
||||
...
|
||||
processors:
|
||||
...
|
||||
pipelines:
|
||||
...
|
||||
```
|
||||
|
||||
### <a name="config-receivers"></a>Receivers
|
||||
|
||||
A receiver is how you get data into the OpenTelemetry Service. One or more
|
||||
receivers can be configured. By default, the `opentelemetry` receiver is enabled
|
||||
on the Collector and required as a defined receiver for the Agent.
|
||||
A receiver is how data gets into OpenTelemetry Service. One or more receivers
|
||||
must be configured.
|
||||
|
||||
A basic example of all available receivers is provided below. For detailed
|
||||
receiver configuration, please see the [receiver
|
||||
|
|
@ -182,6 +197,33 @@ exporters:
|
|||
endpoint: "http://127.0.0.1:9411/api/v2/spans"
|
||||
```
|
||||
|
||||
### <a name="config-pipelines"></a>Pipelines
|
||||
Pipelines can be of two types:
|
||||
|
||||
- metrics: collects and processes metrics data.
|
||||
- traces: collects and processes trace data.
|
||||
|
||||
A pipeline consists of a set of receivers, processors, and exporters. Each
|
||||
receiver/processor/exporter must be specified in the configuration to be
|
||||
included in a pipeline and each receiver/processor/exporter can be used in more
|
||||
than one pipeline.
|
||||
|
||||
*Note:* For processor(s) referenced in multiple pipelines, each pipeline will
|
||||
get a separate instance of that processor(s). This is in contrast to
|
||||
receiver(s)/exporter(s) referenced in multiple pipelines, one instance of
|
||||
a receiver/exporter is reference by all the pipelines.
|
||||
|
||||
The following is an example pipeline configuration. For more information, refer
|
||||
to [pipeline documentation](docs/pipelines.md)
|
||||
```yaml
|
||||
pipelines:
|
||||
traces:
|
||||
receivers: [examplereceiver]
|
||||
processors: [exampleprocessor]
|
||||
exporters: [exampleexporter]
|
||||
|
||||
```
|
||||
|
||||
### <a name="config-diagnostics"></a>Diagnostics
|
||||
|
||||
zPages is provided for monitoring running by default on port ``55679``.
|
||||
|
|
@ -208,7 +250,10 @@ zpages:
|
|||
disabled: true
|
||||
```
|
||||
|
||||
|
||||
### <a name="global-attributes"></a> Global Attributes
|
||||
**TODO** Remove this once processors have been documented since that handles
|
||||
these features now.
|
||||
|
||||
The OpenTelemetry Service also takes some global configurations that modify its
|
||||
behavior for all receivers / exporters. This configuration is typically applied
|
||||
|
|
@ -301,7 +346,6 @@ sampling:
|
|||
```
|
||||
|
||||
> Note that an exporter can only have a single sampling policy today.
|
||||
|
||||
## <a name="collector-usage"></a>Usage
|
||||
|
||||
> It is recommended that you use the latest [release](https://github.com/open-telemetry/opentelemetry-service/releases).
|
||||
|
|
|
|||
|
|
@ -55,6 +55,8 @@ const (
|
|||
errPipelineExporterNotExists
|
||||
errMetricPipelineCannotHaveProcessors
|
||||
errUnmarshalError
|
||||
errMissingReceivers
|
||||
// TODO(ccaraman): Add an error for missing Processors with corresponding test cases.
|
||||
)
|
||||
|
||||
type configError struct {
|
||||
|
|
@ -175,6 +177,19 @@ func loadReceivers(v *viper.Viper, factories map[string]receiver.Factory) (confi
|
|||
// Get the map of "receivers" sub-keys.
|
||||
keyMap := v.GetStringMap(receiversKeyName)
|
||||
|
||||
// Currently there is no default receiver enabled. The configuration must specify at least one receiver to enable
|
||||
// functionality.
|
||||
if len(keyMap) == 0 {
|
||||
return nil, &configError{
|
||||
code: errMissingReceivers,
|
||||
msg: "no receivers specified in config",
|
||||
}
|
||||
}
|
||||
|
||||
// This boolean is used to track if there are any enabled receivers. If there are none at the end of loading
|
||||
// all of the receivers, throw an error.
|
||||
enabledReceiver := false
|
||||
|
||||
// Prepare resulting map
|
||||
receivers := make(configmodels.Receivers, 0)
|
||||
|
||||
|
|
@ -211,6 +226,9 @@ func loadReceivers(v *viper.Viper, factories map[string]receiver.Factory) (confi
|
|||
err = customUnmarshaler(subViper, key, receiverCfg)
|
||||
} else {
|
||||
// Standard viper unmarshaler is fine.
|
||||
// TODO(ccaraman): UnmarshallExact should be used to catch erroneous config entries.
|
||||
// This leads to quickly identifying config values that are not supported and reduce confusion for
|
||||
// users.
|
||||
err = subViper.UnmarshalKey(key, receiverCfg)
|
||||
}
|
||||
|
||||
|
|
@ -228,9 +246,20 @@ func loadReceivers(v *viper.Viper, factories map[string]receiver.Factory) (confi
|
|||
}
|
||||
}
|
||||
|
||||
// Or'ing the enabled flag for all receivers will return true if at least one is enabled.
|
||||
enabledReceiver = enabledReceiver || receiverCfg.IsEnabled()
|
||||
|
||||
receivers[fullName] = receiverCfg
|
||||
}
|
||||
|
||||
// There must be at least one enabled receiver for the config to be valid.
|
||||
if !enabledReceiver {
|
||||
return nil, &configError{
|
||||
code: errMissingReceivers,
|
||||
msg: "no enabled receivers specified in config",
|
||||
}
|
||||
}
|
||||
|
||||
return receivers, nil
|
||||
}
|
||||
|
||||
|
|
@ -496,6 +525,7 @@ func validatePipelineReceivers(
|
|||
zap.String("receiver", ref))
|
||||
}
|
||||
}
|
||||
|
||||
pipeline.Receivers = rs
|
||||
|
||||
return nil
|
||||
|
|
@ -594,6 +624,9 @@ func validatePipelineProcessors(
|
|||
return nil
|
||||
}
|
||||
|
||||
// TODO(ccaraman): Determine if there a way to consolidate the validate receivers apart of the loadReceivers method.
|
||||
// Currently, validateReceivers needs to be invoked after validatePipelineReceivers because that bit of
|
||||
// code checks if a receiver is enabled prior to finalizing the pipelines.
|
||||
func validateReceivers(cfg *configmodels.Config) {
|
||||
// Remove disabled receivers.
|
||||
for name, rcv := range cfg.Receivers {
|
||||
|
|
|
|||
|
|
@ -176,7 +176,8 @@ func TestDecodeConfig_Invalid(t *testing.T) {
|
|||
}{
|
||||
{name: "empty-config"},
|
||||
{name: "missing-all-sections"},
|
||||
{name: "missing-receivers"},
|
||||
{name: "missing-enabled-receivers", expected: errMissingReceivers},
|
||||
{name: "missing-receivers", expected: errMissingReceivers},
|
||||
{name: "missing-exporters"},
|
||||
{name: "missing-processors"},
|
||||
{name: "invalid-receiver-name"},
|
||||
|
|
|
|||
|
|
@ -142,11 +142,19 @@ const (
|
|||
// ReceiverSettings defines common settings for a single-protocol receiver configuration.
|
||||
// Specific receivers can embed this struct and extend it with more fields if needed.
|
||||
type ReceiverSettings struct {
|
||||
TypeVal string `mapstructure:"-"`
|
||||
NameVal string `mapstructure:"-"`
|
||||
Disabled bool `mapstructure:"disabled"`
|
||||
Endpoint string `mapstructure:"endpoint"`
|
||||
DisableBackPressure bool `mapstructure:"disable-backpressure"`
|
||||
TypeVal string `mapstructure:"-"`
|
||||
NameVal string `mapstructure:"-"`
|
||||
// Configures if the receiver is disabled and doesn't receive any data.
|
||||
// The default value is false(meaning the receiver is enabled by default), and it is expected that receivers
|
||||
// continue to use the default value of false.
|
||||
Disabled bool `mapstructure:"disabled"`
|
||||
// Configures the endpoint in the format 'address:port' for the receiver.
|
||||
// The default value is set by the receiver populating the struct.
|
||||
Endpoint string `mapstructure:"endpoint"`
|
||||
// Configures if the back pressure functionality is disabled for this receiver.
|
||||
// The default value is false, and it is expected that receivers
|
||||
// continue to use the default value of false.
|
||||
DisableBackPressure bool `mapstructure:"disable-backpressure"`
|
||||
}
|
||||
|
||||
// Name gets the receiver name.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
receivers:
|
||||
examplereceiver:
|
||||
disabled: true
|
||||
examplereceiver/disabled:
|
||||
disabled: true
|
||||
|
||||
processors:
|
||||
exampleprocessor:
|
||||
exampleprocessor/disabled:
|
||||
disabled: true
|
||||
|
||||
exporters:
|
||||
exampleexporter/myexporter:
|
||||
extra: "some export string 2"
|
||||
exampleexporter/disabled:
|
||||
disabled: true
|
||||
exampleexporter:
|
||||
|
||||
pipelines:
|
||||
traces:
|
||||
receivers: [examplereceiver, examplereceiver/disabled]
|
||||
processors: [exampleprocessor, exampleprocessor/disabled]
|
||||
exporters: [exampleexporter/disabled, exampleexporter]
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
# Pipelines
|
||||
*Note* This documentation is still in progress. For any questions, please reach
|
||||
out in the [OpenTelemetry Gitter](https://gitter.im/open-telemetry/opentelemetry-service)
|
||||
or refer to the [issues page](https://github.com/open-telemetry/opentelemetry-service/issues).
|
||||
|
|
@ -25,6 +25,7 @@ import (
|
|||
|
||||
const (
|
||||
// ZPagesHTTPPort is the name of the flag used to specify the zpages port.
|
||||
// TODO(ccaraman): Move ZPage configuration to be apart of global config/config.go, maybe under diagnostics section.
|
||||
ZPagesHTTPPort = "zpages-http-port"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
# Processors
|
||||
*Note* This documentation is still in progress. For any questions, please reach
|
||||
out in the [OpenTelemetry Gitter](https://gitter.im/open-telemetry/opentelemetry-service)
|
||||
or refer to the [issues page](https://github.com/open-telemetry/opentelemetry-service/issues).
|
||||
|
|
@ -1,11 +1,28 @@
|
|||
A variety of receivers are available to the OpenCensus Service (both Agent and Collector)
|
||||
**Note** This documentation is still in progress. For any questions, please
|
||||
reach out in the [OpenTelemetry Gitter](https://gitter.im/open-telemetry/opentelemetry-service)
|
||||
or refer to the [issues page](https://github.com/open-telemetry/opentelemetry-service/issues).
|
||||
|
||||
__Currently there are some inconsistencies between Agent and Collector configuration, those will be addressed by issue
|
||||
[#135](https://github.com/census-instrumentation/opencensus-service/issues/135).__
|
||||
# Receivers
|
||||
A receiver is how data gets into OpenTelemetry Service. Generally, a receiver
|
||||
accepts data in a specified format and can support traces and/or metrics. The
|
||||
format of the traces and metrics supported are receiver specific.
|
||||
|
||||
## OpenCensus
|
||||
Supported receivers (sorted alphabetically):
|
||||
- [Jaeger Receiver](#jaeger)
|
||||
- [OpenCensus Receiver](#opencensus)
|
||||
- [Prometheus Receiver](#prometheus)
|
||||
- [VM Metrics Receiver](#vmmetrics)
|
||||
- [Zipkin Receiver](#zipkin)
|
||||
|
||||
This receiver receives spans from OpenCensus instrumented applications and translates them into the internal span types that are then sent to the collector/exporters.
|
||||
## Configuring Receiver(s)
|
||||
TODO - Add what a fullname is and how that is referenced in other parts of the
|
||||
configuration. Describe the common receiver settings: endpoint, disabled and
|
||||
disable-backpressure.
|
||||
|
||||
## <a name="opencensus"></a>OpenCensus Receiver
|
||||
**Traces and metrics are supported.**
|
||||
|
||||
This receiver receives spans from [OpenCensus](https://opencensus.io/) instrumented applications and translates them into the internal format sent to processors and exporters in the pipeline.
|
||||
|
||||
Its address can be configured in the YAML configuration file under section "receivers", subsection "opencensus" and field "address". The syntax of the field "address" is `[address|host]:<port-number>`.
|
||||
|
||||
|
|
@ -39,7 +56,12 @@ receivers:
|
|||
- https://*.example.com
|
||||
```
|
||||
|
||||
### Deprecated YAML Configurations
|
||||
**Note**: This isn't a full list of deprecated OpenCensus YAML configurations. If something is missing, please expand the documentation
|
||||
or open an issue.
|
||||
|
||||
### Collector Differences
|
||||
TODO(ccaraman) - Delete all references to opencensus-service issue 135 in follow up pr.
|
||||
(To be fixed via [#135](https://github.com/census-instrumentation/opencensus-service/issues/135))
|
||||
|
||||
By default this receiver is ALWAYS started on the OpenCensus Collector, it can be disabled via command-line by
|
||||
|
|
@ -97,9 +119,12 @@ receivers:
|
|||
permit-without-stream: true
|
||||
```
|
||||
|
||||
## Jaeger
|
||||
|
||||
## <a name="jaeger"></a>Jaeger Receiver
|
||||
**Only traces are supported.**
|
||||
|
||||
This receiver receives spans from Jaeger collector HTTP and Thrift uploads and translates them into the internal span types that are then sent to the collector/exporters.
|
||||
Only traces are supported. This receiver does not support metrics.
|
||||
|
||||
Its address can be configured in the YAML configuration file under section "receivers", subsection "jaeger" and fields "collector_http_port", "collector_thrift_port".
|
||||
|
||||
|
|
@ -124,32 +149,8 @@ receivers:
|
|||
jaeger-thrift-http-port: 14268
|
||||
```
|
||||
|
||||
## Zipkin
|
||||
|
||||
This receiver receives spans from Zipkin (V1 and V2) HTTP uploads and translates them into the internal span types that are then sent to the collector/exporters.
|
||||
|
||||
Its address can be configured in the YAML configuration file under section "receivers", subsection "zipkin" and field "address". The syntax of the field "address" is `[address|host]:<port-number>`.
|
||||
|
||||
For example:
|
||||
|
||||
```yaml
|
||||
receivers:
|
||||
zipkin:
|
||||
address: "127.0.0.1:9411"
|
||||
```
|
||||
|
||||
### Collector Differences
|
||||
(To be fixed via [#135](https://github.com/census-instrumentation/opencensus-service/issues/135))
|
||||
|
||||
On the Collector Zipkin reception at the port 9411 can be enabled via command-line `--receive-zipkin`. On the Collector only the port can be configured, example:
|
||||
|
||||
```yaml
|
||||
receivers:
|
||||
zipkin:
|
||||
port: 9411
|
||||
```
|
||||
|
||||
## Prometheus
|
||||
## <a name="prometheus"></a>Prometheus Receiver
|
||||
**Only metrics are supported.**
|
||||
|
||||
This receiver is a drop-in replacement for getting Prometheus to scrape your services. Just like you would write in a
|
||||
YAML configuration file before starting Prometheus, such as with:
|
||||
|
|
@ -180,3 +181,37 @@ receivers:
|
|||
static_configs:
|
||||
- targets: ['localhost:9777']
|
||||
```
|
||||
|
||||
## <a name="vmmetrics"></a>VM Metrics Receiver
|
||||
**Only metrics are supported.**
|
||||
|
||||
<Add more information - I'm lonely.>
|
||||
|
||||
## <a name="zipkin"></a>Zipkin Receiver
|
||||
**Only traces are supported.**
|
||||
|
||||
This receiver receives spans from Zipkin (V1 and V2) HTTP uploads and translates them into the internal span types that are then sent to the collector/exporters.
|
||||
|
||||
Its address can be configured in the YAML configuration file under section "receivers", subsection "zipkin" and field "address". The syntax of the field "address" is `[address|host]:<port-number>`.
|
||||
|
||||
For example:
|
||||
|
||||
```yaml
|
||||
receivers:
|
||||
zipkin:
|
||||
address: "127.0.0.1:9411"
|
||||
```
|
||||
|
||||
### Collector Differences
|
||||
(To be fixed via [#135](https://github.com/census-instrumentation/opencensus-service/issues/135))
|
||||
|
||||
On the Collector Zipkin reception at the port 9411 can be enabled via command-line `--receive-zipkin`. On the Collector only the port can be configured, example:
|
||||
|
||||
```yaml
|
||||
receivers:
|
||||
zipkin:
|
||||
port: 9411
|
||||
```
|
||||
|
||||
## Common Configuration Errors
|
||||
<Fill this in as we go with common gotchas experienced by users. These should eventually be made apart of the validation test suite.>
|
||||
|
|
|
|||
|
|
@ -44,6 +44,8 @@ type Config struct {
|
|||
|
||||
// tlsCredentials holds the fields for TLS credentials
|
||||
// that are used for starting a server.
|
||||
// TODO(ccaraman): Add validation to check that these files exist at configuration loading time.
|
||||
// Currently, these values aren't validated until the receiver is started.
|
||||
type tlsCredentials struct {
|
||||
// CertFile is the file path containing the TLS certificate.
|
||||
CertFile string `mapstructure:"cert-file"`
|
||||
|
|
@ -58,6 +60,7 @@ type serverParametersAndEnforcementPolicy struct {
|
|||
}
|
||||
|
||||
// keepaliveServerParameters allow configuration of the keepalive.ServerParameters.
|
||||
// The same default values as keepalive.ServerParameters are applicable and get applied by the server.
|
||||
// See https://godoc.org/google.golang.org/grpc/keepalive#ServerParameters for details.
|
||||
type keepaliveServerParameters struct {
|
||||
MaxConnectionIdle time.Duration `mapstructure:"max-connection-idle,omitempty"`
|
||||
|
|
@ -68,6 +71,7 @@ type keepaliveServerParameters struct {
|
|||
}
|
||||
|
||||
// keepaliveEnforcementPolicy allow configuration of the keepalive.EnforcementPolicy.
|
||||
// The same default values as keepalive.EnforcementPolicy are applicable and get applied by the server.
|
||||
// See https://godoc.org/google.golang.org/grpc/keepalive#EnforcementPolicy for details.
|
||||
type keepaliveEnforcementPolicy struct {
|
||||
MinTime time.Duration `mapstructure:"min-time,omitempty"`
|
||||
|
|
@ -77,7 +81,7 @@ type keepaliveEnforcementPolicy struct {
|
|||
func (rOpts *Config) buildOptions() (opts []Option, err error) {
|
||||
tlsCredsOption, hasTLSCreds, err := rOpts.TLSCredentials.ToOpenCensusReceiverServerOption()
|
||||
if err != nil {
|
||||
return opts, fmt.Errorf("OpenCensus receiver TLS Credentials: %v", err)
|
||||
return opts, fmt.Errorf("Error initializing OpenCensus receiver %q TLS Credentials: %v", rOpts.NameVal, err)
|
||||
}
|
||||
if hasTLSCreds {
|
||||
opts = append(opts, tlsCredsOption)
|
||||
|
|
@ -99,6 +103,10 @@ func (rOpts *Config) grpcServerOptions() []grpc.ServerOption {
|
|||
if rOpts.MaxConcurrentStreams > 0 {
|
||||
grpcServerOptions = append(grpcServerOptions, grpc.MaxConcurrentStreams(rOpts.MaxConcurrentStreams))
|
||||
}
|
||||
// The default values referenced in the GRPC docs are set within the server, so this code doesn't need
|
||||
// to apply them over zero/nil values before passing these as grpc.ServerOptions.
|
||||
// The following shows the server code for applying default grpc.ServerOptions.
|
||||
// https://sourcegraph.com/github.com/grpc/grpc-go@120728e1f775e40a2a764341939b78d666b08260/-/blob/internal/transport/http2_server.go#L184-200
|
||||
if rOpts.Keepalive != nil {
|
||||
if rOpts.Keepalive.ServerParameters != nil {
|
||||
svrParams := rOpts.Keepalive.ServerParameters
|
||||
|
|
@ -110,6 +118,10 @@ func (rOpts *Config) grpcServerOptions() []grpc.ServerOption {
|
|||
Timeout: svrParams.Timeout,
|
||||
}))
|
||||
}
|
||||
// The default values referenced in the GRPC are set within the server, so this code doesn't need
|
||||
// to apply them over zero/nil values before passing these as grpc.ServerOptions.
|
||||
// The following shows the server code for applying default grpc.ServerOptions.
|
||||
// https://sourcegraph.com/github.com/grpc/grpc-go@120728e1f775e40a2a764341939b78d666b08260/-/blob/internal/transport/http2_server.go#L202-205
|
||||
if rOpts.Keepalive.EnforcementPolicy != nil {
|
||||
enfPol := rOpts.Keepalive.EnforcementPolicy
|
||||
grpcServerOptions = append(grpcServerOptions, grpc.KeepaliveEnforcementPolicy(keepalive.EnforcementPolicy{
|
||||
|
|
|
|||
|
|
@ -39,7 +39,9 @@ func TestLoadConfig(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
require.NotNil(t, cfg)
|
||||
|
||||
assert.Equal(t, len(cfg.Receivers), 4)
|
||||
// Currently disabled receivers are removed from the total list of receivers so 'opencensus/disabled' doesn't
|
||||
// contribute to the count.
|
||||
assert.Equal(t, len(cfg.Receivers), 5)
|
||||
|
||||
r0 := cfg.Receivers["opencensus"]
|
||||
assert.Equal(t, r0, factory.CreateDefaultConfig())
|
||||
|
|
@ -47,9 +49,10 @@ func TestLoadConfig(t *testing.T) {
|
|||
r1 := cfg.Receivers["opencensus/customname"].(*Config)
|
||||
assert.Equal(t, r1.ReceiverSettings,
|
||||
configmodels.ReceiverSettings{
|
||||
TypeVal: typeStr,
|
||||
NameVal: "opencensus/customname",
|
||||
Endpoint: "0.0.0.0:9090",
|
||||
TypeVal: typeStr,
|
||||
NameVal: "opencensus/customname",
|
||||
Endpoint: "0.0.0.0:9090",
|
||||
DisableBackPressure: true,
|
||||
})
|
||||
|
||||
r2 := cfg.Receivers["opencensus/keepalive"].(*Config)
|
||||
|
|
@ -62,8 +65,11 @@ func TestLoadConfig(t *testing.T) {
|
|||
},
|
||||
Keepalive: &serverParametersAndEnforcementPolicy{
|
||||
ServerParameters: &keepaliveServerParameters{
|
||||
Time: 30 * time.Second,
|
||||
Timeout: 5 * time.Second,
|
||||
MaxConnectionIdle: 11 * time.Second,
|
||||
MaxConnectionAge: 12 * time.Second,
|
||||
MaxConnectionAgeGrace: 13 * time.Second,
|
||||
Time: 30 * time.Second,
|
||||
Timeout: 5 * time.Second,
|
||||
},
|
||||
EnforcementPolicy: &keepaliveEnforcementPolicy{
|
||||
MinTime: 10 * time.Second,
|
||||
|
|
@ -83,5 +89,26 @@ func TestLoadConfig(t *testing.T) {
|
|||
},
|
||||
MaxRecvMsgSizeMiB: 32,
|
||||
MaxConcurrentStreams: 16,
|
||||
Keepalive: &serverParametersAndEnforcementPolicy{
|
||||
ServerParameters: &keepaliveServerParameters{
|
||||
MaxConnectionIdle: 10 * time.Second,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
// TODO(ccaraman): Once the config loader checks for the files existence, this test may fail and require
|
||||
// use of fake cert/key for test purposes.
|
||||
r4 := cfg.Receivers["opencensus/tlscredentials"].(*Config)
|
||||
assert.Equal(t, r4,
|
||||
&Config{
|
||||
ReceiverSettings: configmodels.ReceiverSettings{
|
||||
TypeVal: typeStr,
|
||||
NameVal: "opencensus/tlscredentials",
|
||||
Endpoint: "127.0.0.1:55678",
|
||||
},
|
||||
TLSCredentials: &tlsCredentials{
|
||||
CertFile: "test.crt",
|
||||
KeyFile: "test.key",
|
||||
},
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,6 +51,8 @@ func (f *Factory) CreateDefaultConfig() configmodels.Receiver {
|
|||
TypeVal: typeStr,
|
||||
NameVal: typeStr,
|
||||
Endpoint: "127.0.0.1:55678",
|
||||
// Disable: false - This receiver is enabled by default.
|
||||
// DisableBackPressure: false - This receiver will enable back pressure by default.
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ const source string = "OpenCensus"
|
|||
|
||||
// New just creates the OpenCensus receiver services. It is the caller's
|
||||
// responsibility to invoke the respective Start*Reception methods as well
|
||||
// as the various Stop*Reception methods or simply Stop to end it.
|
||||
// as the various Stop*Reception methods to end it.
|
||||
func New(addr string, tc consumer.TraceConsumer, mc consumer.MetricsConsumer, opts ...Option) (*Receiver, error) {
|
||||
// TODO: (@odeke-em) use options to enable address binding changes.
|
||||
ln, err := net.Listen("tcp", addr)
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ import (
|
|||
"github.com/open-telemetry/opentelemetry-service/receiver/receivertest"
|
||||
)
|
||||
|
||||
// TODO(ccaraman): Migrate tests to use assert for validating functionality.
|
||||
func TestGrpcGateway_endToEnd(t *testing.T) {
|
||||
addr := ":35993"
|
||||
|
||||
|
|
@ -55,7 +56,7 @@ func TestGrpcGateway_endToEnd(t *testing.T) {
|
|||
}
|
||||
defer ocr.StopTraceReception()
|
||||
|
||||
// TODO(songy23): make starting server deteminisitc
|
||||
// TODO(songy23): make starting server deterministic
|
||||
// Wait for the servers to start
|
||||
<-time.After(10 * time.Millisecond)
|
||||
|
||||
|
|
@ -166,7 +167,7 @@ func TestTraceGrpcGatewayCors_endToEnd(t *testing.T) {
|
|||
t.Fatalf("Failed to start trace receiver: %v", err)
|
||||
}
|
||||
|
||||
// TODO(songy23): make starting server deteminisitc
|
||||
// TODO(songy23): make starting server deterministic
|
||||
// Wait for the servers to start
|
||||
<-time.After(10 * time.Millisecond)
|
||||
|
||||
|
|
@ -195,7 +196,7 @@ func TestMetricsGrpcGatewayCors_endToEnd(t *testing.T) {
|
|||
t.Fatalf("Failed to start metrics receiver: %v", err)
|
||||
}
|
||||
|
||||
// TODO(songy23): make starting server deteminisitc
|
||||
// TODO(songy23): make starting server deterministic
|
||||
// Wait for the servers to start
|
||||
<-time.After(10 * time.Millisecond)
|
||||
|
||||
|
|
@ -345,7 +346,6 @@ func verifyCorsResp(t *testing.T, url string, origin string, wantStatus int, wan
|
|||
}
|
||||
}
|
||||
|
||||
// Issue #379: Invoking Stop on an unstarted OpenCensus receiver should never crash.
|
||||
func TestStopWithoutStartNeverCrashes(t *testing.T) {
|
||||
ocr, err := New(":55444", nil, nil)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -1,19 +1,56 @@
|
|||
receivers:
|
||||
# The following entry initializes the default OpenCensus receiver.
|
||||
# The default values are specified here
|
||||
# https://github.com/open-telemetry/opentelemetry-service/blob/71589202609d7e787244076b631b45e219101867/receiver/opencensusreceiver/factory.go#L47-L56
|
||||
# The full name of this receiver is `opencensus` and can be referenced in pipelines by 'opencensus'.
|
||||
opencensus:
|
||||
# The following entry demonstrates configuring the common receiver settings:
|
||||
# - endpoint
|
||||
# - disable-backpressure
|
||||
# For more information on the struct, refer to
|
||||
# https://github:com/open-telemetry/opentelemetry-service/blob/71589202609d7e787244076b631b45e219101867/config/configmodels/configmodels.go#L142-L150
|
||||
# This configuration is of type 'opencensus' and has the name 'customname' with a full name of 'opencensus/customname'
|
||||
# ('<type>/<name>'. To reference this configuration in a pipeline, use the full name `opencensus/customname`.
|
||||
opencensus/customname:
|
||||
# The receiver will listen on endpoint: "0.0.0.0:9090".
|
||||
endpoint: 0.0.0.0:9090
|
||||
# This receiver doesn't enable back pressure functionality and will result in no behavior change.
|
||||
disable-backpressure: true
|
||||
# The following entry configures all of the keep alive settings. These settings are used to configure the receiver.
|
||||
opencensus/keepalive:
|
||||
keepalive:
|
||||
server-parameters:
|
||||
max-connection-idle: 11s
|
||||
max-connection-age: 12s
|
||||
max-connection-age-grace: 13s
|
||||
time: 30s
|
||||
timeout: 5s
|
||||
enforcement-policy:
|
||||
min-time: 10s
|
||||
permit-without-stream: true
|
||||
# The following demonstrates how to disable back pressure, set maximum limits on stream, message size and connection
|
||||
# idle time.
|
||||
# Note: The test yaml has demonstrated configuration on a grouped by their structure; however, all of the settings can
|
||||
# be mix and matched like adding the maximum connection idle setting in this example.
|
||||
opencensus/nobackpressure:
|
||||
disable-backpressure: true
|
||||
max-recv-msg-size-mib: 32
|
||||
max-concurrent-streams: 16
|
||||
keepalive:
|
||||
server-parameters:
|
||||
max-connection-idle: 10s
|
||||
# The following entry demonstrates how to specify TLS credentials for the server.
|
||||
# Note: These files do not exist. If the receiver is started with this configuration, it will fail.
|
||||
opencensus/tlscredentials:
|
||||
tls-credentials:
|
||||
cert-file: test.crt
|
||||
key-file: test.key
|
||||
# The following entry demonstrates how to disable a receiver using the disabled flag from the common receiver settings.
|
||||
# Note: The current implementation removes disabled receivers from the global list of receivers so the total count
|
||||
# of receivers in the test will not include this one.
|
||||
opencensus/disabled:
|
||||
# This receiver is disabled and won't receive any data.
|
||||
disabled: true
|
||||
|
||||
processors:
|
||||
exampleprocessor:
|
||||
|
|
@ -23,7 +60,9 @@ exporters:
|
|||
|
||||
pipelines:
|
||||
traces:
|
||||
receivers: [opencensus]
|
||||
processors: [exampleprocessor]
|
||||
exporters: [exampleexporter]
|
||||
|
||||
receivers: [opencensus/customname]
|
||||
processors: [exampleprocessor]
|
||||
exporters: [exampleexporter]
|
||||
metrics:
|
||||
receivers: [opencensus]
|
||||
exporters: [exampleexporter]
|
||||
|
|
|
|||
|
|
@ -140,6 +140,7 @@ func (app *Application) setupHealthCheck() {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO(ccaraman): Move ZPage configuration to be apart of global config/config.go
|
||||
func (app *Application) setupZPages() {
|
||||
app.logger.Info("Setting up zPages...")
|
||||
zpagesPort := app.v.GetInt(zpagesserver.ZPagesHTTPPort)
|
||||
|
|
|
|||
Loading…
Reference in New Issue