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

Initial configuration files for 3 main applications and exporters build script #6

Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
e212c8f
Initial configuration files for 3 main applications
Nicolas-MacBeth Jul 22, 2020
d963099
Merge branch 'master' of github.com:GoogleCloudPlatform/opentelemetry…
Nicolas-MacBeth Jul 29, 2020
8caa5bd
build script and config updates
Nicolas-MacBeth Jul 30, 2020
ce1defd
commented out prefix
Nicolas-MacBeth Jul 30, 2020
6fa0cbf
updated config
Nicolas-MacBeth Jul 31, 2020
ea6c3a5
updated .gitignore
Nicolas-MacBeth Aug 5, 2020
cc966a1
reverted default file
Nicolas-MacBeth Aug 7, 2020
4806970
make and scripts updates, config file is not final
Nicolas-MacBeth Aug 12, 2020
cebf37f
Merge branch 'master' of github.com:GoogleCloudPlatform/opentelemetry…
Nicolas-MacBeth Aug 12, 2020
256563f
Merge branch 'master' of github.com:GoogleCloudPlatform/opentelemetry…
Nicolas-MacBeth Aug 13, 2020
5a602ff
statsD support
JingboWangGoogle Aug 14, 2020
e510add
Merge branch 'third-party-monitoring' of https://github.com/Nicolas-M…
JingboWangGoogle Aug 14, 2020
8e6f2a1
config now has three 3rd party apps, host metrics and diff pipeplines
Nicolas-MacBeth Aug 14, 2020
4fbba88
Merge branch 'third-party-monitoring' of github.com:Nicolas-MacBeth/o…
Nicolas-MacBeth Aug 14, 2020
e1cc1cf
Added statsd exporter build and config
Nicolas-MacBeth Aug 14, 2020
320be8e
readme docs for thrid party supports
JingboWangGoogle Aug 14, 2020
416e9d8
config and readme updates
Nicolas-MacBeth Aug 14, 2020
9e57e24
updated makefile with default config and updated config
Nicolas-MacBeth Aug 15, 2020
8dfe947
changed imports
Nicolas-MacBeth Aug 15, 2020
e4006b3
updated readme
Nicolas-MacBeth Aug 15, 2020
2339b74
go.mod updates
Nicolas-MacBeth Aug 18, 2020
940e3c2
config update
Nicolas-MacBeth Aug 18, 2020
a3675ef
0.9.0 upgrade
Nicolas-MacBeth Aug 29, 2020
29942cf
Merge branch 'master' of https://github.com/GoogleCloudPlatform/opent…
Nicolas-MacBeth Aug 29, 2020
67639b3
Merge branch 'master' of https://github.com/GoogleCloudPlatform/opent…
Nicolas-MacBeth Sep 7, 2020
8a1c0dc
go.mod update
Nicolas-MacBeth Sep 7, 2020
24098b0
Update README.md
Nicolas-MacBeth Sep 8, 2020
1ba403c
linting
Nicolas-MacBeth Sep 8, 2020
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
51 changes: 51 additions & 0 deletions .build/tar/build_exporters.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash

# The use of >/dev/null is to supress stdout, but allow stderr
# This is because installing the tools and building makes a lot of output
Nicolas-MacBeth marked this conversation as resolved.
Show resolved Hide resolved

echo "Installing tools needed"

# Install git and maven for building the exporters
sudo apt-get update
sudo apt-get install -y git
sudo apt-get install -y maven

mkdir -p dist/prometheus_exporters

echo "Building Prometheus exporters"

# Clone mysqld exporter, build the binary and put it in the folder
echo "Cloning and building the MySQL exporter"

git clone https://github.com/prometheus/mysqld_exporter.git -q
make -C mysqld_exporter >/dev/null
cp mysqld_exporter/mysqld_exporter dist/prometheus_exporters/mysqld_exporter
rm -rf mysqld_exporter

# Clone Apache exporter, build the binary and put it in the folder
echo "Cloning and building the Apache exporter"

git clone https://github.com/Lusitaniae/apache_exporter.git -q
make -C apache_exporter >/dev/null
cp apache_exporter/apache_exporter dist/prometheus_exporters/apache_exporter
rm -rf apache_exporter

# Clone JVM exporter, build the binary and put it in the folder
echo "Cloning and building the JVM exporter"

git clone https://github.com/prometheus/jmx_exporter.git -q
# version is needed to figure out the name of the jar file generated by maven
version=$(sed -n -e 's#.*<version>\(.*-SNAPSHOT\)</version>#\1#p' jmx_exporter/pom.xml)
mvn -f jmx_exporter/pom.xml package >/dev/null
cp jmx_exporter/jmx_prometheus_httpserver/target/jmx_prometheus_httpserver-${version}-jar-with-dependencies.jar dist/prometheus_exporters/jmx_exporter.jar
rm -rf jmx_exporter

# StatsD exporter
echo "Cloning and building the StatsD exporter"

git clone https://github.com/prometheus/statsd_exporter.git -q
make -C statsd_exporter/ >/dev/null
cp statsd_exporter/statsd_exporter dist/prometheus_exporters/statsd_exporter
rm -rf statsd_exporter

echo "Prometheus exporters built"
14 changes: 7 additions & 7 deletions .build/tar/generate_tar.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# limitations under the License.

CONFIG_FILE=${CONFIG_FILE:-config-example.yaml}
EXPORTERS_DIRECTORY=prometheus_exporters
EXPORTERS_CONFIG_DIRECTORY=exporter_configs
FINAL_CONFIG_FILE=config.yaml
README=${README:-tarball-readme.md}

Expand All @@ -27,25 +29,23 @@ then
exit 1
fi

# check dist folder
if [ ! -d "dist" ]
then
echo "Not found: dist folder, creating the folder dist"
mkdir dist
fi
Nicolas-MacBeth marked this conversation as resolved.
Show resolved Hide resolved
mkdir -p dist

# move the needed files into dist folder
echo "Organizing files to be compressed..."
cp config/$CONFIG_FILE dist/
cp bin/$OTELCOL_BINARY dist/
cp -r config/$EXPORTERS_CONFIG_DIRECTORY dist/
cp docs/$README dist/

mv dist/$CONFIG_FILE dist/$FINAL_CONFIG_FILE

# compress the binary and the config into a .tar file
echo "Compressing..."
cd dist && tar -cvzf google-cloudops-opentelemetry-collector.tar.gz $OTELCOL_BINARY $FINAL_CONFIG_FILE $README
cd dist && tar -cvzf google-cloudops-opentelemetry-collector.tar.gz $OTELCOL_BINARY $FINAL_CONFIG_FILE $README $EXPORTERS_DIRECTORY $EXPORTERS_CONFIG_DIRECTORY

# remove the folders and files that were added
echo "Clean up..."
rm $OTELCOL_BINARY $FINAL_CONFIG_FILE $README
rm -rf $EXPORTERS_DIRECTORY
rm -rf $EXPORTERS_CONFIG_DIRECTORY
21 changes: 18 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,31 @@ package-goo:
goopack -output_dir ./dist <(envsubst < ./.build/googet/google-cloudops-opentelemetry-collector.goospec)
chmod -R a+rwx ./dist/

# tarball
# exporters
.PHONY: build-exporters
build-exporters:
bash ./.build/tar/build_exporters.sh

.PHONY: build-tarball
build-tarball: build package-tarball
# tarball
.PHONY: clean-dist
clean-dist:
rm -rf dist/

.PHONY: package-tarball
package-tarball:
bash ./.build/tar/generate_tar.sh
Nicolas-MacBeth marked this conversation as resolved.
Show resolved Hide resolved
chmod -R a+rwx ./dist/

.PHONY: build-tarball
build-tarball: clean-dist test build package-tarball

.PHONY: package-tarball-exporters
package-tarball-exporters:
make package-tarball CONFIG_FILE=config-linux-with-exporters.yaml

.PHONY: build-tarball-exporters
build-tarball-exporters: clean-dist test build build-exporters package-tarball-exporters

# --------------------
# Create build image
# --------------------
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ Common configuration that you may want to change includes:
To generate a tarball archive that includes the OpenTelemetry binary and a configuration file compatible with Google Cloud Monitoring:

1. Run `make build-tarball`.
- To also include JVM, Apache, MySQL and StasD support, run `make build-tarball-exporters` instead
Nicolas-MacBeth marked this conversation as resolved.
Show resolved Hide resolved
2. The tarball file will be generated in the `dist` folder.

### Windows
Expand Down
6 changes: 5 additions & 1 deletion cmd/otelopscol/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import (
"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/stackdriverexporter"
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricstransformprocessor"
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusexecreceiver"

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/component/componenterror"
"go.opentelemetry.io/collector/service/defaultcomponents"
Expand All @@ -41,7 +43,9 @@ func components() (component.Factories, error) {
errs = append(errs, err)
}

receivers := []component.ReceiverFactory{}
receivers := []component.ReceiverFactory{
prometheusexecreceiver.NewFactory(),
}
for _, rcv := range factories.Receivers {
receivers = append(receivers, rcv)
}
Expand Down
Loading