Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Hadoop metrics receiver #351

Merged
merged 33 commits into from
Feb 15, 2022
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
51f8ee3
Add Hadoop metrics
Jan 24, 2022
0f96f25
Add hadoop to supported_apps
Jan 25, 2022
4d869b8
Add sleep after boot
Jan 25, 2022
0e04bd5
Merge branch 'master' into hadoop-metrics
Jan 31, 2022
dcfdbd5
Update fluent-bit to master
Jan 31, 2022
e90ad45
Merge branch 'master' into hadoop-metrics
Feb 1, 2022
16bc144
Remove collection interval from input
Feb 2, 2022
b7a2f45
Merge branch 'master' into hadoop-metrics
Feb 2, 2022
066fa86
Update to use common jvm struct
Feb 2, 2022
cffb1bb
Goldens
Feb 2, 2022
2778540
Remove _metrics suffix
Feb 2, 2022
c30b7ce
Merge branch 'master' into hadoop-metrics
Feb 2, 2022
cf0969b
Fix fluent-bit
Feb 2, 2022
35828db
Merge remote-tracking branch 'origin/master' into hadoop-metrics
Feb 3, 2022
3d165c0
Remove collection interval
Feb 3, 2022
12f8148
Merge remote-tracking branch 'origin/master' into hadoop-metrics
Feb 3, 2022
182f889
Goldens
Feb 3, 2022
eb92dbc
Merge remote-tracking branch 'origin/master' into hadoop-metrics
Feb 4, 2022
a26a87c
Move export statements
Feb 4, 2022
bff491a
Merge remote-tracking branch 'origin/master' into hadoop-metrics
Feb 7, 2022
3083a5d
Add back env file
Feb 7, 2022
fcdcf73
Remove extra export statements
Feb 7, 2022
770a799
Up the amount of time to sleep for
Feb 7, 2022
adb95d8
Update java-contrib
Feb 8, 2022
9e6e12d
Merge remote-tracking branch 'origin/master' into hadoop-metrics
Feb 8, 2022
774a1f9
Update centos port
Feb 8, 2022
3be8c6b
Merge branch 'master' into hadoop-metrics
Feb 8, 2022
6ee4179
Use new shared struct
Feb 8, 2022
8283007
Merge branch 'hadoop-metrics' of https://github.com/observIQ/ops-agen…
Feb 8, 2022
a4f9fc7
Merge branch 'master' into hadoop-metrics
Feb 8, 2022
c864425
Merge branch 'master' into hadoop-metrics
Feb 14, 2022
20c47e8
Merge branch 'master' into hadoop-metrics
Feb 14, 2022
73f9ad1
Add clarification in doc &use common func
Feb 14, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions apps/hadoop.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package apps

import (
"fmt"

"github.com/GoogleCloudPlatform/ops-agent/confgenerator"
"github.com/GoogleCloudPlatform/ops-agent/confgenerator/otel"
)

type MetricsReceiverHadoop struct {
confgenerator.ConfigComponent `yaml:",inline"`
confgenerator.MetricsReceiverShared `yaml:",inline"`
confgenerator.MetricsReceiverSharedJVM `yaml:",inline"`
confgenerator.MetricsReceiverSharedCollectJVM `yaml:",inline"`
}

const defaultHadoopEndpoint = "localhost:8004"

func (r MetricsReceiverHadoop) Type() string {
return "hadoop"
}

func (r MetricsReceiverHadoop) Pipelines() []otel.Pipeline {
targetSystem := "hadoop"
if r.CollectJVMMetrics == nil || *r.CollectJVMMetrics {
qingling128 marked this conversation as resolved.
Show resolved Hide resolved
targetSystem = fmt.Sprintf("%s,%s", targetSystem, "jvm")
}

return r.MetricsReceiverSharedJVM.JVMConfig(
targetSystem,
defaultHadoopEndpoint,
r.CollectionIntervalString(),
[]otel.Component{
otel.NormalizeSums(),
otel.MetricsTransform(
otel.AddPrefix("workload.googleapis.com"),
),
},
)
}

func init() {
confgenerator.MetricsReceiverTypes.RegisterType(func() confgenerator.Component { return &MetricsReceiverHadoop{} })
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[19:17] Key: 'MetricsReceiverSharedJVM.endpoint' Error:Field validation for 'endpoint' failed on the 'hostname_port|startswith=service:jmx:' tag
16 | receivers:
17 | hadoop:
18 | type: hadoop
> 19 | endpoint: localhost
^
20 | collection_interval: 30s
21 | service:
22 | pipelines:
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

metrics:
receivers:
hadoop:
type: hadoop
endpoint: localhost
collection_interval: 30s
service:
pipelines:
hadoop:
receivers:
- hadoop
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[19:17] Key: 'MetricsReceiverSharedJVM.endpoint' Error:Field validation for 'endpoint' failed on the 'hostname_port|startswith=service:jmx:' tag
16 | receivers:
17 | hadoop:
18 | type: hadoop
> 19 | endpoint: http://localhost:80/forbidden.html
^
20 | collection_interval: 30s
21 | service:
22 | pipelines:
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

metrics:
receivers:
hadoop:
type: hadoop
endpoint: http://localhost:80/forbidden.html
collection_interval: 30s
service:
pipelines:
hadoop:
receivers:
- hadoop
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"password" is required when "Username" is set
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

metrics:
receivers:
hadoop:
type: hadoop
username: usr
collection_interval: 30s
service:
pipelines:
hadoop:
receivers:
- hadoop
Original file line number Diff line number Diff line change
@@ -1 +1 @@
metrics receiver with type "iis" is not supported. Supported metrics receiver types: [activemq, apache, cassandra, couchdb, elasticsearch, hostmetrics, jvm, kafka, memcached, mongodb, mysql, nginx, postgresql, redis, solr, tomcat, zookeeper].
metrics receiver with type "iis" is not supported. Supported metrics receiver types: [activemq, apache, cassandra, couchdb, elasticsearch, hadoop, hostmetrics, jvm, kafka, memcached, mongodb, mysql, nginx, postgresql, redis, solr, tomcat, zookeeper].
Original file line number Diff line number Diff line change
@@ -1 +1 @@
metrics receiver with type "mssql" is not supported. Supported metrics receiver types: [activemq, apache, cassandra, couchdb, elasticsearch, hostmetrics, jvm, kafka, memcached, mongodb, mysql, nginx, postgresql, redis, solr, tomcat, zookeeper].
metrics receiver with type "mssql" is not supported. Supported metrics receiver types: [activemq, apache, cassandra, couchdb, elasticsearch, hadoop, hostmetrics, jvm, kafka, memcached, mongodb, mysql, nginx, postgresql, redis, solr, tomcat, zookeeper].
Original file line number Diff line number Diff line change
@@ -1 +1 @@
metrics receiver with type "unsupported_type" is not supported. Supported metrics receiver types: [activemq, apache, cassandra, couchdb, elasticsearch, hostmetrics, jvm, kafka, memcached, mongodb, mysql, nginx, postgresql, redis, solr, tomcat, zookeeper].
metrics receiver with type "unsupported_type" is not supported. Supported metrics receiver types: [activemq, apache, cassandra, couchdb, elasticsearch, hadoop, hostmetrics, jvm, kafka, memcached, mongodb, mysql, nginx, postgresql, redis, solr, tomcat, zookeeper].
Original file line number Diff line number Diff line change
@@ -1 +1 @@
metrics receiver with type "unsupported_type" is not supported. Supported metrics receiver types: [activemq, apache, cassandra, couchdb, elasticsearch, hostmetrics, iis, jvm, kafka, memcached, mongodb, mssql, mysql, nginx, postgresql, redis, solr, tomcat, zookeeper].
metrics receiver with type "unsupported_type" is not supported. Supported metrics receiver types: [activemq, apache, cassandra, couchdb, elasticsearch, hadoop, hostmetrics, iis, jvm, kafka, memcached, mongodb, mssql, mysql, nginx, postgresql, redis, solr, tomcat, zookeeper].
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
@SET buffers_dir=/var/lib/google-cloud-ops-agent/fluent-bit/buffers
@SET logs_dir=/var/log/google-cloud-ops-agent/subagents

[SERVICE]
Daemon off
Flush 1
Log_Level info
dns.resolver legacy
storage.backlog.mem_limit 50M
storage.checksum on
storage.max_chunks_up 128
storage.metrics on
storage.sync normal

[INPUT]
Name fluentbit_metrics
Scrape_Interval 60
Scrape_On_Start True

[INPUT]
Buffer_Chunk_Size 512k
Buffer_Max_Size 5M
DB ${buffers_dir}/default_pipeline_syslog
Key message
Mem_Buf_Limit 10M
Name tail
Path /var/log/messages,/var/log/syslog
Read_from_Head True
Rotate_Wait 30
Skip_Long_Lines On
Tag default_pipeline.syslog
storage.type filesystem

[INPUT]
Buffer_Chunk_Size 512k
Buffer_Max_Size 5M
DB ${buffers_dir}/ops-agent-fluent-bit
Key message
Mem_Buf_Limit 10M
Name tail
Path ${logs_dir}/logging-module.log
Read_from_Head True
Rotate_Wait 30
Skip_Long_Lines On
Tag ops-agent-fluent-bit
storage.type filesystem

[FILTER]
Add logging.googleapis.com/logName syslog
Match default_pipeline.syslog
Name modify

[OUTPUT]
Match_Regex ^(default_pipeline\.syslog)$
Name stackdriver
Retry_Limit 3
net.connect_timeout_log_error False
resource gce_instance
stackdriver_agent Google-Cloud-Ops-Agent-Logging/latest (BuildDistro=build_distro;Platform=linux;ShortName=linux_platform;ShortVersion=linux_platform_version)
tls On
tls.verify Off
workers 8

[OUTPUT]
Match_Regex ^(ops-agent-fluent-bit)$
Name stackdriver
Retry_Limit 3
net.connect_timeout_log_error False
resource gce_instance
stackdriver_agent Google-Cloud-Ops-Agent-Logging/latest (BuildDistro=build_distro;Platform=linux;ShortName=linux_platform;ShortVersion=linux_platform_version)
tls On
tls.verify Off
workers 8

[OUTPUT]
Match *
Name prometheus_exporter
host 0.0.0.0
port 20202
Loading