test/plugin/constants.rb in fluent-plugin-google-cloud-0.6.15 vs test/plugin/constants.rb in fluent-plugin-google-cloud-0.6.16

- old
+ new

@@ -19,10 +19,12 @@ include Fluent::GoogleCloudOutput::InternalConstants # Generic attributes. HOSTNAME = Socket.gethostname CUSTOM_LOGGING_API_URL = 'http://localhost:52000'.freeze + CUSTOM_METADATA_AGENT_URL = 'http://localhost:12345'.freeze + METADATA_AGENT_URL_FROM_ENV = 'http://localhost:54321'.freeze # TODO(qingling128) Separate constants into different submodules. # Attributes used for the GCE metadata service. PROJECT_ID = 'test-project-id'.freeze ZONE = 'us-central1-b'.freeze @@ -69,10 +71,11 @@ DOCKER_CONTAINER_STREAM_STDERR = 'stderr'.freeze # Timestamp for 1234567890 seconds and 987654321 nanoseconds since epoch. DOCKER_CONTAINER_TIMESTAMP = '2009-02-13T23:31:30.987654321Z'.freeze DOCKER_CONTAINER_SECONDS_EPOCH = 1_234_567_890 DOCKER_CONTAINER_NANOS = 987_654_321 + DOCKER_CONTAINER_LOCAL_RESOURCE_ID_PREFIX = 'container'.freeze # Container Engine / Kubernetes specific labels. CONTAINER_CLUSTER_NAME = 'cluster-1'.freeze CONTAINER_NAMESPACE_ID = '898268c8-4a36-11e5-9d81-42010af0194c'.freeze CONTAINER_NAMESPACE_NAME = 'kube-system'.freeze @@ -85,10 +88,11 @@ CONTAINER_SEVERITY = 'INFO'.freeze # Timestamp for 1234567890 seconds and 987654321 nanoseconds since epoch. CONTAINER_TIMESTAMP = '2009-02-13T23:31:30.987654321Z'.freeze CONTAINER_SECONDS_EPOCH = 1_234_567_890 CONTAINER_NANOS = 987_654_321 + CONTAINER_LOCAL_RESOURCE_ID_PREFIX = 'gke_container'.freeze # Cloud Functions specific labels. CLOUDFUNCTIONS_FUNCTION_NAME = '$My_Function.Name-@1'.freeze CLOUDFUNCTIONS_REGION = 'us-central1'.freeze CLOUDFUNCTIONS_EXECUTION_ID = '123-0'.freeze @@ -144,10 +148,14 @@ CUSTOM_LOGGING_API_URL_CONFIG = %( logging_api_url #{CUSTOM_LOGGING_API_URL} ).freeze + CUSTOM_METADATA_AGENT_URL_CONFIG = %( + metadata_agent_url #{CUSTOM_METADATA_AGENT_URL} + ).freeze + DETECT_JSON_CONFIG = %( detect_json true ).freeze PARTIAL_SUCCESS_DISABLED_CONFIG = %( @@ -603,29 +611,29 @@ # Stub value for Monitored resources from Metadata Agent. # Map from the local_resource_id to the retrieved monitored resource. MONITORED_RESOURCE_STUBS = { # Docker container stderr / stdout logs. - "container.#{DOCKER_CONTAINER_ID}" => + "#{DOCKER_CONTAINER_LOCAL_RESOURCE_ID_PREFIX}.#{DOCKER_CONTAINER_ID}" => { 'type' => DOCKER_CONSTANTS[:resource_type], 'labels' => { 'location' => ZONE, 'container_id' => DOCKER_CONTAINER_ID } }.to_json, # Docker container application logs. - "containerName.#{DOCKER_CONTAINER_NAME}" => + "#{DOCKER_CONTAINER_LOCAL_RESOURCE_ID_PREFIX}.#{DOCKER_CONTAINER_NAME}" => { 'type' => DOCKER_CONSTANTS[:resource_type], 'labels' => { 'location' => ZONE, 'container_id' => DOCKER_CONTAINER_ID } }.to_json, # GKE container logs. - "gke_containerName.#{CONTAINER_NAMESPACE_ID}.#{CONTAINER_POD_NAME}." \ - "#{CONTAINER_CONTAINER_NAME}" => + "#{CONTAINER_LOCAL_RESOURCE_ID_PREFIX}.#{CONTAINER_NAMESPACE_ID}" \ + ".#{CONTAINER_POD_NAME}.#{CONTAINER_CONTAINER_NAME}" => { 'type' => GKE_CONSTANTS[:resource_type], 'labels' => { 'cluster_name' => CONTAINER_CLUSTER_NAME, 'container_name' => CONTAINER_CONTAINER_NAME,