Module: Common::ServiceConstants

Included in:
Utils, Fluent::GoogleCloudOutput
Defined in:
lib/fluent/plugin/common.rb

Overview

Constants for service names, resource types and etc.

Constant Summary collapse

APPENGINE_CONSTANTS =
{
  service: 'appengine.googleapis.com',
  resource_type: 'gae_app',
  metadata_attributes: %w[gae_backend_name gae_backend_version]
}.freeze
COMPUTE_CONSTANTS =
{
  service: 'compute.googleapis.com',
  resource_type: 'gce_instance'
}.freeze
GKE_CONSTANTS =
{
  service: 'container.googleapis.com',
  resource_type: 'gke_container',
  extra_resource_labels: %w[namespace_id pod_id container_name],
  extra_common_labels: %w[namespace_name pod_name],
  metadata_attributes: %w[cluster-name cluster-location],
  stream_severity_map: {
    'stdout' => 'INFO',
    'stderr' => 'ERROR'
  }
}.freeze
K8S_CONTAINER_CONSTANTS =
{
  resource_type: 'k8s_container'
}.freeze
K8S_POD_CONSTANTS =
{
  resource_type: 'k8s_pod'
}.freeze
K8S_NODE_CONSTANTS =
{
  resource_type: 'k8s_node'
}.freeze
DATAFLOW_CONSTANTS =
{
  service: 'dataflow.googleapis.com',
  resource_type: 'dataflow_step',
  extra_resource_labels: %w[region job_name job_id step_id]
}.freeze
DATAPROC_CONSTANTS =
{
  service: 'cluster.dataproc.googleapis.com',
  resource_type: 'cloud_dataproc_cluster',
  metadata_attributes: %w[dataproc-cluster-uuid dataproc-cluster-name]
}.freeze
EC2_CONSTANTS =
{
  service: 'ec2.amazonaws.com',
  resource_type: 'aws_ec2_instance'
}.freeze
ML_CONSTANTS =
{
  service: 'ml.googleapis.com',
  resource_type: 'ml_job',
  extra_resource_labels: %w[job_id task_name]
}.freeze
SUBSERVICE_MAP =

The map between a subservice name and a resource type.

[APPENGINE_CONSTANTS, GKE_CONSTANTS, DATAFLOW_CONSTANTS,
 DATAPROC_CONSTANTS, ML_CONSTANTS]
.map { |consts| [consts[:service], consts[:resource_type]] }.to_h
SUBSERVICE_METADATA_ATTRIBUTES =

The map between a resource type and expected subservice attributes.

[APPENGINE_CONSTANTS, GKE_CONSTANTS, DATAPROC_CONSTANTS].map do |consts|
  [consts[:resource_type], consts[:metadata_attributes].to_set]
end.to_h.freeze