-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
OpenWhisk User Events #4584
OpenWhisk User Events #4584
Changes from all commits
b8be6a3
79472f5
fd045a6
79874c9
2606557
9f76657
b581155
5b53b14
bd5198d
4ed0f20
05bba0a
dc647f0
43ccd3c
196e17e
82d3e8a
3448f7c
cddb3a8
6abf7b3
8d54bdb
9e85892
2387fc9
b8e5786
65a00ef
5adff69
2355539
b8f83e2
d926df7
ba54fbf
65dabf5
355de66
685b3f4
80d2238
7a7ab91
78231f7
529d54d
6402e14
ab6e746
1f6338c
af51a02
b62584a
d7cf007
870e6da
c7b558d
19037a7
156eb9f
0ebf922
394ad49
9b22c7c
44451a3
bbea918
956ed11
3dc4c06
6344437
074d542
7030786
77fa8dc
81b3668
8e4746b
a46c4b8
43a9e12
f859355
5b96f3e
89bff99
f04275a
4965397
a38c668
cc6329d
e8d9234
fa27d59
8081a1f
ff9a141
9876c4c
38b3174
09bd41e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,8 +61,23 @@ protected[core] object ActivationResponse extends DefaultJsonProtocol { | |
val DeveloperError = 2 // action ran but failed to handle an error, or action did not run and failed to initialize | ||
val WhiskError = 3 // internal system error | ||
|
||
val statusSuccess = "success" | ||
val statusApplicationError = "application_error" | ||
val statusDeveloperError = "action_developer_error" | ||
val statusWhiskError = "whisk_internal_error" | ||
|
||
protected[core] def statusForCode(code: Int) = { | ||
require(code >= 0 && code <= 3) | ||
code match { | ||
case Success => statusSuccess | ||
case ApplicationError => statusApplicationError | ||
case DeveloperError => statusDeveloperError | ||
case WhiskError => statusWhiskError | ||
} | ||
} | ||
|
||
protected[core] def messageForCode(code: Int) = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: |
||
require(code >= Success && code <= WhiskError) | ||
require(code >= 0 && code <= 3) | ||
code match { | ||
case Success => "success" | ||
case ApplicationError => "application error" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
* | ||
!transformEnvironment.sh | ||
!init.sh | ||
!build/distributions | ||
!Dockerfile |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file 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. | ||
# | ||
|
||
FROM scala | ||
|
||
ENV UID=1001 \ | ||
NOT_ROOT_USER=owuser | ||
|
||
# Copy app jars | ||
ADD build/distributions/user-events.tar / | ||
|
||
COPY init.sh / | ||
RUN chmod +x init.sh | ||
|
||
RUN adduser -D -u ${UID} -h /home/${NOT_ROOT_USER} -s /bin/bash ${NOT_ROOT_USER} | ||
USER ${NOT_ROOT_USER} | ||
|
||
# Prometheus port | ||
EXPOSE 9095 | ||
CMD ["./init.sh", "0"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<!-- | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file 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. | ||
# | ||
--> | ||
|
||
# ![OpenWhisk User Events](https://raw.githubusercontent.com/apache/openwhisk/master/core/monitoring/user-events/images/demo_landing.png) | ||
|
||
# OpenWhisk User Events | ||
|
||
This service connects to `events` topic and publishes the events to various services like Prometheus, Datadog etc via Kamon. Refer to [user specific metrics][1] on how to enable them. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suggest to extend https://github.com/apache/openwhisk/blob/master/docs/metrics.md#user-specific-metrics to point to the metrics emitter provided by this PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 yes good idea, adding a reference |
||
|
||
|
||
## Local Run | ||
>First configure and run `openwhisk docker-compose` that can be found in the [openwhisk-tools][2] project. | ||
|
||
- Start service inside the cluster (on the same docker-compose network: `openwhisk_default`) | ||
- The service will be available on port `9095` | ||
- The endpoint for exposing the metrics for Prometheus can be found on `/metrics`. | ||
|
||
## Usage | ||
|
||
The service needs the following env variables to be set | ||
|
||
- `KAFKA_HOSTS` - For local env it can be set to `172.17.0.1:9093`. When using [OpenWhisk Devtools][2] based setup use `kafka` | ||
|
||
Integrations | ||
------------ | ||
|
||
#### Prometheus | ||
The docker container would run the service and expose the metrics in format required by [Prometheus][3] at `9095` port | ||
|
||
#### Grafana | ||
The `Openwhisk - Action Performance Metrics` Grafana[4] dashboard is available on localhost port `3000` at this address: | ||
http://localhost:3000/d/Oew1lvymk/openwhisk-action-performance-metrics | ||
|
||
The latest version of the dashboard can be found in the "compose/dashboard/openwhisk_events.json" | ||
|
||
[1]: https://github.com/apache/incubator-openwhisk/blob/master/docs/metrics.md#user-specific-metrics | ||
[2]: https://github.com/apache/incubator-openwhisk-devtools/tree/master/docker-compose | ||
[3]: https://hub.docker.com/r/prom/prometheus/ | ||
[4]: https://hub.docker.com/r/grafana/grafana/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file 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. | ||
*/ | ||
|
||
apply plugin: 'scala' | ||
apply plugin: 'application' | ||
apply plugin: 'org.scoverage' | ||
|
||
ext.dockerImageName = 'user-events' | ||
apply from: "../../../gradle/docker.gradle" | ||
distDocker.dependsOn ':common:scala:distDocker', 'distTar' | ||
|
||
project.archivesBaseName = "openwhisk-user-events" | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
compile "org.scala-lang:scala-library:${gradle.scala.version}" | ||
compile project(':common:scala') | ||
|
||
compile 'com.typesafe.akka:akka-stream-kafka_2.12:0.22' | ||
|
||
compile 'io.prometheus:simpleclient:0.6.0' | ||
compile 'io.prometheus:simpleclient_common:0.6.0' | ||
|
||
testCompile 'junit:junit:4.11' | ||
testCompile 'org.scalatest:scalatest_2.12:3.0.1' | ||
testCompile 'net.manub:scalatest-embedded-kafka_2.12:2.0.0' | ||
testCompile 'com.typesafe.akka:akka-testkit_2.12:2.5.17' | ||
testCompile 'com.typesafe.akka:akka-stream-testkit_2.12:2.5.17' | ||
testCompile 'com.typesafe.akka:akka-http-testkit_2.12:10.1.5' | ||
} | ||
|
||
tasks.withType(ScalaCompile) { | ||
scalaCompileOptions.additionalParameters = gradle.scala.compileFlags | ||
} | ||
|
||
mainClassName = "org.apache.openwhisk.core.monitoring.metrics.Main" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fwiw this would suggest a bug.