grpc_health_check

package module
v0.116.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2024 License: MIT Imports: 15 Imported by: 0

README

otel-grpc-healthcheck

Health Check extension enables a gRPC url that can be probed to check the status of the OpenTelemetry Collector. This extension was created when the OpenTelemetry collector did not support gRPC health check. If there is a better alternative please use it. This extension was created solely to be able to deploy the OpenTelemetry Collector in gateway-mode behind an AWS Application Load Balancer (ALB). The extension depends on the http health check extension.

To use the extension the OpenTelemetry Collector needs to be built using the OpenTelemetry Collector Builder.

The OpenTelemetry Collector Builder Configuration

Example, adjust to your needs:

dist:
  name: otel-collector-custom
  description: Custom collector
  output_path: ./bin
  otelcol_version: 0.112.0

exporters:
  - gomod: go.opentelemetry.io/collector/exporter/debugexporter v0.112.0

extensions:
  - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckextension v0.112.0 # Required
  - gomod: github.com/jammymalina/otel-grpc-healthcheck v0.112.0
    import: github.com/jammymalina/otel-grpc-healthcheck
    name: grpc_health_check

processors:
  - gomod: go.opentelemetry.io/collector/processor/batchprocessor v0.112.0
  - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourceprocessor v0.112.0

receivers:
  - gomod: go.opentelemetry.io/collector/receiver/otlpreceiver v0.112.0

providers:
  - gomod: go.opentelemetry.io/collector/confmap/provider/envprovider v1.18.0
  - gomod: go.opentelemetry.io/collector/confmap/provider/fileprovider v1.18.0
  - gomod: go.opentelemetry.io/collector/confmap/provider/httpprovider v1.18.0
  - gomod: go.opentelemetry.io/collector/confmap/provider/httpsprovider v1.18.0
  - gomod: go.opentelemetry.io/collector/confmap/provider/yamlprovider v1.18.0

The OpenTelemetry Collector Configuration

Example, adjust to your needs:

receivers:
  otlp:
    protocols:
      grpc:
        endpoint: "0.0.0.0:4317"
      http:
        endpoint: "0.0.0.0:4318"

processors:
  resource:
    attributes:
      - key: service.version
        value: ${env:APP_VERSION}
        action: upsert
      - key: deployment.environment
        value: ${env:ENV}
        action: upsert

  batch:
    send_batch_max_size: 1000
    send_batch_size: 100
    timeout: 10s

exporters:
  debug:
    verbosity: detailed
    sampling_initial: 5
    sampling_thereafter: 200

extensions:
  health_check:
    endpoint: "localhost:13133"
  grpc_health_check:
    grpc:
      endpoint: "0.0.0.0:13134"
    health_check_http_endpoint: "localhost:13133"

service:
  extensions: [health_check, grpc_health_check]
  pipelines:
    metrics:
      receivers: [otlp]
      processors: [resource, batch]
      exporters: [debug]
    traces:
      receivers: [otlp]
      processors: [resource, batch]
      exporters: [debug]

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Type               = component.MustNewType("grpc_health_check")
	ExtensionStability = component.StabilityLevelBeta
)

Functions

func NewFactory

func NewFactory() extension.Factory

Types

type Config

type Config struct {
	Grpc                    configgrpc.ServerConfig `mapstructure:"grpc"`
	HealthCheckHttpEndpoint string                  `mapstructure:"health_check_http_endpoint"`
	StartPeriod             time.Duration           `mapstructure:"start_period"`
	Interval                time.Duration           `mapstructure:"interval"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL