-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: sreepuramsudheer <[email protected]>
- Loading branch information
1 parent
34d0820
commit 693273a
Showing
21 changed files
with
802 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
.eunit | ||
deps/ | ||
ebin/ | ||
ebin_dialyzer/ | ||
TAGS | ||
.DS_Store | ||
doc/*.html | ||
*.beam | ||
/doc/edoc-info | ||
/doc/erlang.png | ||
/doc/stylesheet.css | ||
/deps.plt | ||
test/*.out | ||
.rebar | ||
log/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
REBAR3_URL=https://s3.amazonaws.com/rebar3/rebar3 | ||
|
||
# If there is a rebar in the current directory, use it | ||
ifeq ($(wildcard rebar3),rebar3) | ||
REBAR3 = $(CURDIR)/rebar3 | ||
endif | ||
|
||
# Fallback to rebar on PATH | ||
REBAR3 ?= $(shell which rebar3) | ||
|
||
# And finally, prep to download rebar if all else fails | ||
ifeq ($(REBAR3),) | ||
REBAR3 = rebar3 | ||
endif | ||
|
||
all: $(REBAR3) | ||
@$(REBAR3) do clean, compile, eunit, dialyzer | ||
|
||
rel: all | ||
@$(REBAR3) release | ||
|
||
distclean: | ||
@rm -rf _build | ||
|
||
$(REBAR3): | ||
curl -Lo rebar3 $(REBAR3_URL) || wget $(REBAR3_URL) | ||
chmod a+x rebar3 | ||
|
||
install: $(REBAR3) distclean | ||
$(REBAR3) update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Telemetry | ||
|
||
Telemetry is an HTTP exporter of Chef Server node stats for external services. |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
%% -*- mode: erlang -*- | ||
%% -*- tab-width: 4;erlang-indent-level: 4;indent-tabs-mode: nil -*- | ||
%% ex: ts=4 sw=4 ft=erlang et | ||
|
||
{deps, | ||
[ | ||
%% lager has to come first since we use its parse transform | ||
{lager, ".*", | ||
{git, "https://github.com/erlang-lager/lager", {branch, "master"}}} | ||
] | ||
}. | ||
|
||
{profiles, [{ | ||
test, [ | ||
{deps, [meck]}, | ||
{erl_opts, [export_all]} | ||
] | ||
}]}. | ||
|
||
{erl_opts, [ | ||
warnings_as_errors, | ||
{parse_transform, lager_transform}, | ||
debug_info | ||
]}. | ||
|
||
{cover_enabled, true}. |
34 changes: 34 additions & 0 deletions
34
src/oc_erchef/apps/chef_telemetry/src/chef_telemetry.app.src
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
%% -*- erlang-indent-level: 4;indent-tabs-mode: nil; fill-column: 92 -*- | ||
%% ex: ts=4 sw=4 et | ||
%% | ||
%% | ||
%% Copyright 2016 Chef Software, Inc. All Rights Reserved. | ||
%% | ||
%% This file is provided to you 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. | ||
%% | ||
|
||
{application, chef_telemetry, [ | ||
{description, "Chef Server Telemetry"}, | ||
{vsn, {cmd,"cat ../../VERSION | awk '{print $0}'"}}, | ||
{registered, []}, | ||
{applications, [ | ||
kernel, | ||
stdlib, | ||
lager, | ||
chef_secrets, | ||
opscoderl_httpc | ||
]}, | ||
{mod, {chef_telemetry_app, []}} | ||
]}. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
%% -*- erlang-indent-level: 4;indent-tabs-mode: nil; fill-column: 92 -*- | ||
%% ex: ts=4 sw=4 et | ||
%% | ||
%% | ||
%% Copyright 2016 Chef Software, Inc. All Rights Reserved. | ||
%% | ||
%% This file is provided to you 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. | ||
%% | ||
|
||
-module(chef_telemetry). | ||
-export([ | ||
is_enabled/0 | ||
]). | ||
|
||
-spec is_enabled() -> boolean(). | ||
is_enabled() -> | ||
case envy:get(chef_telemetry, is_enabled, true, boolean) of | ||
true -> | ||
true; | ||
_ -> | ||
false | ||
end. |
34 changes: 34 additions & 0 deletions
34
src/oc_erchef/apps/chef_telemetry/src/chef_telemetry_app.erl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
%% -*- erlang-indent-level: 4;indent-tabs-mode: nil; fill-column: 92 -*- | ||
%% ex: ts=4 sw=4 et | ||
%% | ||
%% Copyright 2016 Chef Software, Inc. All Rights Reserved. | ||
%% | ||
%% This file is provided to you 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. | ||
%% | ||
|
||
-module(chef_telemetry_app). | ||
|
||
-behaviour(application). | ||
|
||
%% API | ||
-export([start/2, | ||
stop/1 | ||
]). | ||
|
||
start(_StartType, _StartArgs) -> | ||
chef_telemetry_sup:start_link(). | ||
|
||
stop(_State) -> | ||
ok. |
37 changes: 37 additions & 0 deletions
37
src/oc_erchef/apps/chef_telemetry/src/chef_telemetry_sup.erl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
%% -*- erlang-indent-level: 4;indent-tabs-mode: nil; fill-column: 92 -*- | ||
%% ex: ts=4 sw=4 et | ||
%% | ||
%% | ||
%% Copyright 2016 Chef Software, Inc. All Rights Reserved. | ||
%% | ||
%% This file is provided to you 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. | ||
%% | ||
|
||
-module(chef_telemetry_sup). | ||
|
||
-behaviour(supervisor). | ||
|
||
-export([init/1, | ||
start_link/0 | ||
]). | ||
|
||
start_link() -> | ||
supervisor:start_link({local, ?MODULE}, ?MODULE, []). | ||
|
||
init([]) -> | ||
Worker = {chef_telemetry_worker, | ||
{chef_telemetry_worker, start_link, []}, | ||
permanent, 5000, supervisor, [chef_telemetry_worker]}, | ||
{ok, {{one_for_one, 10, 10}, [Worker]}}. |
Oops, something went wrong.