├── components ├── global │ ├── portal │ │ ├── io.cellery.observability.ui │ │ │ ├── .eslintignore │ │ │ ├── src │ │ │ │ ├── icons │ │ │ │ │ ├── .eslintrc.json │ │ │ │ │ ├── CellIcon.js │ │ │ │ │ ├── CompositeIcon.js │ │ │ │ │ ├── HttpTrafficIcon.js │ │ │ │ │ ├── PodIcon.js │ │ │ │ │ ├── ComponentIcon.js │ │ │ │ │ ├── OverviewIcon.js │ │ │ │ │ ├── MetricsIcon.js │ │ │ │ │ ├── ShareIcon.js │ │ │ │ │ ├── InstancesIcon.js │ │ │ │ │ └── NodeIcon.js │ │ │ │ ├── components │ │ │ │ │ ├── tracing │ │ │ │ │ │ ├── view │ │ │ │ │ │ │ ├── SequenceDiagram.css │ │ │ │ │ │ │ ├── DependencyDiagram.css │ │ │ │ │ │ │ └── timeline │ │ │ │ │ │ │ │ └── TimelineView.css │ │ │ │ │ │ └── index.js │ │ │ │ │ ├── App.test.js │ │ │ │ │ ├── overview │ │ │ │ │ │ └── index.css │ │ │ │ │ ├── instances │ │ │ │ │ │ └── index.js │ │ │ │ │ └── common │ │ │ │ │ │ ├── DataTable.js │ │ │ │ │ │ ├── HealthIndicator.js │ │ │ │ │ │ ├── error │ │ │ │ │ │ └── ErrorBoundary.js │ │ │ │ │ │ └── color │ │ │ │ │ │ └── index.js │ │ │ │ ├── index.css │ │ │ │ ├── index.js │ │ │ │ └── utils │ │ │ │ │ ├── constants.js │ │ │ │ │ ├── common │ │ │ │ │ └── notificationUtils.js │ │ │ │ │ └── api │ │ │ │ │ └── authUtils.test.js │ │ │ ├── public │ │ │ │ ├── favicon.ico │ │ │ │ ├── manifest.json │ │ │ │ └── index.html │ │ │ ├── node-server │ │ │ │ ├── package.json │ │ │ │ ├── config │ │ │ │ │ └── portal.json │ │ │ │ └── serve.js │ │ │ ├── assembly.xml │ │ │ └── package.json │ │ └── pom.xml │ ├── core │ │ ├── io.cellery.observability.model.generator │ │ │ ├── src │ │ │ │ ├── test │ │ │ │ │ ├── java │ │ │ │ │ │ └── io │ │ │ │ │ │ │ └── cellery │ │ │ │ │ │ │ └── observability │ │ │ │ │ │ │ └── model │ │ │ │ │ │ │ └── generator │ │ │ │ │ │ │ ├── datasource │ │ │ │ │ │ │ └── CustomContextFactory.java │ │ │ │ │ │ │ └── model │ │ │ │ │ │ │ ├── EdgeNodeTestCase.java │ │ │ │ │ │ │ └── NodeTestCase.java │ │ │ │ │ └── resources │ │ │ │ │ │ ├── log4j.properties │ │ │ │ │ │ └── testng.xml │ │ │ │ └── main │ │ │ │ │ └── java │ │ │ │ │ └── io │ │ │ │ │ └── cellery │ │ │ │ │ └── observability │ │ │ │ │ └── model │ │ │ │ │ └── generator │ │ │ │ │ ├── exception │ │ │ │ │ ├── ModelException.java │ │ │ │ │ └── GraphStoreException.java │ │ │ │ │ ├── model │ │ │ │ │ ├── Node.java │ │ │ │ │ ├── Edge.java │ │ │ │ │ ├── EdgeNode.java │ │ │ │ │ └── Model.java │ │ │ │ │ └── internal │ │ │ │ │ ├── ServiceHolder.java │ │ │ │ │ └── ModelServiceComponent.java │ │ │ └── spotbugs-exclude.xml │ │ ├── io.cellery.observability.api │ │ │ └── src │ │ │ │ ├── test │ │ │ │ ├── resources │ │ │ │ │ ├── log4j.properties │ │ │ │ │ └── testng.xml │ │ │ │ └── java │ │ │ │ │ └── io │ │ │ │ │ └── cellery │ │ │ │ │ └── observability │ │ │ │ │ └── api │ │ │ │ │ ├── datasource │ │ │ │ │ └── CustomContextFactory.java │ │ │ │ │ ├── UtilsTestCase.java │ │ │ │ │ ├── exception │ │ │ │ │ ├── APIInvocationExceptionTestCase.java │ │ │ │ │ └── InvalidParamExceptionTestCase.java │ │ │ │ │ └── siddhi │ │ │ │ │ └── SiddhiStoreQueryManagerTestCase.java │ │ │ │ └── main │ │ │ │ └── java │ │ │ │ └── io │ │ │ │ └── cellery │ │ │ │ └── observability │ │ │ │ └── api │ │ │ │ ├── exception │ │ │ │ ├── UnexpectedException.java │ │ │ │ ├── APIInvocationException.java │ │ │ │ ├── InvalidParamException.java │ │ │ │ └── BaseExceptionMapper.java │ │ │ │ ├── Constants.java │ │ │ │ ├── UserAPI.java │ │ │ │ ├── interceptor │ │ │ │ └── CORSInterceptor.java │ │ │ │ └── AuthAPI.java │ │ ├── io.cellery.observability.auth │ │ │ └── src │ │ │ │ ├── test │ │ │ │ └── resources │ │ │ │ │ ├── log4j.properties │ │ │ │ │ └── testng.xml │ │ │ │ └── main │ │ │ │ └── java │ │ │ │ └── io │ │ │ │ └── cellery │ │ │ │ └── observability │ │ │ │ └── auth │ │ │ │ ├── exception │ │ │ │ └── AuthProviderException.java │ │ │ │ ├── Constants.java │ │ │ │ ├── Permission.java │ │ │ │ ├── internal │ │ │ │ └── ServiceHolder.java │ │ │ │ └── AuthProvider.java │ │ ├── io.cellery.observability.tracing.synapse.handler │ │ │ └── src │ │ │ │ ├── test │ │ │ │ └── resources │ │ │ │ │ ├── log4j.properties │ │ │ │ │ └── testng.xml │ │ │ │ └── main │ │ │ │ └── java │ │ │ │ └── io │ │ │ │ └── cellery │ │ │ │ └── observability │ │ │ │ └── tracing │ │ │ │ └── synapse │ │ │ │ └── handler │ │ │ │ └── Constants.java │ │ ├── io.cellery.observability.siddhi.apps │ │ │ ├── assembly.xml │ │ │ ├── pom.xml │ │ │ └── src │ │ │ │ └── main │ │ │ │ └── siddhi │ │ │ │ └── istio-telemetry-app.siddhi │ │ ├── io.cellery.observability.agent.receiver │ │ │ └── src │ │ │ │ └── main │ │ │ │ └── java │ │ │ │ └── io │ │ │ │ └── cellery │ │ │ │ └── observability │ │ │ │ └── agent │ │ │ │ └── receiver │ │ │ │ └── internal │ │ │ │ ├── ServiceHolder.java │ │ │ │ └── RuntimeAgentServiceComponent.java │ │ ├── pom.xml │ │ └── io.cellery.observability.telemetry.deduplicator │ │ │ ├── src │ │ │ └── main │ │ │ │ └── java │ │ │ │ └── io │ │ │ │ └── cellery │ │ │ │ └── observability │ │ │ │ └── telemetry │ │ │ │ └── deduplicator │ │ │ │ └── internal │ │ │ │ └── Constants.java │ │ │ └── pom.xml │ ├── observability-agent │ │ ├── pkg │ │ │ ├── signals │ │ │ │ ├── signal_windows.go │ │ │ │ ├── signal_posix.go │ │ │ │ └── signal.go │ │ │ ├── store │ │ │ │ ├── store.go │ │ │ │ └── memory │ │ │ │ │ └── memory.go │ │ │ ├── adapter │ │ │ │ └── testdata │ │ │ │ │ ├── ca.pem │ │ │ │ │ ├── adapter.crt │ │ │ │ │ └── adapter.key │ │ │ ├── logging │ │ │ │ └── logging.go │ │ │ ├── kubeagent │ │ │ │ ├── filters.go │ │ │ │ ├── attributes.go │ │ │ │ ├── events.go │ │ │ │ └── kubeagent.go │ │ │ ├── config │ │ │ │ ├── config.go │ │ │ │ └── config_test.go │ │ │ └── writer │ │ │ │ └── writer.go │ │ └── test │ │ │ └── e2e │ │ │ └── testdata │ │ │ └── sample-operator-cfg.yaml │ └── pom.xml └── pom.xml ├── .codecov.yml ├── docs └── images │ └── cellery-observability-archictecure.jpg ├── .travis.yml ├── .gitignore ├── issue_template.md ├── .github └── workflows │ └── push.yaml ├── docker ├── tracing-agent │ └── Dockerfile ├── telemetry-agent │ └── Dockerfile ├── kube-agent │ └── Dockerfile ├── portal │ ├── Dockerfile │ └── pom.xml ├── sp │ └── Dockerfile └── pom.xml ├── go.mod └── pull_request_template.md /components/global/portal/io.cellery.observability.ui/.eslintignore: -------------------------------------------------------------------------------- 1 | src/serviceWorker.js -------------------------------------------------------------------------------- /components/global/portal/io.cellery.observability.ui/src/icons/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "max-len": "off" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /.codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | range: 80..95 3 | round: down 4 | precision: 2 5 | status: 6 | project: yes 7 | patch: yes 8 | changes: yes 9 | -------------------------------------------------------------------------------- /docs/images/cellery-observability-archictecure.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wso2/cellery-observability/HEAD/docs/images/cellery-observability-archictecure.jpg -------------------------------------------------------------------------------- /components/global/portal/io.cellery.observability.ui/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wso2/cellery-observability/HEAD/components/global/portal/io.cellery.observability.ui/public/favicon.ico -------------------------------------------------------------------------------- /components/global/portal/io.cellery.observability.ui/node-server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "io.cellery.observability.ui.server", 3 | "version": "1.0.0", 4 | "description": "Cellery Observability Portal - Server", 5 | "main": "serve.js", 6 | "author": "WSO2 Org", 7 | "license": "Apache-2.0", 8 | "dependencies": { 9 | "express": "^4.16.4", 10 | "express-history-api-fallback": "^2.2.1" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /components/global/portal/io.cellery.observability.ui/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "Cellery Observability", 3 | "name": "Cellery Observability Portal", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | } 10 | ], 11 | "start_url": ".", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # TODO: Uncomment condition once github actions are enabled 2 | #if: type = pull_request 3 | dist: trusty 4 | language: go 5 | jdk: 6 | - openjdk8 7 | go: 8 | - 1.12.x 9 | services: 10 | - docker 11 | cache: 12 | directories: 13 | - $HOME/.m2 14 | env: 15 | - GO111MODULE=on 16 | before_install: 17 | - npm i -g npm 18 | script: 19 | - make clean.observability-agent check-style.observability-agent build.observability-agent test.observability-agent 20 | - travis_wait 30 mvn clean install 21 | - make docker 22 | after_success: 23 | - bash <(curl -s https://codecov.io/bash) 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | 4 | # Log file 5 | *.log 6 | 7 | # BlueJ files 8 | *.ctxt 9 | 10 | # Mobile Tools for Java (J2ME) 11 | .mtj.tmp/ 12 | 13 | # Package Files # 14 | *.jar 15 | *.war 16 | *.nar 17 | *.ear 18 | *.zip 19 | *.tar.gz 20 | *.rar 21 | 22 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 23 | hs_err_pid* 24 | 25 | # Idea files 26 | .idea/ 27 | *.iml 28 | *.iws 29 | *.ipr 30 | 31 | # Maven 32 | **/target/* 33 | 34 | # GO 35 | vendor/ 36 | 37 | # NPM 38 | **/node_modules/* 39 | **/dist/* 40 | **/build/* 41 | **/coverage/* 42 | 43 | # OS 44 | .DS_Store 45 | 46 | # Go vendor 47 | /vendor 48 | -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.model.generator/src/test/java/io/cellery/observability/model/generator/datasource/CustomContextFactory.java: -------------------------------------------------------------------------------- 1 | package io.cellery.observability.model.generator.datasource; 2 | 3 | import java.util.Hashtable; 4 | import javax.naming.Context; 5 | import javax.naming.NamingException; 6 | import javax.naming.spi.InitialContextFactory; 7 | 8 | /** 9 | * Custom context factory for unit tests. 10 | */ 11 | public class CustomContextFactory implements InitialContextFactory { 12 | @Override 13 | public Context getInitialContext(Hashtable environment) throws NamingException { 14 | return new CustomContext(environment); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /issue_template.md: -------------------------------------------------------------------------------- 1 | **Description:** 2 | 3 | 4 | **Suggested Labels:** 5 | 6 | 7 | **Suggested Assignees:** 8 | 9 | 10 | **Affected Product Version:** 11 | 12 | **OS, DB, other environment details and versions:** 13 | 14 | **Steps to reproduce:** 15 | 16 | 17 | **Related Issues:** 18 | -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.model.generator/spotbugs-exclude.xml: -------------------------------------------------------------------------------- 1 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /components/global/observability-agent/pkg/signals/signal_windows.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 WSO2 Inc. (http:www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http:www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package signals 20 | 21 | import ( 22 | "os" 23 | ) 24 | 25 | var shutdownSignals = []os.Signal{os.Interrupt} 26 | -------------------------------------------------------------------------------- /components/global/observability-agent/pkg/signals/signal_posix.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | /* 4 | * Copyright (c) 2018 WSO2 Inc. (http:www.wso2.org) All Rights Reserved. 5 | * 6 | * WSO2 Inc. licenses this file to you under the Apache License, 7 | * Version 2.0 (the "License"); you may not use this file except 8 | * in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http:www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package signals 22 | 23 | import ( 24 | "os" 25 | "syscall" 26 | ) 27 | 28 | var shutdownSignals = []os.Signal{os.Interrupt, syscall.SIGTERM} 29 | -------------------------------------------------------------------------------- /.github/workflows/push.yaml: -------------------------------------------------------------------------------- 1 | name: Push 2 | on: [push] 3 | jobs: 4 | build: 5 | runs-on: ubuntu-18.04 6 | steps: 7 | - name: Cloning repository 8 | uses: actions/checkout@v1 9 | - name: Setup JDK 10 | uses: actions/setup-java@v1 11 | with: 12 | java-version: 1.8 13 | - name: Setup Go 14 | uses: actions/setup-go@v1 15 | with: 16 | go-version: 1.12.7 17 | - name: Build Java Modules 18 | run: mvn clean install 19 | - name: Build Mixer Adapter 20 | run: make clean.mixer-adapter check-style.mixer-adapter build.mixer-adapter test.mixer-adapter 21 | env: 22 | GO111MODULE: on 23 | - name: Check Code Coverage 24 | uses: codecov/codecov-action@v1.0.2 25 | with: 26 | token: ${{ secrets.CODECOV_TOKEN }} 27 | - name: Build Docker Images 28 | run: make docker 29 | - name: Push Docker Images 30 | run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} && make docker-push 31 | -------------------------------------------------------------------------------- /components/global/observability-agent/pkg/store/store.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package store 20 | 21 | type ( 22 | Persister interface { 23 | Fetch() (string, Transaction, error) 24 | Write(str string) error 25 | } 26 | Transaction interface { 27 | Commit() error 28 | Rollback() error 29 | } 30 | ) 31 | -------------------------------------------------------------------------------- /components/global/portal/io.cellery.observability.ui/src/components/tracing/view/SequenceDiagram.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | /** 20 | * Overrides for the react-d3-graph library 21 | */ 22 | 23 | .messageText { 24 | font-size: 13px; 25 | } 26 | 27 | text.actor { 28 | font-size: 15px; 29 | cursor: default; 30 | } 31 | 32 | -------------------------------------------------------------------------------- /components/global/portal/io.cellery.observability.ui/src/components/tracing/view/DependencyDiagram.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | /** 20 | * Overrides for the react-d3-graph library 21 | */ 22 | 23 | #trace-dependency-graph-graph-wrapper > svg { 24 | position: relative; 25 | width: 100% !important; 26 | height: 65vh !important; 27 | } 28 | -------------------------------------------------------------------------------- /components/global/observability-agent/test/e2e/testdata/sample-operator-cfg.yaml: -------------------------------------------------------------------------------- 1 | # handler for adapter wso2spadapter 2 | apiVersion: "config.istio.io/v1alpha2" 3 | kind: handler 4 | metadata: 5 | name: wso2spadapter-handler 6 | namespace: istio-system 7 | spec: 8 | adapter: wso2spadapter 9 | connection: 10 | address: "[::]:38355" 11 | params: 12 | file_path: "out.txt" 13 | --- 14 | 15 | # instance for template metric 16 | apiVersion: "config.istio.io/v1alpha2" 17 | kind: instance 18 | metadata: 19 | name: wso2spadapter-metric 20 | namespace: istio-system 21 | spec: 22 | template: metric 23 | params: 24 | value: request.size | 0 25 | dimensions: 26 | response_code: response.code | 0 27 | --- 28 | 29 | # rule to dispatch to handler wso2spadapter-handler 30 | apiVersion: "config.istio.io/v1alpha2" 31 | kind: rule 32 | metadata: 33 | name: wso2spadapter-rule 34 | namespace: istio-system 35 | spec: 36 | actions: 37 | - handler: wso2spadapter-handler.istio-system 38 | instances: 39 | - wso2spadapter-metric 40 | --- 41 | -------------------------------------------------------------------------------- /components/global/portal/io.cellery.observability.ui/node-server/config/portal.json: -------------------------------------------------------------------------------- 1 | { 2 | "observabilityAPIURL": "http://cellery-dashboard/api", 3 | "idp": { 4 | "idpURL": "https://idp.cellery-system", 5 | "callBackURL": "http://cellery-dashboard", 6 | "idTokenAttributes": { 7 | "username": ["name", "sub"], 8 | "avatarUrl": ["avatar_url", "google_pic_url"], 9 | "email": ["email"] 10 | } 11 | }, 12 | "filter": { 13 | "defaultRuntimeId": "cellery-default", 14 | "defaultNamespace": "default" 15 | }, 16 | "percentageRangeMinValue": { 17 | "errorThreshold": 0.5, 18 | "warningThreshold": 0.7 19 | }, 20 | "templates": { 21 | "kubernetesMetricsLinks": { 22 | "pod": "http://cellery-k8s-metrics/d/cellery-k8s-pod-metrics-dashboard/pod-metrics?var-pod=${pod}&from=${fromTime}&to=${toTime}", 23 | "node": "http://cellery-k8s-metrics/d/cellery-k8s-node-metrics-dashboard/node-metrics?var-node=${node}&from=${fromTime}&to=${toTime}" 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /docker/tracing-agent/Dockerfile: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------ 2 | # 3 | # Copyright 2019 WSO2, Inc. (http://wso2.com) 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License 16 | # 17 | # ------------------------------------------------------------------------ 18 | 19 | FROM alpine:latest as certs 20 | RUN apk --update add ca-certificates 21 | 22 | FROM scratch 23 | COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt 24 | COPY ./target/tracing-agent /tracing-agent 25 | ENTRYPOINT ["/tracing-agent"] 26 | -------------------------------------------------------------------------------- /docker/telemetry-agent/Dockerfile: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------ 2 | # 3 | # Copyright 2019 WSO2, Inc. (http://wso2.com) 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License 16 | # 17 | # ------------------------------------------------------------------------ 18 | 19 | FROM alpine:latest as certs 20 | RUN apk --update add ca-certificates 21 | 22 | FROM scratch 23 | COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt 24 | COPY ./target/telemetry-agent /telemetry-agent 25 | ENTRYPOINT ["/telemetry-agent"] 26 | -------------------------------------------------------------------------------- /docker/kube-agent/Dockerfile: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------ 2 | # 3 | # Copyright 2019 WSO2, Inc. (http://wso2.com) 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License 16 | # 17 | # ------------------------------------------------------------------------ 18 | 19 | FROM alpine:latest as certs 20 | RUN apk --update add ca-certificates 21 | 22 | FROM scratch 23 | COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt 24 | COPY ./target/kube-agent /kube-agent 25 | ENTRYPOINT ["/kube-agent"] 26 | -------------------------------------------------------------------------------- /components/global/portal/io.cellery.observability.ui/src/icons/CellIcon.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import React from "react"; 18 | import SvgIcon from "@material-ui/core/SvgIcon"; 19 | 20 | const CellIcon = (props) => ( 21 | 22 | 23 | 24 | ); 25 | 26 | export default CellIcon; 27 | -------------------------------------------------------------------------------- /components/global/portal/io.cellery.observability.ui/src/icons/CompositeIcon.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import React from "react"; 18 | import SvgIcon from "@material-ui/core/SvgIcon"; 19 | 20 | const CompositeIcon = (props) => ( 21 | 22 | 23 | 24 | ); 25 | 26 | export default CompositeIcon; 27 | -------------------------------------------------------------------------------- /components/global/portal/io.cellery.observability.ui/src/components/App.test.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | import App from "./App"; 20 | import React from "react"; 21 | import ReactDOM from "react-dom"; 22 | 23 | describe("App", () => { 24 | it("should render without crashing", () => { 25 | const div = document.createElement("div"); 26 | ReactDOM.render(, div); 27 | ReactDOM.unmountComponentAtNode(div); 28 | }); 29 | }); 30 | -------------------------------------------------------------------------------- /docker/portal/Dockerfile: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------ 2 | # 3 | # Copyright 2018 WSO2, Inc. (http://wso2.com) 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License 16 | # 17 | # ------------------------------------------------------------------------ 18 | 19 | FROM node:11.2.0-slim 20 | MAINTAINER WSO2 Cellery Maintainers "dev@wso2.org" 21 | 22 | ARG PORTAL_PORT=3000 23 | ARG APP_DIR=/portal 24 | 25 | WORKDIR ${APP_DIR} 26 | 27 | COPY ./target/files ${APP_DIR}/ 28 | 29 | ENV PORTAL_PORT=${PORTAL_PORT} 30 | 31 | EXPOSE ${PORTAL_PORT} 32 | 33 | RUN npm install 34 | 35 | ENTRYPOINT ["node", "serve.js"] 36 | -------------------------------------------------------------------------------- /components/global/observability-agent/pkg/adapter/testdata/ca.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIC9DCCAdygAwIBAgIJAKaXEYpfvWCiMA0GCSqGSIb3DQEBCwUAMA4xDDAKBgNV 3 | BAMMA19jYTAgFw0xOTAyMTkwNjAzMjhaGA8yMjkyMTIwNDA2MDMyOFowDjEMMAoG 4 | A1UEAwwDX2NhMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqZLs4D6z 5 | FV9MhPBt6OrkxKq1QCRo/uYk5WpLnHOkqADJ4ovctG6N9Uj9FaP60owVozcGz3pG 6 | KJgDM8xfDrOE/lARS/QBxbk8eYP4Ypgj2+MIKctpkeZ1902pcnZY+j3LbO1CBhaD 7 | pDTAJbK3EUX+XeZ5Nap1WTmCaQlMIC/zliUAtvh1GZWHYmSBuTIE3f3/jBDsKUC5 8 | ZSFyHaJHmTiRUAnjnF9z+QGncWUQueA0TTiE+dS0elwX7scRGEoO/RLKgC6okWho 9 | b7zMuGXoe0fu8eK7ojXha0fVON2DbzsHMIIO7fC2gCwSBZpCHPgTI1D2NtsTIsz6 10 | hKiELgQO5gIllwIDAQABo1MwUTAdBgNVHQ4EFgQUhe3KYzuC+Gy2QKGn2OPlNswm 11 | caUwHwYDVR0jBBgwFoAUhe3KYzuC+Gy2QKGn2OPlNswmcaUwDwYDVR0TAQH/BAUw 12 | AwEB/zANBgkqhkiG9w0BAQsFAAOCAQEAmaS2hy2ka2/QVBNvBHvJrkZcnyYeaPm/ 13 | 6bPOqW/4mB3bnXa0/3IrxeRO+8lPlYQiBvtnDpg72yTKyD9M0yi+n7XMtzITNprr 14 | 9MYkd9GJkgcnJIfpTaNQ7XYf0d2dbmVrJ3gJTJzNTVmfXnI7cSbX14f1l3FBLfdA 15 | agj5SqAKdb8ATz3g2lCWluCPyxAi+lHQF1F2BKvGmkPqpGKAjbiH9czLllPPadKT 16 | NP3HZwOY4Acax6obzTC2ysUEbkn2s+7VKw5ptSSTH4+GPMv+bL3rhZtgcGXA5QhH 17 | QgqQTHJqCCTjmjnXoML4TTM9SjHUTVVIyDhBUa22XSGaKPtCL89GNA== 18 | -----END CERTIFICATE----- -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.api/src/test/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | # 4 | # WSO2 Inc. licenses this file to you under the Apache License, 5 | # Version 2.0 (the "License"); you may not use this file except 6 | # in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | # 18 | 19 | log4j.rootLogger = DEBUG, console 20 | log4j.appender.console=org.apache.log4j.ConsoleAppender 21 | log4j.appender.console.target=System.out 22 | log4j.appender.console.immediateFlush=true 23 | log4j.appender.console.encoding=UTF-8 24 | log4j.appender.console.threshold=debug 25 | log4j.appender.console.layout=org.apache.log4j.PatternLayout 26 | log4j.appender.console.layout.conversionPattern=%d [%t] %-5p %c - %m%n 27 | -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.auth/src/test/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | # 4 | # WSO2 Inc. licenses this file to you under the Apache License, 5 | # Version 2.0 (the "License"); you may not use this file except 6 | # in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | # 18 | 19 | log4j.rootLogger = DEBUG, console 20 | log4j.appender.console=org.apache.log4j.ConsoleAppender 21 | log4j.appender.console.target=System.out 22 | log4j.appender.console.immediateFlush=true 23 | log4j.appender.console.encoding=UTF-8 24 | log4j.appender.console.threshold=debug 25 | log4j.appender.console.layout=org.apache.log4j.PatternLayout 26 | log4j.appender.console.layout.conversionPattern=%d [%t] %-5p %c - %m%n 27 | -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.tracing.synapse.handler/src/test/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | # 4 | # WSO2 Inc. licenses this file to you under the Apache License, 5 | # Version 2.0 (the "License"); you may not use this file except 6 | # in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | # 18 | 19 | log4j.rootLogger = DEBUG, console 20 | log4j.appender.console=org.apache.log4j.ConsoleAppender 21 | log4j.appender.console.target=System.out 22 | log4j.appender.console.immediateFlush=true 23 | log4j.appender.console.encoding=UTF-8 24 | log4j.appender.console.threshold=debug 25 | log4j.appender.console.layout=org.apache.log4j.PatternLayout 26 | log4j.appender.console.layout.conversionPattern=%d [%t] %-5p %c - %m%n 27 | -------------------------------------------------------------------------------- /components/global/observability-agent/pkg/logging/logging.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package logging 20 | 21 | import ( 22 | "go.uber.org/zap" 23 | "go.uber.org/zap/zapcore" 24 | ) 25 | 26 | func NewLogger() (*zap.SugaredLogger, error) { 27 | config := zap.NewDevelopmentConfig() 28 | config.EncoderConfig.EncodeLevel = zapcore.CapitalColorLevelEncoder 29 | config.OutputPaths = []string{"stdout"} 30 | config.DisableStacktrace = true 31 | logger, err := config.Build() 32 | if err != nil { 33 | return nil, err 34 | } 35 | return logger.Sugar(), nil 36 | } 37 | -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.tracing.synapse.handler/src/test/resources/testng.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.auth/src/main/java/io/cellery/observability/auth/exception/AuthProviderException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package io.cellery.observability.auth.exception; 20 | 21 | /** 22 | * Exception indicating errors in Authentication/Authorization Providers. 23 | */ 24 | public class AuthProviderException extends Exception { 25 | 26 | public AuthProviderException(String message, Throwable e) { 27 | super(message, e); 28 | } 29 | 30 | public AuthProviderException(String message) { 31 | super(message); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.model.generator/src/test/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | # 4 | # WSO2 Inc. licenses this file to you under the Apache License, 5 | # Version 2.0 (the "License"); you may not use this file except 6 | # in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | # 18 | 19 | log4j.rootLogger = DEBUG, console 20 | log4j.appender.console=org.apache.log4j.ConsoleAppender 21 | log4j.appender.console.target=System.out 22 | log4j.appender.console.immediateFlush=true 23 | log4j.appender.console.encoding=UTF-8 24 | log4j.appender.console.threshold=debug 25 | log4j.appender.console.layout=org.apache.log4j.PatternLayout 26 | log4j.appender.console.layout.conversionPattern=%d [%t] %-5p %c - %m%n 27 | log4j.logger.io.cellery.observability.tracing.receiver=DEBUG, console 28 | -------------------------------------------------------------------------------- /components/global/observability-agent/pkg/adapter/testdata/adapter.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDMjCCAhqgAwIBAgIJANvCgxeTPh8mMA0GCSqGSIb3DQEBCwUAMA4xDDAKBgNV 3 | BAMMA19jYTAgFw0xOTAyMTkwNjAzMjhaGA8yMjkyMTIwNDA2MDMyOFowEjEQMA4G 4 | A1UEAwwHX3NlcnZlcjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANcp 5 | Xs69Pe2qaD8ADucCU3idk2WRkKyuraK3CNFxHfl+3ESyAiR1YpVxt5gsX7t+Yf/P 6 | fZRfbzKI2g40Z68PflmKR51Id/ujLGjUMolsfoqbL3k1vty5JhX0yf3BTHYapfDs 7 | BwI8mwyXjPwCnnm6jFIDfPWFV3/6nePFxI9NISvMMHtcSo/9OqhNJflRGxIyeAdQ 8 | hc3GKtezhGR50uHPQYeUWKlt4sARaxxZAbhRyLQYWv3t/Y/GVnWRfurMqXnQ3ysh 9 | aqZN4CYuSi7S9DT5qbBqzuu0ws9HkW3K/su+Zhn8b/Ujty7r8q7OVLAEH3uhUTM/ 10 | MEQ+cAhaVwtePdv4BlMCAwEAAaOBjDCBiTAJBgNVHRMEAjAAMAsGA1UdDwQEAwIF 11 | 4DAdBgNVHSUEFjAUBggrBgEFBQcDAgYIKwYBBQUHAwEwUAYDVR0RBEkwR4ZFc3Bp 12 | ZmZlOi8vY2x1c3Rlci5sb2NhbC9ucy9pc3Rpby1zeXN0ZW0vc2EvaXN0aW8tbWl4 13 | ZXItc2VydmljZS1hY2NvdW50MA0GCSqGSIb3DQEBCwUAA4IBAQByYRaah4bpIB7Y 14 | k5n7bf5f3uSx7HC1JDH3RvXCQMDbyJv2CPIBGzm5VLBo2XUrFmsvOgRRnK/GwOTA 15 | aR7VBLgY9AizRuYNhLys69MJCrc2ZrjGcuFoncScEf6ajTD9p0v4O0bpxYafFoDy 16 | 4ysQwwbXZSmAGW61Fgk/OcbHtBf123rQwbZ4v4NXeLUNHUM93JuBjQDce9odPN6p 17 | NNlCE+c6zlxawPu05awAVgkm1lRYag9RNW9/DC7fr51kBLhV7oGPQZ2KUnXhEZyk 18 | CGNy0qnj8PNkzgHswJLod7xbP4jc8iosXQFjf6o0+ET4bPg1FCh7IG1r7EpbBM6U 19 | R6t3J2uZ 20 | -----END CERTIFICATE----- 21 | -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.model.generator/src/main/java/io/cellery/observability/model/generator/exception/ModelException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | package io.cellery.observability.model.generator.exception; 19 | 20 | /** 21 | * The represents the exception that thrown when there is any unexpected behaviour in the model generation. 22 | */ 23 | public class ModelException extends Exception { 24 | 25 | public ModelException(String message, Exception ex) { 26 | super(message, ex); 27 | } 28 | 29 | public ModelException(String message) { 30 | super(message); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.model.generator/src/main/java/io/cellery/observability/model/generator/exception/GraphStoreException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | package io.cellery.observability.model.generator.exception; 19 | 20 | /** 21 | * This exception represents the exception that occurred when communicating with the graph persistence. 22 | */ 23 | public class GraphStoreException extends Exception { 24 | 25 | public GraphStoreException(String message) { 26 | super(message); 27 | } 28 | 29 | public GraphStoreException(String message, Exception ex) { 30 | super(message, ex); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /components/global/observability-agent/pkg/kubeagent/filters.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package kubeagent 20 | 21 | import ( 22 | "cellery.io/cellery-controller/pkg/meta" 23 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 24 | ) 25 | 26 | func FilterWithInstanceLabel() func(obj interface{}) bool { 27 | return FilterWithLabelKey(meta.ObservabilityInstanceLabelKey) 28 | } 29 | 30 | func FilterWithLabelKey(key string) func(obj interface{}) bool { 31 | return func(obj interface{}) bool { 32 | if object, ok := obj.(metav1.Object); ok { 33 | _, ok := object.GetLabels()[key] 34 | return ok 35 | } 36 | return false 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /components/global/portal/io.cellery.observability.ui/src/icons/HttpTrafficIcon.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import React from "react"; 18 | import SvgIcon from "@material-ui/core/SvgIcon"; 19 | 20 | const HttpTrafficIcon = (props) => ( 21 | 22 | 25 | 26 | ); 27 | 28 | export default HttpTrafficIcon; 29 | -------------------------------------------------------------------------------- /components/global/portal/io.cellery.observability.ui/src/icons/PodIcon.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import React from "react"; 18 | import SvgIcon from "@material-ui/core/SvgIcon"; 19 | 20 | const PodIcon = (props) => ( 21 | 22 | 26 | 27 | ); 28 | 29 | export default PodIcon; 30 | -------------------------------------------------------------------------------- /components/global/portal/io.cellery.observability.ui/src/icons/ComponentIcon.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import React from "react"; 18 | import SvgIcon from "@material-ui/core/SvgIcon"; 19 | 20 | const ComponentIcon = (props) => ( 21 | 22 | 25 | 26 | ); 27 | 28 | export default ComponentIcon; 29 | -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.api/src/test/java/io/cellery/observability/api/datasource/CustomContextFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package io.cellery.observability.api.datasource; 20 | 21 | import java.util.Hashtable; 22 | import javax.naming.Context; 23 | import javax.naming.NamingException; 24 | import javax.naming.spi.InitialContextFactory; 25 | 26 | /** 27 | * Custom context factory for unit tests. 28 | */ 29 | public class CustomContextFactory implements InitialContextFactory { 30 | @Override 31 | public Context getInitialContext(Hashtable environment) throws NamingException { 32 | return new CustomContext(environment); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.model.generator/src/main/java/io/cellery/observability/model/generator/model/Node.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | package io.cellery.observability.model.generator.model; 19 | 20 | /** 21 | * Represents a Node in the Dependency Model. 22 | */ 23 | public class Node extends EdgeNode { 24 | private String instanceKind; 25 | 26 | public Node(String namespace, String instance, String component) { 27 | super(namespace, instance, component); 28 | } 29 | 30 | public void setInstanceKind(String instanceKind) { 31 | this.instanceKind = instanceKind; 32 | } 33 | 34 | public String getInstanceKind() { 35 | return instanceKind; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /components/global/portal/io.cellery.observability.ui/src/icons/OverviewIcon.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import React from "react"; 18 | import SvgIcon from "@material-ui/core/SvgIcon"; 19 | 20 | const OverviewIcon = (props) => ( 21 | 22 | 26 | 27 | ); 28 | 29 | export default OverviewIcon; 30 | 31 | -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.auth/src/test/resources/testng.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /components/global/portal/io.cellery.observability.ui/src/components/overview/index.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | /** 20 | * Overrides for the mui datables styles for right side bar list table 21 | */ 22 | 23 | .overviewSidebarListTable { 24 | width: 100%; 25 | } 26 | 27 | .overviewSidebarListTable > div { 28 | box-shadow: none; 29 | } 30 | 31 | .overviewSidebarListTable thead tr, .overviewSidebarListTable [role=toolbar] { 32 | display: none; 33 | } 34 | 35 | .overviewSidebarListTable tfoot td:last-child { 36 | padding-right: 0; 37 | } 38 | 39 | .overviewSidebarListTable td { 40 | padding: 0 41 | } 42 | 43 | #graph-id-graph-wrapper > svg { 44 | position: relative; 45 | width: 100% !important; 46 | height: 70vh !important; 47 | } 48 | -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.siddhi.apps/assembly.xml: -------------------------------------------------------------------------------- 1 | 18 | 19 | 22 | 23 | observability-siddhi-apps-assembly 24 | / 25 | 26 | 27 | zip 28 | 29 | 30 | 31 | 32 | ${project.basedir}/src/main/siddhi 33 | ./ 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /components/global/observability-agent/pkg/signals/signal.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 WSO2 Inc. (http:www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http:www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package signals 20 | 21 | import ( 22 | "os" 23 | "os/signal" 24 | ) 25 | 26 | var onlyOneSignalHandler = make(chan struct{}) 27 | 28 | // SetupSignalHandler registered for SIGTERM and SIGINT. A stop channel is returned 29 | // which is closed on one of these signals. If a second signal is caught, the program 30 | // is terminated with exit code 1. 31 | func SetupSignalHandler() (stopCh <-chan struct{}) { 32 | close(onlyOneSignalHandler) // panics when called twice 33 | 34 | stop := make(chan struct{}) 35 | c := make(chan os.Signal, 2) 36 | signal.Notify(c, shutdownSignals...) 37 | go func() { 38 | <-c 39 | close(stop) 40 | <-c 41 | os.Exit(1) // second signal. Exit directly. 42 | }() 43 | 44 | return stop 45 | } 46 | -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.agent.receiver/src/main/java/io/cellery/observability/agent/receiver/internal/ServiceHolder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package io.cellery.observability.agent.receiver.internal; 20 | 21 | import io.cellery.observability.auth.AuthProvider; 22 | 23 | /** 24 | * This is a static class which holds the references of the OSGI services registered. 25 | */ 26 | public class ServiceHolder { 27 | private static AuthProvider authProvider; 28 | 29 | public static AuthProvider getAuthProvider() { 30 | return authProvider; 31 | } 32 | 33 | public static void setAuthProvider(AuthProvider authProvider) { 34 | ServiceHolder.authProvider = authProvider; 35 | } 36 | 37 | private ServiceHolder() { // Prevent initialization 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /docker/sp/Dockerfile: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------ 2 | # 3 | # Copyright 2018 WSO2, Inc. (http://wso2.com) 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License 16 | # 17 | # ------------------------------------------------------------------------ 18 | 19 | FROM wso2cellery/sp-worker-base:4.3.0 20 | MAINTAINER WSO2 Cellery Maintainers "dev@wso2.org" 21 | 22 | ARG CELLERY_TARGET_FILES=./target/files 23 | 24 | # Remove connectors with bugs (The connectors with fixes are copied with the "libs" directory) 25 | RUN rm ${WSO2_SERVER_HOME}/lib/siddhi-io-http-1.0.39.jar 26 | RUN rm ${WSO2_SERVER_HOME}/lib/siddhi-store-rdbms-4.0.35.jar 27 | 28 | # Copy the osgified jars 29 | COPY --chown=wso2carbon:wso2 ${CELLERY_TARGET_FILES}/lib/*.jar ${WSO2_SERVER_HOME}/lib/ 30 | 31 | # Remove unused Siddhi App (Added in default pack) 32 | RUN rm ${WSO2_SERVER_HOME}/wso2/worker/deployment/siddhi-files/TestSiddhiApp.siddhi 33 | 34 | # Expose ports 35 | EXPOSE 9090 9443 9712 9612 7711 7611 9091 9411 9092 9123 36 | -------------------------------------------------------------------------------- /components/global/portal/io.cellery.observability.ui/src/icons/MetricsIcon.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import React from "react"; 18 | import SvgIcon from "@material-ui/core/SvgIcon"; 19 | 20 | const MetricsIcon = (props) => ( 21 | 22 | 27 | 28 | ); 29 | 30 | export default MetricsIcon; 31 | -------------------------------------------------------------------------------- /docker/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 22 | io.cellery.observability 23 | io.cellery.observability.parent 24 | 0.6.2-SNAPSHOT 25 | ../pom.xml 26 | 27 | 28 | 4.0.0 29 | io.cellery.observability.docker 30 | Cellery Observability Docker 31 | pom 32 | 33 | 34 | sp 35 | portal 36 | 37 | 38 | -------------------------------------------------------------------------------- /components/global/observability-agent/pkg/kubeagent/attributes.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package kubeagent 20 | 21 | type Attribute string 22 | 23 | const ( 24 | AttributeName Attribute = "name" 25 | AttributeNamespace Attribute = "namespace" 26 | AttributeResourceKind Attribute = "resourceKind" 27 | AttributeInstance Attribute = "instance" 28 | AttributeInstanceKind Attribute = "instanceKind" 29 | AttributeAction Attribute = "action" 30 | AttributeComponent Attribute = "component" 31 | AttributeCreationTimestamp Attribute = "creationTimestamp" 32 | AttributeIngressTypes Attribute = "ingressTypes" 33 | AttributeDeletionTimestamp Attribute = "deletionTimestamp" 34 | AttributeCurrentTimestamp Attribute = "currentTimestamp" 35 | AttributeNodeName Attribute = "nodeName" 36 | ) 37 | 38 | type Attributes map[Attribute]interface{} 39 | -------------------------------------------------------------------------------- /components/global/portal/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 22 | io.cellery.observability 23 | io.cellery.observability.global 24 | 0.6.2-SNAPSHOT 25 | 26 | 27 | 4.0.0 28 | io.cellery.observability.portal 29 | 0.6.2-SNAPSHOT 30 | Cellery Observability Components - Global Plane - Portal 31 | pom 32 | 33 | 34 | io.cellery.observability.ui 35 | 36 | 37 | -------------------------------------------------------------------------------- /components/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 22 | io.cellery.observability 23 | io.cellery.observability.parent 24 | 0.6.2-SNAPSHOT 25 | ../pom.xml 26 | 27 | 28 | 4.0.0 29 | io.cellery.observability.components 30 | 0.6.2-SNAPSHOT 31 | Cellery Observability Components 32 | pom 33 | 34 | 35 | global 36 | 37 | 38 | -------------------------------------------------------------------------------- /components/global/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 22 | io.cellery.observability 23 | io.cellery.observability.components 24 | 0.6.2-SNAPSHOT 25 | 26 | 27 | 4.0.0 28 | io.cellery.observability.global 29 | 0.6.2-SNAPSHOT 30 | Cellery Observability Components - Global Plane 31 | pom 32 | 33 | 34 | core 35 | portal 36 | 37 | 38 | -------------------------------------------------------------------------------- /components/global/portal/io.cellery.observability.ui/assembly.xml: -------------------------------------------------------------------------------- 1 | 18 | 19 | 22 | 23 | observability-portal-assembly 24 | / 25 | 26 | 27 | zip 28 | 29 | 30 | 31 | 32 | ${project.basedir}/build/ 33 | ./public 34 | 35 | 36 | ${project.basedir}/node-server/ 37 | . 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.api/src/main/java/io/cellery/observability/api/exception/UnexpectedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package io.cellery.observability.api.exception; 20 | 21 | import javax.ws.rs.core.Response; 22 | 23 | /** 24 | * Exception thrown when an unexpected error occurs. 25 | */ 26 | public class UnexpectedException extends RuntimeException { 27 | 28 | public UnexpectedException(String message) { 29 | super(message); 30 | } 31 | 32 | /** 33 | * Exception mapper for UnexpectedException. 34 | */ 35 | public static class Mapper extends BaseExceptionMapper { 36 | 37 | public Mapper() { 38 | super(Response.Status.INTERNAL_SERVER_ERROR); 39 | } 40 | 41 | @Override 42 | public Response toResponse(UnexpectedException exception) { 43 | return generateResponse(exception); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.api/src/main/java/io/cellery/observability/api/exception/APIInvocationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package io.cellery.observability.api.exception; 20 | 21 | import javax.ws.rs.core.Response; 22 | 23 | /** 24 | * Internal generic error in the API. 25 | */ 26 | public class APIInvocationException extends Exception { 27 | 28 | public APIInvocationException(String message, Throwable e) { 29 | super(message, e); 30 | } 31 | 32 | /** 33 | * Exception mapper for APIInvocationException. 34 | */ 35 | public static class Mapper extends BaseExceptionMapper { 36 | 37 | public Mapper() { 38 | super(Response.Status.INTERNAL_SERVER_ERROR); 39 | } 40 | 41 | @Override 42 | public Response toResponse(APIInvocationException exception) { 43 | return generateResponse(exception); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /components/global/portal/io.cellery.observability.ui/src/components/tracing/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, 11 | * software distributed under the License is distributed on an 12 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 13 | * KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations 15 | * under the License. 16 | */ 17 | 18 | import NotFound from "../common/error/NotFound"; 19 | import React from "react"; 20 | import Search from "./search"; 21 | import View from "./view"; 22 | import {Redirect, Route, Switch, withRouter} from "react-router-dom"; 23 | import * as PropTypes from "prop-types"; 24 | 25 | const Tracing = ({match, location}) => ( 26 | 27 | 28 | 29 | 30 | }/> 31 | 32 | ); 33 | 34 | Tracing.propTypes = { 35 | match: PropTypes.object.isRequired, 36 | location: PropTypes.shape({ 37 | state: PropTypes.object 38 | }).isRequired 39 | }; 40 | 41 | export default withRouter(Tracing); 42 | -------------------------------------------------------------------------------- /components/global/portal/io.cellery.observability.ui/src/index.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | body { 20 | margin: 0; 21 | padding: 0; 22 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", 23 | "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", 24 | sans-serif; 25 | -webkit-font-smoothing: antialiased; 26 | -moz-osx-font-smoothing: grayscale; 27 | } 28 | 29 | html, body, #root { 30 | height: 100%; 31 | } 32 | 33 | code { 34 | font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", 35 | monospace; 36 | } 37 | 38 | /* Top toolbar calendar */ 39 | 40 | .rdtPicker th { 41 | font-weight: 500; 42 | } 43 | 44 | .rdtPicker td.rdtActive { 45 | background-color: #69b26d !important; 46 | } 47 | 48 | .rdtPicker { 49 | border: 1px solid #eee !important; 50 | } 51 | 52 | .rdtTimeToggle, .rdtTime .rdtSwitch { 53 | background-color: #eee; 54 | } 55 | 56 | .rdtDays { 57 | font-size: 14px; 58 | } 59 | 60 | /* anchor */ 61 | 62 | a { 63 | color: #333 64 | } 65 | -------------------------------------------------------------------------------- /components/global/observability-agent/pkg/adapter/testdata/adapter.key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEowIBAAKCAQEA1ylezr097apoPwAO5wJTeJ2TZZGQrK6torcI0XEd+X7cRLIC 3 | JHVilXG3mCxfu35h/899lF9vMojaDjRnrw9+WYpHnUh3+6MsaNQyiWx+ipsveTW+ 4 | 3LkmFfTJ/cFMdhql8OwHAjybDJeM/AKeebqMUgN89YVXf/qd48XEj00hK8wwe1xK 5 | j/06qE0l+VEbEjJ4B1CFzcYq17OEZHnS4c9Bh5RYqW3iwBFrHFkBuFHItBha/e39 6 | j8ZWdZF+6sypedDfKyFqpk3gJi5KLtL0NPmpsGrO67TCz0eRbcr+y75mGfxv9SO3 7 | Luvyrs5UsAQfe6FRMz8wRD5wCFpXC1492/gGUwIDAQABAoIBAHL8WP6DhCUPfMau 8 | cUhjpdg/3hXZxUeD0qeyybOkkDBV68GKoDp7wUO8kjFxBXheAmGDsckpd3O6T05o 9 | E0ErNosDq2IS6IxCl+kt/hQTN007whM09dtf10rEl25Vb1duxmAKw3Qej34bP+0u 10 | OSM03ui1lIJh0HFErjyb5H/w6FlOupdNdax/kjBIljuL8D2B33tpC3liUVyGd6tc 11 | gWDTf4owUixFhk8hiiDVz1J/8eQCqUOMvdggilAVZKfm3T9sm272i6/kKsK/nsBL 12 | sSR1P6Z4LSqVtMHzjjgz90bQJT98qgvjiNAD/hjwRoHKS8hsmejt8QSPcziESy31 13 | ATvIsAECgYEA/4rAksjyzf3nSQMhtAfrIjhWL/T1qna80OOaCDrrE74Vc/VqCTcP 14 | vJzVFAp2c9YvS8faJ2aggBBvxmMcb0LsAU3I/Ch9YBJD6JUYTBlEUnq3ZvO4xmaL 15 | u2SEFvvnH+bMXfeRsu/QnhSxe9gZZGv8tDJ4WMTmxs5haE9fS0/WF4ECgYEA14wX 16 | PMq+pso+/Red1SLwduy8xSn+JlZDn1/7Lm2q/QlZuvo+p+pAEHvGAMxEyW96VEhH 17 | DL1zPU4YVI8WwOSbde4N+X78KUBlokYI4nbholJps7smcWsg/sPpHeFUNDFNeLnC 18 | DEo9fkIP/J1R5ZxFSIagDyWFzHyT+qWKWxfuJ9MCgYB+VIr1RfB7E42Wk7zCsrN0 19 | fGNnW/NjLUYVAp/wd6glX3BdnjKokZbvCJ1yReXfSECjdw6LMfogtX98lRzGiFAC 20 | KQE2X5Hzv7PgtGyJmmgjWlV2yQBM3P8xSfTfI/NT2xanUa+uxU3eCJ7heai784K/ 21 | VsAWKmloWTjgh3S116cggQKBgQChUN8zSClXepWZpUsicHu3BYZhqQPkfTsu1A6Q 22 | uNL3fUACh7bMxKwdqgSOJFJ2z0+mNFG4XzEX+JKM9mn5Ax62K+uZhkgCN4fY4sFT 23 | e9VyPmuNb8tdpueSw9x72F/EkAGDEMMBn65WB+sfDD52sXXIybiQnWx9ld7J/4qE 24 | kmxSsQKBgHHrURzhWtoJiAfRie3ZlttcWz33gv2rbUzrku7y7ihlpN5m5qT8G8BM 25 | uIv8ceGeJVls2iIM/uwZi9xCyK/ly5TbrvaQz8iZ7Ewom0aG3xhZjXHtr6kwFM7s 26 | Jycii4m6LCTgwLdxpQvBBDhuEYaxGeDz82YOkuepDws5Yn0/6Vss 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /components/global/portal/io.cellery.observability.ui/src/icons/ShareIcon.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import React from "react"; 18 | import SvgIcon from "@material-ui/core/SvgIcon"; 19 | 20 | const ShareIcon = (props) => ( 21 | 22 | 29 | 30 | ); 31 | 32 | export default ShareIcon; 33 | -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.auth/src/main/java/io/cellery/observability/auth/Constants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package io.cellery.observability.auth; 20 | 21 | /** 22 | * Constants related to Cellery Auth. 23 | */ 24 | public class Constants { 25 | public static final String OIDC_CLIENT_ID_KEY = "client_id"; 26 | public static final String OIDC_CLIENT_SECRET_KEY = "client_secret"; 27 | public static final String OIDC_AUTHORIZATION_CODE_KEY = "authorization_code"; 28 | public static final String OIDC_CALLBACK_URL_KEY = "redirect_uris"; 29 | public static final String OIDC_CLIENT_NAME_KEY = "client_name"; 30 | public static final String OIDC_GRANT_TYPES_KEY = "grant_types"; 31 | public static final String OIDC_EXT_PARAM_CLIENT_ID_KEY = "ext_param_client_id"; 32 | 33 | public static final String HEADER_AUTHORIZATION = "Authorization"; 34 | public static final String HEADER_CONTENT_TYPE = "Content-Type"; 35 | public static final String CONTENT_TYPE_APPLICATION_JSON = "application/json"; 36 | 37 | private Constants() { // Prevent initialization 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /components/global/portal/io.cellery.observability.ui/src/components/instances/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | import Component from "./component"; 20 | import Instance from "./instance"; 21 | import InstanceList from "./InstanceList"; 22 | import NotFound from "../common/error/NotFound"; 23 | import React from "react"; 24 | import {Route, Switch, withRouter} from "react-router-dom"; 25 | import * as PropTypes from "prop-types"; 26 | 27 | const Instances = ({match}) => ( 28 | 29 | 30 | 31 | 32 | }/> 33 | 34 | ); 35 | 36 | Instances.propTypes = { 37 | match: PropTypes.object.isRequired, 38 | location: PropTypes.shape({ 39 | state: PropTypes.object 40 | }).isRequired 41 | }; 42 | 43 | export default withRouter(Instances); 44 | -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.api/src/test/resources/testng.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module cellery.io/cellery-observability 2 | 3 | go 1.12 4 | 5 | replace ( 6 | cellery.io/cellery-controller => cellery.io/cellery-controller v0.5.1-0.20191210065848-9219c69059bb 7 | github.com/apache/thrift => github.com/apache/thrift v0.0.0-20151001171628-53dd39833a08 8 | github.com/jaegertracing/jaeger => github.com/jaegertracing/jaeger v1.14.0 9 | istio.io/api => istio.io/api v0.0.0-20190517041403-820986f2947c 10 | istio.io/istio => istio.io/istio v0.0.0-20190627161235-cd4a148f37dc 11 | k8s.io/api => k8s.io/api v0.0.0-20190805141119-fdd30b57c827 12 | k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20190612205821-1799e75a0719 13 | k8s.io/client-go => k8s.io/client-go v0.0.0-20190620085101-78d2af792bab 14 | k8s.io/klog => k8s.io/klog v0.3.3 15 | ) 16 | 17 | require ( 18 | cellery.io/cellery-controller v0.5.1-0.20191210065848-9219c69059bb 19 | github.com/DATA-DOG/go-sqlmock v1.3.3 20 | github.com/apache/thrift v0.13.0 // indirect 21 | github.com/go-openapi/runtime v0.19.8 // indirect 22 | github.com/go-openapi/spec v0.19.4 // indirect 23 | github.com/go-openapi/validate v0.19.5 // indirect 24 | github.com/go-sql-driver/mysql v1.4.1 25 | github.com/gofrs/flock v0.7.1 26 | github.com/gogo/protobuf v1.2.1 27 | github.com/google/go-cmp v0.3.0 28 | github.com/gorilla/handlers v1.4.2 29 | github.com/gorilla/mux v1.7.3 30 | github.com/grpc-ecosystem/grpc-gateway v1.12.1 // indirect 31 | github.com/jaegertracing/jaeger v0.0.0-00010101000000-000000000000 32 | github.com/rs/cors v1.7.0 // indirect 33 | github.com/rs/xid v1.2.1 34 | github.com/uber/tchannel-go v1.16.0 // indirect 35 | go.uber.org/zap v1.13.0 36 | google.golang.org/grpc v1.25.1 37 | istio.io/api v0.0.0-20190517041403-820986f2947c 38 | istio.io/istio v0.0.0-00010101000000-000000000000 39 | k8s.io/api v0.0.0-20190805141119-fdd30b57c827 40 | k8s.io/apimachinery v0.0.0-20190612205821-1799e75a0719 41 | k8s.io/client-go v12.0.0+incompatible 42 | k8s.io/klog v0.3.3 43 | ) 44 | -------------------------------------------------------------------------------- /components/global/core/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 22 | io.cellery.observability 23 | io.cellery.observability.global 24 | 0.6.2-SNAPSHOT 25 | 26 | 27 | 4.0.0 28 | io.cellery.observability.core 29 | 0.6.2-SNAPSHOT 30 | Cellery Observability Components - Global Plane - Core 31 | pom 32 | 33 | 34 | io.cellery.observability.tracing.synapse.handler 35 | io.cellery.observability.agent.receiver 36 | io.cellery.observability.model.generator 37 | io.cellery.observability.api 38 | io.cellery.observability.auth 39 | io.cellery.observability.siddhi.apps 40 | io.cellery.observability.telemetry.deduplicator 41 | 42 | 43 | -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.auth/src/main/java/io/cellery/observability/auth/Permission.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package io.cellery.observability.auth; 20 | 21 | import java.util.List; 22 | 23 | /** 24 | * Represents a permission granted to perform a list of {@link Action} on any resource 25 | * in a namespace belonging to a runtime. 26 | */ 27 | public class Permission { 28 | private String runtime; 29 | private String namespace; 30 | private List actions; 31 | 32 | public Permission(String runtime, String namespace, List actions) { 33 | this.runtime = runtime; 34 | this.namespace = namespace; 35 | this.actions = actions; 36 | } 37 | 38 | public String getRuntime() { 39 | return runtime; 40 | } 41 | 42 | public String getNamespace() { 43 | return namespace; 44 | } 45 | 46 | public List getActions() { 47 | return actions; 48 | } 49 | 50 | /** 51 | * Action a user can perform on any resource from a particular namespace belonging to a runtime. 52 | */ 53 | public enum Action { 54 | // Represents a user making a HTTP GET (Reading data) to the API 55 | API_GET, 56 | 57 | // Represents a user publishing data 58 | DATA_PUBLISH 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /components/global/portal/io.cellery.observability.ui/src/icons/InstancesIcon.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import React from "react"; 18 | import SvgIcon from "@material-ui/core/SvgIcon"; 19 | 20 | const InstancesIcon = (props) => ( 21 | 22 | 23 | 30 | 31 | 32 | 33 | ); 34 | 35 | export default InstancesIcon; 36 | -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.model.generator/src/test/resources/testng.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.model.generator/src/main/java/io/cellery/observability/model/generator/model/Edge.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | package io.cellery.observability.model.generator.model; 19 | 20 | import java.util.Objects; 21 | 22 | /** 23 | * Represents an edge in the dependency model. 24 | */ 25 | public class Edge { 26 | private EdgeNode source; 27 | private EdgeNode target; 28 | 29 | public Edge(EdgeNode source, EdgeNode target) { 30 | this.source = source; 31 | this.target = target; 32 | } 33 | 34 | public EdgeNode getSource() { 35 | return source; 36 | } 37 | 38 | public EdgeNode getTarget() { 39 | return target; 40 | } 41 | 42 | public boolean equals(Object anotherObject) { 43 | boolean equals; 44 | if (anotherObject instanceof Edge) { 45 | Edge anotherEdge = (Edge) anotherObject; 46 | equals = Objects.equals(this.source, anotherEdge.getSource()) 47 | && Objects.equals(this.target, anotherEdge.getTarget()); 48 | } else { 49 | equals = false; 50 | } 51 | return equals; 52 | } 53 | 54 | public int hashCode() { 55 | return Objects.hash(this.source, this.target); 56 | } 57 | 58 | public String toString() { 59 | return this.source + " --> " + this.target; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.api/src/main/java/io/cellery/observability/api/exception/InvalidParamException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package io.cellery.observability.api.exception; 20 | 21 | import javax.ws.rs.core.Response; 22 | 23 | /** 24 | * Exception thrown when invalid parameters (Query Params, Path Params, etc. are provided) 25 | */ 26 | public class InvalidParamException extends RuntimeException { 27 | public InvalidParamException(String parameter, String expected, Object received, Exception e) { 28 | super("Invalid parameter " + parameter + " provided. Expected " + expected 29 | + ", received " + received.toString(), e); 30 | } 31 | 32 | public InvalidParamException(String parameter, String expected, Object received) { 33 | super("Invalid parameter " + parameter + " provided. Expected " + expected 34 | + ", received " + received.toString()); 35 | } 36 | 37 | /** 38 | * Exception mapper for InvalidParamException. 39 | */ 40 | public static class Mapper extends BaseExceptionMapper { 41 | 42 | public Mapper() { 43 | super(Response.Status.PRECONDITION_FAILED); 44 | } 45 | 46 | @Override 47 | public Response toResponse(InvalidParamException exception) { 48 | return generateResponse(exception); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /components/global/portal/io.cellery.observability.ui/src/components/common/DataTable.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | import MUIDataTable from "mui-datatables"; 20 | import React from "react"; 21 | import {withStyles} from "@material-ui/core/styles"; 22 | import * as PropTypes from "prop-types"; 23 | 24 | const styles = (theme) => ({ 25 | table: { 26 | minWidth: 1020 27 | }, 28 | tableWrapper: { 29 | overflowX: "auto", 30 | marginLeft: theme.spacing.unit * 3, 31 | marginRight: theme.spacing.unit * 3 32 | } 33 | }); 34 | 35 | const DataTable = (props) => { 36 | const {classes, options, columns, data} = props; 37 | const defaultOptions = { 38 | download: false, 39 | selectableRows: false, 40 | print: false, 41 | filterType: "dropdown", 42 | responsive: "scroll" 43 | }; 44 | 45 | return ( 46 |
47 | 48 |
49 | ); 50 | }; 51 | 52 | DataTable.propTypes = { 53 | data: PropTypes.arrayOf(PropTypes.arrayOf(PropTypes.any)).isRequired, 54 | options: PropTypes.object.isRequired, 55 | columns: PropTypes.arrayOf(PropTypes.any).isRequired, 56 | classes: PropTypes.object.isRequired 57 | }; 58 | 59 | export default withStyles(styles)(DataTable); 60 | 61 | 62 | -------------------------------------------------------------------------------- /components/global/portal/io.cellery.observability.ui/src/components/common/HealthIndicator.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import CheckCircleOutline from "@material-ui/icons/CheckCircleOutline"; 18 | import ErrorOutline from "@material-ui/icons/ErrorOutline"; 19 | import {HelpOutline} from "@material-ui/icons"; 20 | import React from "react"; 21 | import StateHolder from "./state/stateHolder"; 22 | import withGlobalState from "./state"; 23 | import withColor, {ColorGenerator} from "./color"; 24 | import * as PropTypes from "prop-types"; 25 | 26 | const HealthIndicator = ({colorGenerator, globalState, value}) => { 27 | const color = colorGenerator.getColorForPercentage(value, globalState); 28 | let Icon; 29 | if (value < 0 || value > 1) { 30 | Icon = HelpOutline; 31 | } else if (value < globalState.get(StateHolder.CONFIG).percentageRangeMinValue.errorThreshold) { 32 | Icon = ErrorOutline; 33 | } else if (value < globalState.get(StateHolder.CONFIG).percentageRangeMinValue.warningThreshold) { 34 | Icon = ErrorOutline; 35 | } else { 36 | Icon = CheckCircleOutline; 37 | } 38 | return ; 39 | }; 40 | 41 | HealthIndicator.propTypes = { 42 | colorGenerator: PropTypes.instanceOf(ColorGenerator).isRequired, 43 | globalState: PropTypes.instanceOf(StateHolder).isRequired, 44 | value: PropTypes.number.isRequired 45 | }; 46 | 47 | export default withGlobalState(withColor(HealthIndicator)); 48 | -------------------------------------------------------------------------------- /components/global/observability-agent/pkg/store/memory/memory.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package memory 20 | 21 | import ( 22 | "go.uber.org/zap" 23 | 24 | "cellery.io/cellery-observability/components/global/observability-agent/pkg/store" 25 | ) 26 | 27 | type ( 28 | Persister struct { 29 | logger *zap.SugaredLogger 30 | buffer chan string 31 | } 32 | Transaction struct { 33 | Element string 34 | Buffer chan string 35 | } 36 | Memory struct { 37 | } 38 | ) 39 | 40 | func (transaction *Transaction) Commit() error { 41 | return nil 42 | } 43 | 44 | func (transaction *Transaction) Rollback() error { 45 | if transaction.Buffer != nil { 46 | transaction.Buffer <- transaction.Element 47 | } 48 | return nil 49 | } 50 | 51 | func (persister *Persister) Fetch() (string, store.Transaction, error) { 52 | if len(persister.buffer) > 0 { 53 | str := <-persister.buffer 54 | transaction := &Transaction{Element: str} 55 | return str, transaction, nil 56 | } else { 57 | return "", &Transaction{}, nil 58 | } 59 | } 60 | 61 | func (persister *Persister) Write(str string) error { 62 | persister.buffer <- str 63 | return nil 64 | } 65 | 66 | func NewPersister(maxMetricsCount int, bufferSizeFactor int, logger *zap.SugaredLogger) (*Persister, error) { 67 | inMemoryBuffer := make(chan string, maxMetricsCount*bufferSizeFactor) 68 | ps := &Persister{ 69 | logger: logger, 70 | buffer: inMemoryBuffer, 71 | } 72 | return ps, nil 73 | } 74 | -------------------------------------------------------------------------------- /components/global/portal/io.cellery.observability.ui/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@cellery-io/observability-portal", 3 | "version": "0.6.1-SNAPSHOT", 4 | "description": "Cellery Observability Portal", 5 | "author": "WSO2 Cellery Maintainers", 6 | "license": "Apache-2.0", 7 | "scripts": { 8 | "install": "npm --prefix ./node-server ci ./node-server", 9 | "clean": "rimraf ./build/ && rimraf ./node-server/public/ && rimraf ./coverage/", 10 | "start": "concurrently --kill-others --names \"config-server,webpack-dev-server\" \"APP_ENV=DEV PORTAL_PORT=4000 node node-server/serve.js\" \"react-scripts start\"", 11 | "lint": "eslint --color src/", 12 | "lint:fix": "eslint --color --fix src/", 13 | "build": "react-scripts build", 14 | "test": "CI=true react-scripts test --colors --testURL=http://test.cellery.com --coverage", 15 | "eject": "react-scripts eject" 16 | }, 17 | "dependencies": { 18 | "@material-ui/core": "^3.8.3", 19 | "@material-ui/icons": "^3.0.2", 20 | "axios": "^0.18.0", 21 | "classnames": "^2.2.6", 22 | "d3": "^5.7.0", 23 | "d3-drag": "^1.2.3", 24 | "d3-force": "^2.0.0", 25 | "d3-shape": "^1.2.2", 26 | "d3-zoom": "^1.7.3", 27 | "interactjs": "^1.3.4", 28 | "js-logger": "^1.6.0", 29 | "jwt-decode": "^2.2.0", 30 | "material-ui-chip-input": "^1.0.0-beta.11", 31 | "mermaid": "8.0.0", 32 | "moment": "^2.22.2", 33 | "mui-datatables": "^2.0.0-beta-50", 34 | "prop-types": "^15.6.2", 35 | "randomcolor": "^0.5.3", 36 | "react": "^16.6.0", 37 | "react-d3-graph": "^2.0.0-rc2", 38 | "react-datetime": "^2.16.2", 39 | "react-dom": "^16.6.0", 40 | "react-router-dom": "^4.3.1", 41 | "react-scripts": "^2.1.3", 42 | "react-select": "^2.1.2", 43 | "react-vis": "^1.11.6", 44 | "vis": "4.20.1" 45 | }, 46 | "devDependencies": { 47 | "concurrently": "^4.1.0", 48 | "eslint-plugin-jest": "^22.1.3", 49 | "rimraf": "^2.6.3" 50 | }, 51 | "jest": { 52 | "resetMocks": true, 53 | "resetModules": true 54 | }, 55 | "browserslist": [ 56 | ">0.2%", 57 | "not dead", 58 | "not ie <= 11", 59 | "not op_mini all" 60 | ], 61 | "proxy": "http://localhost:4000" 62 | } 63 | -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.agent.receiver/src/main/java/io/cellery/observability/agent/receiver/internal/RuntimeAgentServiceComponent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package io.cellery.observability.agent.receiver.internal; 20 | 21 | import io.cellery.observability.auth.AuthProvider; 22 | import org.osgi.service.component.annotations.Component; 23 | import org.osgi.service.component.annotations.Reference; 24 | import org.osgi.service.component.annotations.ReferenceCardinality; 25 | import org.osgi.service.component.annotations.ReferencePolicy; 26 | 27 | /** 28 | * This is the declarative service component of the observability Runtime Agent component, 29 | * which is responsible for listening on the required osgi services and exposing the services so that 30 | * other components can use them. 31 | */ 32 | @Component( 33 | service = RuntimeAgentServiceComponent.class, 34 | immediate = true 35 | ) 36 | public class RuntimeAgentServiceComponent { 37 | 38 | @Reference( 39 | name = "io.cellery.observability.auth.AuthProvider", 40 | service = AuthProvider.class, 41 | cardinality = ReferenceCardinality.MANDATORY, 42 | policy = ReferencePolicy.DYNAMIC, 43 | unbind = "unsetAuthProvider" 44 | ) 45 | protected void setAuthProvider(AuthProvider authProvider) { 46 | ServiceHolder.setAuthProvider(authProvider); 47 | } 48 | 49 | protected void unsetAuthProvider(AuthProvider authProvider) { 50 | ServiceHolder.setAuthProvider(null); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.auth/src/main/java/io/cellery/observability/auth/internal/ServiceHolder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package io.cellery.observability.auth.internal; 20 | 21 | import io.cellery.observability.auth.DcrProvider; 22 | import org.wso2.carbon.config.provider.ConfigProvider; 23 | import org.wso2.carbon.datasource.core.api.DataSourceService; 24 | 25 | /** 26 | * This is a static class which holds the references of the OSGI services registered. 27 | */ 28 | public class ServiceHolder { 29 | private static ConfigProvider configProvider; 30 | private static DataSourceService dataSourceService; 31 | private static DcrProvider dcrProvider; 32 | 33 | public static ConfigProvider getConfigProvider() { 34 | return configProvider; 35 | } 36 | 37 | public static void setConfigProvider(ConfigProvider configProvider) { 38 | ServiceHolder.configProvider = configProvider; 39 | } 40 | 41 | public static DataSourceService getDataSourceService() { 42 | return dataSourceService; 43 | } 44 | 45 | public static void setDataSourceService(DataSourceService dataSourceService) { 46 | ServiceHolder.dataSourceService = dataSourceService; 47 | } 48 | 49 | public static DcrProvider getDcrProvider() { 50 | return dcrProvider; 51 | } 52 | 53 | public static void setDcrProvider(DcrProvider dcrProvider) { 54 | ServiceHolder.dcrProvider = dcrProvider; 55 | } 56 | 57 | private ServiceHolder() { // Prevent initialization 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.model.generator/src/main/java/io/cellery/observability/model/generator/internal/ServiceHolder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | package io.cellery.observability.model.generator.internal; 19 | 20 | import io.cellery.observability.model.generator.model.ModelManager; 21 | import org.wso2.carbon.datasource.core.api.DataSourceService; 22 | 23 | /** 24 | * This class holds the registered services by OSGi, that is required by the entire component. 25 | */ 26 | public class ServiceHolder { 27 | private static DataSourceService dataSourceService; 28 | private static ModelStoreManager modelStoreManager; 29 | private static ModelManager modelManager; 30 | 31 | private ServiceHolder() { // Prevent initialization 32 | } 33 | 34 | public static DataSourceService getDataSourceService() { 35 | return dataSourceService; 36 | } 37 | 38 | public static void setDataSourceService(DataSourceService dataSourceService) { 39 | ServiceHolder.dataSourceService = dataSourceService; 40 | } 41 | 42 | public static ModelStoreManager getModelStoreManager() { 43 | return modelStoreManager; 44 | } 45 | 46 | public static void setModelStoreManager(ModelStoreManager modelStoreManager) { 47 | ServiceHolder.modelStoreManager = modelStoreManager; 48 | } 49 | 50 | public static ModelManager getModelManager() { 51 | return modelManager; 52 | } 53 | 54 | public static void setModelManager(ModelManager modelManager) { 55 | ServiceHolder.modelManager = modelManager; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /components/global/portal/io.cellery.observability.ui/src/components/tracing/view/timeline/TimelineView.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | /** 20 | * Overrides for the vis-timeline library 21 | */ 22 | 23 | div.vis-group { 24 | cursor: pointer; 25 | } 26 | 27 | div.vis-inner { 28 | padding-left: 0 !important; 29 | } 30 | 31 | div.vis-label::before { 32 | content: none !important; 33 | } 34 | 35 | div.vis-label.expanded > div.vis-inner > div > div > div:first-child:before { 36 | content: "\25BC"; 37 | } 38 | 39 | div.vis-label.collapsed > div.vis-inner > div > div > div:first-child:before { 40 | content: "\25B6"; 41 | } 42 | 43 | div.vis-nested-group { 44 | background-color: initial; 45 | } 46 | 47 | div.vis-panel.vis-left { 48 | max-width: 80%; 49 | } 50 | 51 | div.vis-item-span { 52 | border-radius: 5px !important; 53 | max-height: 8px; 54 | } 55 | 56 | div.vis-item-span > div.vis-item-overflow { 57 | top: -7px; 58 | width: 5em; 59 | } 60 | 61 | div.vis-item-span > div.vis-item-overflow > div.vis-item-content { 62 | padding: 0 !important; 63 | font-size: 12px; 64 | } 65 | 66 | div.vis-item-span-description { 67 | background-color: #f3f3f3; 68 | border: #f3f3f3; 69 | } 70 | 71 | @keyframes selected-component-highlight { 72 | from { 73 | background-color: rgba(0, 0, 0, 0.7); 74 | } 75 | to { 76 | background-color: rgba(0, 0, 0, 0); 77 | } 78 | } 79 | 80 | div.highlighted-span { 81 | animation-name: selected-component-highlight; 82 | animation-duration: 3s; 83 | animation-timing-function: ease-out; 84 | } 85 | -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.api/src/test/java/io/cellery/observability/api/UtilsTestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package io.cellery.observability.api; 20 | 21 | import org.powermock.core.classloader.annotations.PowerMockIgnore; 22 | import org.powermock.core.classloader.annotations.PrepareForTest; 23 | import org.powermock.modules.testng.PowerMockObjectFactory; 24 | import org.testng.Assert; 25 | import org.testng.IObjectFactory; 26 | import org.testng.annotations.ObjectFactory; 27 | import org.testng.annotations.Test; 28 | 29 | import javax.net.ssl.HttpsURLConnection; 30 | 31 | /** 32 | * Test Cases for API Utils. 33 | */ 34 | @PrepareForTest(HttpsURLConnection.class) 35 | @PowerMockIgnore({"org.apache.log4j.*", "javax.net.ssl.*"}) 36 | public class UtilsTestCase { 37 | 38 | @ObjectFactory 39 | public IObjectFactory getObjectFactory() { 40 | return new PowerMockObjectFactory(); 41 | } 42 | 43 | @Test 44 | public void testGenerateSiddhiMatchConditionForAnyValues() { 45 | String condition = Utils.generateSiddhiMatchConditionForMultipleValues( 46 | "testAttr", 47 | new String[]{"value1", "value2", "value2b"} 48 | ); 49 | Assert.assertEquals(condition, "testAttr == \"value1\" or testAttr == \"value2\" " + 50 | "or testAttr == \"value2b\""); 51 | } 52 | 53 | @Test 54 | public void testGenerateSiddhiMatchConditionForAnyValuesWithEmptyArray() { 55 | String condition = Utils.generateSiddhiMatchConditionForMultipleValues("testAttr", new String[]{}); 56 | Assert.assertEquals(condition, ""); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.telemetry.deduplicator/src/main/java/io/cellery/observability/telemetry/deduplicator/internal/Constants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package io.cellery.observability.telemetry.deduplicator.internal; 20 | 21 | /** 22 | * Telemetry Deduplicator Constants. 23 | */ 24 | public class Constants { 25 | public static final String MAX_REQUEST_SIZE = "maxRequestSize"; 26 | public static final String MAX_RESPONSE_DURATION = "maxResponseDuration"; 27 | public static final String MAX_RESPONSE_SIZE = "maxResponseSize"; 28 | 29 | public static final int TIME_INTERVAL_EXECUTOR_INDEX = 0; 30 | public static final int RUNTIME_EXECUTOR_INDEX = 1; 31 | public static final int TRACE_ID_EXECUTOR_INDEX = 2; 32 | public static final int SPAN_ID_EXECUTOR_INDEX = 3; 33 | public static final int PARENT_SPAN_ID_EXECUTOR_INDEX = 4; 34 | public static final int SOURCE_NAMESPACE_EXECUTOR_INDEX = 5; 35 | public static final int SOURCE_INSTANCE_EXECUTOR_INDEX = 6; 36 | public static final int SOURCE_COMPONENT_EXECUTOR_INDEX = 7; 37 | public static final int DESTINATION_NAMESPACE_EXECUTOR_INDEX = 8; 38 | public static final int DESTINATION_INSTANCE_EXECUTOR_INDEX = 9; 39 | public static final int DESTINATION_COMPONENT_EXECUTOR_INDEX = 10; 40 | public static final int REQUEST_SIZE_EXECUTOR_INDEX = 11; 41 | public static final int RESPONSE_DURATION_EXECUTOR_INDEX = 12; 42 | public static final int RESPONSE_SIZE_EXECUTOR_INDEX = 13; 43 | 44 | public static final int NUM_OF_PARAMETERS = 14; // Number of parameters in the syntax 45 | 46 | private Constants() { // Prevent initialization 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /components/global/portal/io.cellery.observability.ui/node-server/serve.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | const path = require("path"); 20 | const fs = require("fs"); 21 | const express = require("express"); 22 | const fallback = require("express-history-api-fallback"); 23 | 24 | const app = express(); 25 | const webPortalPort = process.env.PORTAL_PORT || 3000; 26 | 27 | const configRoot = path.join(__dirname, "/config"); 28 | const portalConfigFile = `${configRoot}/portal.json`; 29 | console.log(`Using Portal Configuration from ${portalConfigFile} file`); 30 | 31 | let portalConfig; 32 | const loadPortalConfig = () => { 33 | portalConfig = fs.readFileSync(`${portalConfigFile}`, "utf8"); 34 | console.log("Loaded new Portal Configuration"); 35 | }; 36 | loadPortalConfig(); 37 | 38 | // Watching for config changes 39 | fs.watch(configRoot, null, () => { 40 | loadPortalConfig(); 41 | }); 42 | 43 | // REST API for configurations 44 | app.get("/config", (req, res) => { 45 | res.set("Content-Type", "application/json"); 46 | res.send(portalConfig); 47 | }); 48 | 49 | if (process.env.APP_ENV !== "DEV") { 50 | const appRoot = path.join(__dirname, "/public"); 51 | console.log(`Using App from ${appRoot} directory`); 52 | 53 | // Serving the React App 54 | app.use(express.static(appRoot)); 55 | app.use(fallback("index.html", { 56 | root: appRoot 57 | })); 58 | } else { 59 | console.log("Serving Only the Observability Portal Configuration"); 60 | } 61 | 62 | const server = app.listen(webPortalPort, () => { 63 | const host = server.address().address; 64 | const port = server.address().port; 65 | 66 | console.log("Cellery Observability Portal listening at http://%s:%s", host, port); 67 | }); 68 | -------------------------------------------------------------------------------- /components/global/observability-agent/pkg/kubeagent/events.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package kubeagent 20 | 21 | import ( 22 | "github.com/google/go-cmp/cmp" 23 | "github.com/google/go-cmp/cmp/cmpopts" 24 | "k8s.io/client-go/tools/cache" 25 | ) 26 | 27 | type Event string 28 | 29 | const ( 30 | EventAdd Event = "Add" 31 | EventUpdate Event = "Update" 32 | EventDelete Event = "Delete" 33 | ) 34 | 35 | type WriterFunc func(attribute Attributes) 36 | type LoggerFunc func(format string, args ...interface{}) 37 | 38 | func HandleAll(mfn MapperFunc, wfn WriterFunc, logf LoggerFunc) cache.ResourceEventHandler { 39 | return cache.ResourceEventHandlerFuncs{ 40 | AddFunc: PassNew(HandleEvent(EventAdd, mfn, wfn, logf)), 41 | UpdateFunc: HandleEvent(EventUpdate, mfn, wfn, logf), 42 | DeleteFunc: PassNew(HandleEvent(EventDelete, mfn, wfn, logf)), 43 | } 44 | } 45 | 46 | func HandleEvent(e Event, mfn MapperFunc, wfn WriterFunc, logf LoggerFunc) func(interface{}, interface{}) { 47 | return func(old interface{}, new interface{}) { 48 | newAttr, err := mfn(new) 49 | if err != nil { 50 | logf("Fail to handle new event %s: %v", e, err) 51 | return 52 | } 53 | var oldAttr Attributes 54 | if old != nil { 55 | attr, err := mfn(old) 56 | if err != nil { 57 | logf("Fail to handle old event %s: %v", e, err) 58 | return 59 | } 60 | oldAttr = attr 61 | } 62 | if diff := cmp.Diff(newAttr, oldAttr, cmpopts.IgnoreMapEntries(ignoreCurrentTimestampAttributeFunc)); old == nil || diff != "" { 63 | newAttr[AttributeAction] = e 64 | wfn(newAttr) 65 | } 66 | } 67 | } 68 | 69 | func PassNew(f func(interface{}, interface{})) func(interface{}) { 70 | return func(new interface{}) { 71 | f(nil, new) 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.siddhi.apps/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 22 | 23 | io.cellery.observability 24 | io.cellery.observability.core 25 | 0.6.2-SNAPSHOT 26 | 27 | 28 | 4.0.0 29 | io.cellery.observability.siddhi.apps 30 | 0.6.2-SNAPSHOT 31 | Cellery Observability Components - Global Plane - Core - Siddhi Apps 32 | pom 33 | 34 | 35 | 36 | 37 | org.apache.maven.plugins 38 | maven-assembly-plugin 39 | 40 | 41 | package 42 | 43 | single 44 | 45 | 46 | 47 | 48 | 49 | ${project.basedir}/assembly.xml 50 | 51 | false 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /components/global/observability-agent/pkg/config/config.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package config 20 | 21 | import ( 22 | "encoding/json" 23 | "fmt" 24 | "io/ioutil" 25 | 26 | "cellery.io/cellery-observability/components/global/observability-agent/pkg/store/database" 27 | "cellery.io/cellery-observability/components/global/observability-agent/pkg/store/file" 28 | "cellery.io/cellery-observability/components/global/observability-agent/pkg/store/memory" 29 | 30 | "cellery.io/cellery-observability/components/global/observability-agent/pkg/adapter" 31 | "cellery.io/cellery-observability/components/global/observability-agent/pkg/publisher" 32 | ) 33 | 34 | type ( 35 | Config struct { 36 | adapter.Mixer `json:"mixer"` 37 | publisher.SpEndpoint `json:"spEndpoint"` 38 | Store struct { 39 | *file.File `json:"fileStorage"` 40 | *database.Database `json:"database"` 41 | *memory.Memory `json:"inMemory"` 42 | } `json:"store"` 43 | Advanced struct { 44 | AccessToken string `json:"accessToken"` 45 | RuntimeId string `json:"runtimeId"` 46 | MaxRecordsForSingleWrite int `json:"maxRecordsForSingleWrite"` 47 | BufferSizeFactor int `json:"bufferSizeFactor"` 48 | BufferTimeoutSeconds int `json:"bufferTimeoutSeconds"` 49 | } `json:"advanced"` 50 | } 51 | ) 52 | 53 | func New(configFilePath string) (*Config, error) { 54 | data, err := ioutil.ReadFile(configFilePath) 55 | if err != nil { 56 | return nil, fmt.Errorf("could not read the config file : %v", err) 57 | } 58 | config := &Config{} 59 | err = json.Unmarshal(data, config) 60 | if err != nil { 61 | return nil, fmt.Errorf("could not unmarshal the config file : %v", err) 62 | } 63 | return config, nil 64 | } 65 | -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.api/src/main/java/io/cellery/observability/api/Constants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | package io.cellery.observability.api; 19 | 20 | import java.util.regex.Pattern; 21 | 22 | /** 23 | * This class defines the constants that are used by the observability API component. 24 | */ 25 | public class Constants { 26 | private Constants() { 27 | } 28 | 29 | public static final String REQUEST_PROPERTY_ACCESS_TOKEN = "ACCESS_TOKEN"; 30 | 31 | public static final String HEADER_ACCESS_CONTROL_ALLOW_ORIGIN = "Access-Control-Allow-Origin"; 32 | public static final String HEADER_ACCESS_CONTROL_ALLOW_METHODS = "Access-Control-Allow-Methods"; 33 | public static final String HEADER_ACCESS_CONTROL_ALLOW_HEADERS = "Access-Control-Allow-Headers"; 34 | public static final String HEADER_ACCESS_CONTROL_MAX_AGE = "Access-Control-Max-Age"; 35 | public static final String HEADER_ACCESS_CONTROL_ALLOW_CREDENTIALS = "Access-Control-Allow-Credentials"; 36 | public static final String HEADER_ORIGIN = "Origin"; 37 | 38 | public static final String MAX_AGE = "3600"; 39 | public static final String ALL_ORIGINS = "*"; 40 | 41 | public static final String ACCESS_TOKEN = "access_token"; 42 | public static final String ID_TOKEN = "id_token"; 43 | public static final String HTTP_ONLY_SESSION_COOKIE = "oasid"; 44 | 45 | public static final Pattern CELLERY_ID_PATTERN = Pattern.compile("^[a-z0-9]+(?:-[a-z0-9]+)*$"); 46 | public static final Pattern TRACE_ID_PATTERN = Pattern.compile("^[a-z0-9-]+$"); 47 | public static final Pattern TIME_GRANULARITY_PATTERN 48 | = Pattern.compile("^(?:seconds|minutes|hours|days|months|years)$"); 49 | public static final Pattern SIMPLE_STRING_PATTERN = Pattern.compile("^[^\"']+$"); 50 | } 51 | -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.api/src/main/java/io/cellery/observability/api/UserAPI.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package io.cellery.observability.api; 20 | 21 | import com.google.gson.JsonObject; 22 | import io.cellery.observability.api.exception.APIInvocationException; 23 | import io.cellery.observability.api.internal.ServiceHolder; 24 | import io.cellery.observability.auth.Permission; 25 | import org.wso2.msf4j.Request; 26 | 27 | import javax.ws.rs.GET; 28 | import javax.ws.rs.OPTIONS; 29 | import javax.ws.rs.Path; 30 | import javax.ws.rs.Produces; 31 | import javax.ws.rs.core.Context; 32 | import javax.ws.rs.core.Response; 33 | 34 | /** 35 | * MSF4J service for User services. 36 | */ 37 | @Path("/api/user") 38 | public class UserAPI { 39 | 40 | @GET 41 | @Path("/permissions") 42 | @Produces("application/json") 43 | public Response getAuthorizedRunTimeNamespaces(@Context Request request) throws APIInvocationException { 44 | try { 45 | Object accessToken = request.getProperty(Constants.REQUEST_PROPERTY_ACCESS_TOKEN); 46 | if (accessToken instanceof String) { 47 | Permission[] availableRunTimeNamespaces 48 | = ServiceHolder.getAuthProvider().getAllAllowedPermissions((String) accessToken); 49 | return Response.ok().entity(availableRunTimeNamespaces).build(); 50 | } else { 51 | return Response.ok().entity(new JsonObject()).build(); 52 | } 53 | } catch (Throwable e) { 54 | throw new APIInvocationException("Error while fetching authorized runtimes", e); 55 | } 56 | } 57 | 58 | @OPTIONS 59 | @Path(".*") 60 | public Response getOptions() { 61 | return Response.ok().build(); 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.model.generator/src/main/java/io/cellery/observability/model/generator/model/EdgeNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package io.cellery.observability.model.generator.model; 20 | 21 | import java.util.Objects; 22 | 23 | /** 24 | * Represents the node (source or target) in a edge. 25 | */ 26 | public class EdgeNode { 27 | private String namespace; 28 | private String instance; 29 | private String component; 30 | 31 | public EdgeNode(String namespace, String instance, String component) { 32 | this.namespace = namespace; 33 | this.instance = instance; 34 | this.component = component; 35 | } 36 | 37 | public String getNamespace() { 38 | return namespace; 39 | } 40 | 41 | public String getInstance() { 42 | return instance; 43 | } 44 | 45 | public String getComponent() { 46 | return component; 47 | } 48 | 49 | public String getFQN() { 50 | return Model.getNodeFQN(this); 51 | } 52 | 53 | public boolean equals(Object anotherObject) { 54 | boolean equals; 55 | if (anotherObject instanceof EdgeNode) { 56 | EdgeNode anotherEdgeNode = (EdgeNode) anotherObject; 57 | equals = Objects.equals(this.namespace, anotherEdgeNode.getNamespace()) 58 | && Objects.equals(this.instance, anotherEdgeNode.getInstance()) 59 | && Objects.equals(this.component, anotherEdgeNode.getComponent()); 60 | } else { 61 | equals = false; 62 | } 63 | return equals; 64 | } 65 | 66 | public int hashCode() { 67 | return Objects.hash(this.namespace, this.instance, this.component); 68 | } 69 | 70 | public String toString() { 71 | return this.getFQN(); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.auth/src/main/java/io/cellery/observability/auth/AuthProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package io.cellery.observability.auth; 20 | 21 | import io.cellery.observability.auth.exception.AuthProviderException; 22 | 23 | /** 24 | * Auth Provider interface used for authentication and authorization in Cellery. 25 | * 26 | * This can be implemented to override the auth behaviour of Cellery Observability. 27 | */ 28 | public interface AuthProvider { 29 | 30 | /** 31 | * Validate the token. 32 | * 33 | * Empty string as runtime in the required permission represents an action that is not runtime aware. 34 | * Empty string as namespace in the required permission represents an action that is not namespace aware. 35 | * 36 | * @param token The token of which the validity should be checked 37 | * @param requiredPermission The permission required by the user 38 | * @return True if the token is valid 39 | * @throws AuthProviderException if validating the token fails 40 | */ 41 | boolean isTokenValid(String token, Permission requiredPermission) throws AuthProviderException; 42 | 43 | /** 44 | * Get an array of all the permissions allowed for a user. 45 | * 46 | * This is called once per each portal load. 47 | * This should return all the authorized namespaces in all the authorized runtimes. 48 | * This is used to ensure that the relevant sections are shown to the user. 49 | * 50 | * @param accessToken The access token sent for the action 51 | * @return The map of authorized runtime namespaces 52 | * @throws AuthProviderException if checking the authorized runtime namespaces failed 53 | */ 54 | Permission[] getAllAllowedPermissions(String accessToken) throws AuthProviderException; 55 | } 56 | -------------------------------------------------------------------------------- /components/global/portal/io.cellery.observability.ui/public/index.html: -------------------------------------------------------------------------------- 1 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 30 | 31 | 40 | Cellery Observability 41 | 42 | 43 | 46 |
47 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.api/src/test/java/io/cellery/observability/api/exception/APIInvocationExceptionTestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package io.cellery.observability.api.exception; 20 | 21 | import com.google.gson.JsonObject; 22 | import com.google.gson.JsonParser; 23 | import org.powermock.reflect.Whitebox; 24 | import org.testng.Assert; 25 | import org.testng.annotations.Test; 26 | 27 | import java.util.List; 28 | import java.util.Map; 29 | import javax.ws.rs.core.HttpHeaders; 30 | import javax.ws.rs.core.MediaType; 31 | import javax.ws.rs.core.Response; 32 | 33 | public class APIInvocationExceptionTestCase { 34 | private static final JsonParser jsonParser = new JsonParser(); 35 | 36 | @Test 37 | public void testMappingWithAPIInvocationException() { 38 | APIInvocationException.Mapper apiExceptionMapper = new APIInvocationException.Mapper(); 39 | APIInvocationException exception = new APIInvocationException("Test Exception", 40 | new Exception("Test Root Cause")); 41 | 42 | Response response = apiExceptionMapper.toResponse(exception); 43 | JsonObject responseBodyJson = jsonParser.parse(response.getEntity().toString()).getAsJsonObject(); 44 | Map> headersMap = Whitebox.getInternalState(response, "headers"); 45 | List contentTypeHeader = headersMap.get(HttpHeaders.CONTENT_TYPE); 46 | 47 | Assert.assertNotNull(response); 48 | Assert.assertEquals(responseBodyJson.get("status").getAsString(), "Error"); 49 | Assert.assertEquals(responseBodyJson.get("message").getAsString(), "Test Exception"); 50 | Assert.assertEquals(response.getStatus(), Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()); 51 | Assert.assertEquals(contentTypeHeader.size(), 1); 52 | Assert.assertEquals(contentTypeHeader.get(0), MediaType.APPLICATION_JSON); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /components/global/portal/io.cellery.observability.ui/src/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | import "./index.css"; 20 | import App from "./components/App"; 21 | import Constants from "./utils/constants"; 22 | import Logger from "js-logger"; 23 | import React from "react"; 24 | import ReactDOM from "react-dom"; 25 | import * as moment from "moment"; 26 | import * as serviceWorker from "./serviceWorker"; 27 | 28 | // Resolving the Log Level 29 | const LOG_LEVEL_KEY = "LOG_LEVEL"; 30 | let logLevel; 31 | switch (localStorage.getItem(LOG_LEVEL_KEY)) { 32 | case "TRACE": 33 | logLevel = Logger.TRACE; 34 | break; 35 | case "DEBUG": 36 | logLevel = Logger.DEBUG; 37 | break; 38 | case "INFO": 39 | logLevel = Logger.INFO; 40 | break; 41 | case "TIME": 42 | logLevel = Logger.TIME; 43 | break; 44 | case "WARN": 45 | logLevel = Logger.WARN; 46 | break; 47 | case "ERROR": 48 | logLevel = Logger.ERROR; 49 | break; 50 | case "OFF": 51 | logLevel = Logger.OFF; 52 | break; 53 | default: 54 | logLevel = Logger.ERROR; 55 | } 56 | Logger.useDefaults({ 57 | defaultLevel: logLevel, 58 | formatter: (messages, context) => { 59 | messages.unshift(`[${moment().format(Constants.Pattern.PRECISE_DATE_TIME)}] ${ 60 | context.level.name}${context.name ? ` {${context.name}}` : ""} -`); 61 | } 62 | }); 63 | const logger = Logger.get("index"); 64 | logger.info(`Initialized logging with Log Level ${logLevel.name}`); 65 | 66 | logger.info("Rendering Observability Portal"); 67 | ReactDOM.render((), document.getElementById("root")); 68 | 69 | /* 70 | * If you want your app to work offline and load faster, you can change 71 | * unregister() to register() below. Note this comes with some pitfalls. 72 | * Learn more about service workers: http://bit.ly/CRA-PWA 73 | */ 74 | serviceWorker.unregister(); 75 | -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.model.generator/src/main/java/io/cellery/observability/model/generator/model/Model.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | package io.cellery.observability.model.generator.model; 19 | 20 | import java.util.Objects; 21 | import java.util.Set; 22 | 23 | /** 24 | * Represents a dependency model between components in the system. 25 | */ 26 | public class Model { 27 | private Set nodes; 28 | private Set edges; 29 | 30 | private static final String NODE_FQN_SEPARATOR = ":"; 31 | 32 | public Model(Set nodes, Set edges) { 33 | this.nodes = nodes; 34 | this.edges = edges; 35 | } 36 | 37 | public Set getNodes() { 38 | return nodes; 39 | } 40 | 41 | public Set getEdges() { 42 | return edges; 43 | } 44 | 45 | public static String getNodeFQN(EdgeNode node) { 46 | return Model.getNodeFQN(node.getNamespace(), node.getInstance(), node.getComponent()); 47 | } 48 | 49 | public static String getNodeFQN(String namespace, String instance, String component) { 50 | return namespace + NODE_FQN_SEPARATOR + instance + NODE_FQN_SEPARATOR 51 | + component; 52 | } 53 | 54 | public boolean equals(Object anotherObject) { 55 | boolean equals; 56 | if (anotherObject instanceof Model) { 57 | Model anotherModel = (Model) anotherObject; 58 | equals = Objects.equals(this.nodes, anotherModel.getNodes()) 59 | && Objects.equals(this.edges, anotherModel.getEdges()); 60 | } else { 61 | equals = false; 62 | } 63 | return equals; 64 | } 65 | 66 | public int hashCode() { 67 | return Objects.hash(this.getNodes(), this.getEdges()); 68 | } 69 | 70 | public String toString() { 71 | return "Nodes: " + this.nodes.toString() + ", Edges: " + this.edges.toString(); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /pull_request_template.md: -------------------------------------------------------------------------------- 1 | ## Purpose 2 | > Describe the problems, issues, or needs driving this feature/fix and include links to related issues in the following format: Resolves issue1, issue2, etc. 3 | 4 | ## Goals 5 | > Describe the solutions that this feature/fix will introduce to resolve the problems described above 6 | 7 | ## Approach 8 | > Describe how you are implementing the solutions. Include an animated GIF or screenshot if the change affects the UI (email documentation@wso2.com to review all UI text). Include a link to a Markdown file or Google doc if the feature write-up is too long to paste here. 9 | 10 | ## User stories 11 | > Summary of user stories addressed by this change> 12 | 13 | ## Release note 14 | > Brief description of the new feature or bug fix as it will appear in the release notes 15 | 16 | ## Documentation 17 | > Link(s) to product documentation that addresses the changes of this PR. If no doc impact, enter “N/A” plus brief explanation of why there’s no doc impact 18 | 19 | ## Training 20 | > Link to the PR for changes to the training content in https://github.com/wso2/WSO2-Training, if applicable 21 | 22 | ## Certification 23 | > Type “Sent” when you have provided new/updated certification questions, plus four answers for each question (correct answer highlighted in bold), based on this change. Certification questions/answers should be sent to certification@wso2.com and NOT pasted in this PR. If there is no impact on certification exams, type “N/A” and explain why. 24 | 25 | ## Marketing 26 | > Link to drafts of marketing content that will describe and promote this feature, including product page changes, technical articles, blog posts, videos, etc., if applicable 27 | 28 | ## Automation tests 29 | - Unit tests 30 | > Code coverage information 31 | - Integration tests 32 | > Details about the test cases and coverage 33 | 34 | ## Security checks 35 | - Followed secure coding standards in http://wso2.com/technical-reports/wso2-secure-engineering-guidelines? yes/no 36 | - Ran FindSecurityBugs plugin and verified report? yes/no 37 | - Confirmed that this PR doesn't commit any keys, passwords, tokens, usernames, or other secrets? yes/no 38 | 39 | ## Samples 40 | > Provide high-level details about the samples related to this feature 41 | 42 | ## Related PRs 43 | > List any other related PRs 44 | 45 | ## Migrations (if applicable) 46 | > Describe migration steps and platforms on which migration has been tested 47 | 48 | ## Test environment 49 | > List all JDK versions, operating systems, databases, and browser/versions on which this feature/fix was tested 50 | 51 | ## Learning 52 | > Describe the research phase and any blog posts, patterns, libraries, or add-ons you used to solve the problem. -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.api/src/main/java/io/cellery/observability/api/exception/BaseExceptionMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package io.cellery.observability.api.exception; 20 | 21 | import com.google.gson.Gson; 22 | import com.google.gson.JsonObject; 23 | import com.google.gson.JsonPrimitive; 24 | import org.apache.log4j.Logger; 25 | 26 | import javax.ws.rs.core.HttpHeaders; 27 | import javax.ws.rs.core.MediaType; 28 | import javax.ws.rs.core.Response; 29 | import javax.ws.rs.ext.ExceptionMapper; 30 | 31 | /** 32 | * Base exception mapper class capable of generating responses for exceptions. 33 | * 34 | * @param The exception to be handled by the mapper 35 | */ 36 | abstract class BaseExceptionMapper implements ExceptionMapper { 37 | 38 | private static final Logger log = Logger.getLogger(BaseExceptionMapper.class); 39 | private Gson gson = new Gson(); 40 | 41 | private static final String STATUS = "status"; 42 | private static final String STATUS_ERROR = "Error"; 43 | private static final String MESSAGE = "message"; 44 | 45 | private Response.Status defaultStatus; 46 | 47 | BaseExceptionMapper(Response.Status defaultStatus) { 48 | this.defaultStatus = defaultStatus; 49 | } 50 | 51 | /** 52 | * Generate a proper response for an exception. 53 | * 54 | * @param exception The exception to be handled 55 | * @return Proper response for the exception 56 | */ 57 | Response generateResponse(E exception) { 58 | log.error("Error in Observability Portal API", exception); 59 | 60 | JsonObject errorResponseJsonObject = new JsonObject(); 61 | errorResponseJsonObject.add(STATUS, new JsonPrimitive(STATUS_ERROR)); 62 | errorResponseJsonObject.add(MESSAGE, new JsonPrimitive(exception.getMessage())); 63 | 64 | return Response.status(defaultStatus) 65 | .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) 66 | .entity(gson.toJson(errorResponseJsonObject)) 67 | .build(); 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.model.generator/src/test/java/io/cellery/observability/model/generator/model/EdgeNodeTestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package io.cellery.observability.model.generator.model; 20 | 21 | import org.testng.Assert; 22 | import org.testng.annotations.Test; 23 | 24 | /** 25 | * Edge Note related test cases. 26 | */ 27 | public class EdgeNodeTestCase { 28 | 29 | @Test 30 | public void testNodeEquality() { 31 | EdgeNode nodeA = new EdgeNode("test-namespace", "test-instance", "test-component"); 32 | EdgeNode nodeB = new EdgeNode("test-namespace", "test-instance", "test-component"); 33 | Assert.assertEquals(nodeA, nodeB); 34 | } 35 | 36 | @Test 37 | public void testNodeInEqualityWithMismatchedNamespace() { 38 | EdgeNode nodeA = new EdgeNode("test-namespace", "test-instance", "test-component"); 39 | EdgeNode nodeB = new EdgeNode("different-namespace", "test-instance", "test-component"); 40 | Assert.assertNotEquals(nodeA, nodeB); 41 | } 42 | 43 | @Test 44 | public void testNodeInEqualityWithMismatchedInstance() { 45 | EdgeNode nodeA = new EdgeNode("test-namespace", "test-instance", "test-component"); 46 | EdgeNode nodeB = new EdgeNode("test-namespace", "different-instance", "test-component"); 47 | Assert.assertNotEquals(nodeA, nodeB); 48 | } 49 | 50 | @Test 51 | public void testNodeInEqualityWithMismatchedComponent() { 52 | EdgeNode nodeA = new EdgeNode("test-namespace", "test-instance", "test-component"); 53 | EdgeNode nodeB = new EdgeNode("test-namespace", "test-instance", "different-component"); 54 | Assert.assertNotEquals(nodeA, nodeB); 55 | } 56 | 57 | @Test 58 | public void testNodeFQN() { 59 | EdgeNode nodeA = new EdgeNode("test-namespace", "test-instance", "test-component"); 60 | Assert.assertEquals(Model.getNodeFQN(nodeA), nodeA.getFQN()); 61 | 62 | EdgeNode nodeB = new EdgeNode("test-namespace", "test-instance", "test-component"); 63 | Assert.assertEquals(Model.getNodeFQN(nodeB), nodeB.getFQN()); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.api/src/test/java/io/cellery/observability/api/exception/InvalidParamExceptionTestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package io.cellery.observability.api.exception; 20 | 21 | import com.google.gson.JsonObject; 22 | import com.google.gson.JsonParser; 23 | import org.powermock.reflect.Whitebox; 24 | import org.testng.Assert; 25 | import org.testng.annotations.Test; 26 | 27 | import java.util.List; 28 | import java.util.Map; 29 | import javax.ws.rs.core.HttpHeaders; 30 | import javax.ws.rs.core.MediaType; 31 | import javax.ws.rs.core.Response; 32 | 33 | public class InvalidParamExceptionTestCase { 34 | private static final JsonParser jsonParser = new JsonParser(); 35 | 36 | @Test 37 | public void testMappingWithInvalidParamException() { 38 | String paramName = "paramName"; 39 | String expectedParamValue = "paramValue"; 40 | String receivedParamValue = "paramValue1"; 41 | InvalidParamException.Mapper apiExceptionMapper = new InvalidParamException.Mapper(); 42 | InvalidParamException exception = new InvalidParamException(paramName, expectedParamValue, receivedParamValue); 43 | 44 | Response response = apiExceptionMapper.toResponse(exception); 45 | JsonObject responseBodyJson = jsonParser.parse(response.getEntity().toString()).getAsJsonObject(); 46 | Map> headersMap = Whitebox.getInternalState(response, "headers"); 47 | List contentTypeHeader = headersMap.get(HttpHeaders.CONTENT_TYPE); 48 | 49 | Assert.assertNotNull(response); 50 | Assert.assertEquals(responseBodyJson.get("status").getAsString(), "Error"); 51 | Assert.assertEquals(responseBodyJson.get("message").getAsString(), 52 | "Invalid parameter " + paramName + " provided. Expected " + expectedParamValue 53 | + ", received " + receivedParamValue); 54 | Assert.assertEquals(response.getStatus(), Response.Status.PRECONDITION_FAILED.getStatusCode()); 55 | Assert.assertEquals(contentTypeHeader.size(), 1); 56 | Assert.assertEquals(contentTypeHeader.get(0), MediaType.APPLICATION_JSON); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.api/src/main/java/io/cellery/observability/api/interceptor/CORSInterceptor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package io.cellery.observability.api.interceptor; 20 | 21 | import io.cellery.observability.api.Constants; 22 | import org.apache.commons.lang3.StringUtils; 23 | import org.apache.log4j.Logger; 24 | import org.wso2.msf4j.Request; 25 | import org.wso2.msf4j.Response; 26 | import org.wso2.msf4j.interceptor.RequestInterceptor; 27 | 28 | import javax.ws.rs.HttpMethod; 29 | import javax.ws.rs.core.HttpHeaders; 30 | 31 | /** 32 | * Used for applying header for allowing cross origin requests. 33 | *

34 | * This alone is not enough since the browsers send an OPTIONS HTTP call to the endpoint first to check 35 | * which methods are allowed. Therefore an endpoint with HTTP Method OPTIONS should be added to all services. 36 | */ 37 | public class CORSInterceptor implements RequestInterceptor { 38 | private static final Logger logger = Logger.getLogger(CORSInterceptor.class); 39 | 40 | @Override 41 | public boolean interceptRequest(Request request, Response response) { 42 | response.setHeader(Constants.HEADER_ACCESS_CONTROL_ALLOW_METHODS, HttpMethod.GET + "," + HttpMethod.POST + 43 | "," + HttpMethod.PUT + "," + HttpMethod.DELETE); 44 | response.setHeader(Constants.HEADER_ACCESS_CONTROL_MAX_AGE, Constants.MAX_AGE); 45 | response.setHeader(Constants.HEADER_ACCESS_CONTROL_ALLOW_HEADERS, 46 | HttpHeaders.CONTENT_TYPE + "," + HttpHeaders.AUTHORIZATION); 47 | response.setHeader(Constants.HEADER_ACCESS_CONTROL_ALLOW_CREDENTIALS, "true"); 48 | if (StringUtils.isNotBlank(request.getHeader(Constants.HEADER_ORIGIN))) { 49 | response.setHeader(Constants.HEADER_ACCESS_CONTROL_ALLOW_ORIGIN, 50 | request.getHeader(Constants.HEADER_ORIGIN)); 51 | } else { 52 | response.setHeader(Constants.HEADER_ACCESS_CONTROL_ALLOW_ORIGIN, Constants.ALL_ORIGINS); 53 | } 54 | if (logger.isDebugEnabled()) { 55 | logger.debug("Attached CORS Headers to API Call " + request.getHttpMethod() + " " + request.getUri()); 56 | } 57 | return true; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /components/global/portal/io.cellery.observability.ui/src/components/common/error/ErrorBoundary.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import Logger from "js-logger"; 18 | import React from "react"; 19 | import UnknownError from "./UnknownError"; 20 | import * as PropTypes from "prop-types"; 21 | 22 | /** 23 | * Error Boundary to catch error in React Components. 24 | * This Component can be used to wrap areas of the React App and catch any errors that occur inside them. 25 | * 26 | * Example:- A graph can be wrapped and the title can be set to "Invalid Data" to make sure that the users sees 27 | * this message instead of a blank screen if an error occurs. 28 | * 29 | * This will not affect the dev servers and the errors will still be shown. 30 | * 31 | * @returns {React.Component} Error Boundary React Component 32 | */ 33 | class ErrorBoundary extends React.Component { 34 | 35 | static logger = Logger.get("components/common/error/ErrorBoundary"); 36 | 37 | constructor(props) { 38 | super(props); 39 | 40 | this.state = { 41 | hasError: false 42 | }; 43 | } 44 | 45 | /** 46 | * Derive a suitable state from the error if any error occurs. 47 | * 48 | * @param {Error} error The error that occurred 49 | * @returns {Object} New state 50 | */ 51 | static getDerivedStateFromError = (error) => { 52 | ErrorBoundary.logger.error("Failed to render Observability Portal", error); 53 | return { 54 | hasError: true 55 | }; 56 | }; 57 | 58 | render = () => { 59 | const {children, title, description, showNavigationButtons} = this.props; 60 | const {hasError} = this.state; 61 | 62 | let content; 63 | if (hasError) { 64 | content = ( 65 | 66 | ); 67 | } else { 68 | content = children; 69 | } 70 | return content; 71 | }; 72 | 73 | } 74 | 75 | ErrorBoundary.propTypes = { 76 | children: PropTypes.any.isRequired, 77 | title: PropTypes.string, 78 | description: PropTypes.string, 79 | showNavigationButtons: PropTypes.bool 80 | }; 81 | 82 | export default ErrorBoundary; 83 | -------------------------------------------------------------------------------- /docker/portal/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | io.cellery.observability 21 | io.cellery.observability.docker 22 | 0.6.2-SNAPSHOT 23 | ../pom.xml 24 | 25 | 26 | 4.0.0 27 | io.cellery.observability.docker.portal 28 | Cellery Observability Docker - Portal 29 | Dockerfiles for Cellery Observability Portal 30 | pom 31 | 32 | 33 | 34 | 35 | 36 | org.apache.maven.plugins 37 | maven-dependency-plugin 38 | false 39 | 40 | 41 | copy-observability-portal-app 42 | initialize 43 | 44 | unpack 45 | 46 | 47 | 48 | 49 | 50 | 51 | io.cellery.observability 52 | io.cellery.observability.ui 53 | ${project.version} 54 | zip 55 | true 56 | ${project.build.directory}/files/ 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /components/global/portal/io.cellery.observability.ui/src/utils/constants.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | const Constants = { 18 | Pattern: { 19 | DATE_TIME: "DD MMM YYYY, hh:mm A", 20 | PRECISE_DATE_TIME: "DD MMM YYYY, hh:mm:ss A", 21 | Query: { 22 | SECONDS: "second(?:s)?", 23 | MINUTES: "minute(?:s)?", 24 | HOURS: "hour(?:s)?", 25 | DAYS: "day(?:s)?", 26 | MONTHS: "month(?:s)?", 27 | YEARS: "year(?:s)?" 28 | } 29 | }, 30 | Span: { 31 | Kind: { 32 | CLIENT: "CLIENT", 33 | SERVER: "SERVER", 34 | PRODUCER: "PRODUCER", 35 | CONSUMER: "CONSUMER" 36 | } 37 | }, 38 | InstanceKind: { 39 | CELL: "Cell", 40 | COMPOSITE: "Composite" 41 | }, 42 | Instance: { 43 | GATEWAY_NAME_PATTERN: /^gateway$/, 44 | COMPONENT_NAME_PATTERN: /^(.+)--(.+)$/ 45 | }, 46 | System: { 47 | ISTIO_MIXER_NAME_PATTERN: /^istio-mixer$/, 48 | GLOBAL_GATEWAY_NAME_PATTERN: /^global-gateway$/, 49 | SIDECAR_AUTH_FILTER_OPERATION_NAME_PATTERN: /^async\sext_authz\segress$/ 50 | }, 51 | CelleryType: { 52 | SYSTEM: "System", 53 | COMPONENT: "Component" 54 | }, 55 | Status: { 56 | Success: "Success", 57 | Error: "Error", 58 | Warning: "Warning", 59 | Unknown: "Unknown" 60 | }, 61 | Dashboard: { 62 | ALL_VALUE: "All", 63 | INBOUND: "Inbound", 64 | OUTBOUND: "Outbound", 65 | SIDE_NAV_BAR_WIDTH: 240, 66 | AUTHORIZATION_EP: "/oauth2/authorize?response_type=code" 67 | } 68 | }; 69 | 70 | /* 71 | * Constants that are made up of other constants starts here. 72 | * These cannot be defined in a single object. Hence these are defined separately. 73 | */ 74 | Constants.Pattern.Query.TIME_UNIT = `${Constants.Pattern.Query.YEARS}|${Constants.Pattern.Query.MONTHS}|` 75 | + `${Constants.Pattern.Query.DAYS}|${Constants.Pattern.Query.HOURS}|${Constants.Pattern.Query.MINUTES}|` 76 | + `${Constants.Pattern.Query.SECONDS}`; 77 | Constants.Pattern.Query.TIME = `([0-9]+)\\s*(${Constants.Pattern.Query.TIME_UNIT})`; 78 | Constants.Pattern.Query.RELATIVE_TIME = `^\\s*now\\s*(?:-\\s*(?:${Constants.Pattern.Query.TIME}\\s*)+)?$`; 79 | 80 | export default Constants; 81 | -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.model.generator/src/main/java/io/cellery/observability/model/generator/internal/ModelServiceComponent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | package io.cellery.observability.model.generator.internal; 19 | 20 | import io.cellery.observability.model.generator.model.ModelManager; 21 | import org.apache.log4j.Logger; 22 | import org.osgi.framework.BundleContext; 23 | import org.osgi.service.component.annotations.Activate; 24 | import org.osgi.service.component.annotations.Component; 25 | import org.osgi.service.component.annotations.Reference; 26 | import org.osgi.service.component.annotations.ReferenceCardinality; 27 | import org.osgi.service.component.annotations.ReferencePolicy; 28 | import org.wso2.carbon.datasource.core.api.DataSourceService; 29 | 30 | /** 31 | * This class acts as a Service Component which specifies the services that is required by the component. 32 | */ 33 | @Component( 34 | service = ModelServiceComponent.class, 35 | immediate = true 36 | ) 37 | public class ModelServiceComponent { 38 | private static final Logger log = Logger.getLogger(ModelServiceComponent.class); 39 | 40 | @Activate 41 | protected void start(BundleContext bundleContext) throws Exception { 42 | try { 43 | ServiceHolder.setModelStoreManager(new ModelStoreManager()); 44 | ServiceHolder.setModelManager(new ModelManager()); 45 | bundleContext.registerService(ModelManager.class.getName(), ServiceHolder.getModelManager(), null); 46 | } catch (Throwable throwable) { 47 | log.error("Error occurred while activating the model generation bundle", throwable); 48 | throw throwable; 49 | } 50 | } 51 | 52 | @Reference( 53 | name = "org.wso2.carbon.datasource.DataSourceService", 54 | service = DataSourceService.class, 55 | cardinality = ReferenceCardinality.AT_LEAST_ONE, 56 | policy = ReferencePolicy.DYNAMIC, 57 | unbind = "unregisterDataSourceService" 58 | ) 59 | protected void registerDataSourceService(DataSourceService service) { 60 | ServiceHolder.setDataSourceService(service); 61 | } 62 | 63 | protected void unregisterDataSourceService(DataSourceService service) { 64 | ServiceHolder.setDataSourceService(null); 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.siddhi.apps/src/main/siddhi/istio-telemetry-app.siddhi: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | @App:name("istio-telemetry-app") 20 | @App:description("This receives the attributes generally received by the Istio Mixer") 21 | 22 | @source(type="runtime-agent", port="9091", agent.type="Telemetry", 23 | @map(type="keyvalue", fail.on.missing.attribute="false")) 24 | define stream TelemetryStream(runtime string, requestId string, traceId string, spanId string, parentSpanId string, 25 | sourceNamespace string, sourceInstance string, sourceInstanceKind string, 26 | sourceComponent string, sourcePod string, destinationNamespace string, 27 | destinationInstance string, destinationInstanceKind string, destinationComponent string, 28 | destinationPod string, requestPath string, requestMethod string, requestSizeBytes long, 29 | responseCode long, responseDurationNanoSec long, responseSizeBytes long, 30 | reporterUID string, reporterKind string); 31 | 32 | @sink(type="inMemory", topic="istio-mixer-report", @map(type="passThrough")) 33 | define stream TelemetryInMemorySink(runtime string, requestId string, traceId string, spanId string, 34 | parentSpanId string, sourceNamespace string, sourceInstance string, 35 | sourceInstanceKind string, sourceComponent string, sourcePod string, 36 | destinationNamespace string, destinationInstance string, 37 | destinationInstanceKind string, destinationComponent string, destinationPod string, 38 | requestPath string, requestMethod string, requestSizeBytes long, responseCode long, 39 | responseDurationNanoSec long, responseSizeBytes long, reporterUID string, 40 | reporterKind string); 41 | 42 | -- Storing the required attributes in a in memory sink (To be accessed from other siddhi apps) 43 | -- When updating the used attributes from the received attributes the stream definitions needs to be updated in all 44 | -- the places where the in memory source is used 45 | 46 | from TelemetryStream[(not sourcePod is null) and (not destinationPod is null)] 47 | insert into TelemetryInMemorySink; 48 | -------------------------------------------------------------------------------- /components/global/portal/io.cellery.observability.ui/src/utils/common/notificationUtils.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, 11 | * software distributed under the License is distributed on an 12 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 13 | * KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations 15 | * under the License. 16 | */ 17 | 18 | import {StateHolder} from "../../components/common/state"; 19 | 20 | class NotificationUtils { 21 | 22 | static Levels = { 23 | INFO: "INFO", 24 | WARNING: "WARNING", 25 | ERROR: "ERROR" 26 | }; 27 | 28 | /** 29 | * Show the loading overlay. 30 | * 31 | * @param {string} message The message to be shown in the loading overlay 32 | * @param {StateHolder} globalState The global state provided to the current component 33 | */ 34 | static showLoadingOverlay = (message, globalState) => { 35 | const prevState = globalState.get(StateHolder.LOADING_STATE); 36 | globalState.set(StateHolder.LOADING_STATE, { 37 | loadingOverlayCount: prevState.loadingOverlayCount + 1, 38 | message: message 39 | }); 40 | }; 41 | 42 | /** 43 | * Hide the loading overlay. 44 | * 45 | * @param {StateHolder} globalState The global state provided to the current component 46 | */ 47 | static hideLoadingOverlay = (globalState) => { 48 | const prevState = globalState.get(StateHolder.LOADING_STATE); 49 | globalState.set(StateHolder.LOADING_STATE, { 50 | loadingOverlayCount: prevState.loadingOverlayCount === 0 ? 0 : prevState.loadingOverlayCount - 1, 51 | message: null 52 | }); 53 | }; 54 | 55 | /** 56 | * Show a notification to the user. 57 | * 58 | * @param {string} message The message to be shown in the notification 59 | * @param {string} level The notification level 60 | * @param {StateHolder} globalState The global state provided to the current component 61 | */ 62 | static showNotification = (message, level, globalState) => { 63 | globalState.set(StateHolder.NOTIFICATION_STATE, { 64 | isOpen: true, 65 | message: message, 66 | notificationLevel: level 67 | }); 68 | }; 69 | 70 | /** 71 | * Close the notification shown to the user. 72 | * 73 | * @param {StateHolder} globalState The global state provided to the current component 74 | */ 75 | static closeNotification = (globalState) => { 76 | globalState.set(StateHolder.NOTIFICATION_STATE, { 77 | ...globalState.get(StateHolder.NOTIFICATION_STATE), 78 | isOpen: false 79 | }); 80 | }; 81 | 82 | } 83 | 84 | export default NotificationUtils; 85 | -------------------------------------------------------------------------------- /components/global/observability-agent/pkg/kubeagent/kubeagent.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package kubeagent 20 | 21 | import ( 22 | "encoding/json" 23 | "fmt" 24 | 25 | meshv1alpha2 "cellery.io/cellery-controller/pkg/generated/informers/externalversions/mesh/v1alpha2" 26 | meshv1alpha2listers "cellery.io/cellery-controller/pkg/generated/listers/mesh/v1alpha2" 27 | "go.uber.org/zap" 28 | corev1 "k8s.io/client-go/informers/core/v1" 29 | "k8s.io/client-go/tools/cache" 30 | ) 31 | 32 | type ResourceWatcher struct { 33 | podInformer corev1.PodInformer 34 | componentInformer meshv1alpha2.ComponentInformer 35 | cellLister meshv1alpha2listers.CellLister 36 | compositeLister meshv1alpha2listers.CompositeLister 37 | buffer chan string 38 | logger *zap.SugaredLogger 39 | } 40 | 41 | func New( 42 | podInformer corev1.PodInformer, 43 | componentInformer meshv1alpha2.ComponentInformer, 44 | cellInformer meshv1alpha2.CellInformer, 45 | compositeInformer meshv1alpha2.CompositeInformer, 46 | buffer chan string, 47 | logger *zap.SugaredLogger, 48 | ) *ResourceWatcher { 49 | rw := &ResourceWatcher{ 50 | podInformer: podInformer, 51 | componentInformer: componentInformer, 52 | cellLister: cellInformer.Lister(), 53 | compositeLister: compositeInformer.Lister(), 54 | buffer: buffer, 55 | logger: logger.Named("kubeagent"), 56 | } 57 | rw.podInformer.Informer().AddEventHandler(cache.FilteringResourceEventHandler{ 58 | FilterFunc: FilterWithInstanceLabel(), 59 | Handler: HandleAll(PodMapper, rw.write, rw.logger.Named("pod").With().Warnf), 60 | }) 61 | rw.componentInformer.Informer().AddEventHandler(HandleAll(ComponentMapper(rw.cellLister, rw.compositeLister), rw.write, rw.logger.Named("cell").Warnf)) 62 | return rw 63 | } 64 | 65 | func (rw *ResourceWatcher) Run(stopCh <-chan struct{}) error { 66 | if ok := cache.WaitForCacheSync(stopCh, 67 | //rw.podInformer.Informer().HasSynced, 68 | rw.componentInformer.Informer().HasSynced, 69 | ); !ok { 70 | return fmt.Errorf("failed to wait for caches to sync") 71 | } 72 | rw.logger.Info("Resource watcher stared successfully") 73 | return nil 74 | } 75 | 76 | func (rw *ResourceWatcher) write(attr Attributes) { 77 | jsonBytes, err := json.Marshal(attr) 78 | if err != nil { 79 | rw.logger.Errorf("cannot marshal attributes to json: %v", err) 80 | return 81 | } 82 | dataStr := string(jsonBytes) 83 | rw.logger.Debugf("Writing event to buffer: %s", dataStr) 84 | rw.buffer <- dataStr 85 | } 86 | -------------------------------------------------------------------------------- /components/global/observability-agent/pkg/writer/writer.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package writer 20 | 21 | import ( 22 | "fmt" 23 | "strings" 24 | "time" 25 | 26 | "go.uber.org/zap" 27 | 28 | "cellery.io/cellery-observability/components/global/observability-agent/pkg/store" 29 | ) 30 | 31 | type ( 32 | Writer struct { 33 | WaitingTimeSec int 34 | WaitingSize int 35 | Logger *zap.SugaredLogger 36 | Buffer chan string 37 | LastWrittenTime time.Time 38 | Persister store.Persister 39 | } 40 | ) 41 | 42 | func (writer *Writer) Run(stopCh <-chan struct{}) { 43 | writer.Logger.Info("Writer started") 44 | for { 45 | select { 46 | case <-stopCh: 47 | writer.flushBuffer() 48 | return 49 | default: 50 | if writer.shouldWrite() { 51 | err := writer.write() 52 | if err != nil { 53 | writer.Logger.Errorf("Received an error while writing : %v", err) 54 | } 55 | } else { 56 | time.Sleep(5 * time.Second) 57 | } 58 | } 59 | } 60 | } 61 | 62 | func (writer *Writer) write() error { 63 | elements := writer.getElements() 64 | str := fmt.Sprintf("[%s]", strings.Join(elements, ",")) 65 | err := writer.Persister.Write(str) 66 | if err != nil { 67 | writer.restore(elements) 68 | return err 69 | } 70 | return nil 71 | } 72 | 73 | func (writer *Writer) flushBuffer() { 74 | for { 75 | if len(writer.Buffer) == 0 { 76 | return 77 | } 78 | err := writer.write() 79 | if err != nil { 80 | writer.Logger.Errorf("Received an error while writing : %v", err) 81 | } 82 | } 83 | } 84 | 85 | func (writer *Writer) shouldWrite() bool { 86 | if (len(writer.Buffer) > 0) && (len(writer.Buffer) >= writer.WaitingSize || time.Since(writer.LastWrittenTime) > 87 | time.Duration(writer.WaitingTimeSec)*time.Second) { 88 | writer.Logger.Debugf("Time since the previous write : %s", time.Since(writer.LastWrittenTime)) 89 | writer.LastWrittenTime = time.Now() 90 | return true 91 | } else { 92 | return false 93 | } 94 | } 95 | 96 | func (writer *Writer) getElements() []string { 97 | var elements []string 98 | for i := 0; i < writer.WaitingSize; i++ { 99 | element := <-writer.Buffer 100 | if element == "" { 101 | if len(writer.Buffer) == 0 { 102 | break 103 | } 104 | continue 105 | } 106 | elements = append(elements, element) 107 | if len(writer.Buffer) == 0 { 108 | break 109 | } 110 | } 111 | return elements 112 | } 113 | 114 | func (writer *Writer) restore(elements []string) { 115 | for _, element := range elements { 116 | writer.Buffer <- element 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /components/global/portal/io.cellery.observability.ui/src/icons/NodeIcon.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import React from "react"; 18 | import SvgIcon from "@material-ui/core/SvgIcon"; 19 | 20 | const NodeIcon = (props) => ( 21 | 22 | 44 | 45 | ); 46 | 47 | export default NodeIcon; 48 | -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.tracing.synapse.handler/src/main/java/io/cellery/observability/tracing/synapse/handler/Constants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package io.cellery.observability.tracing.synapse.handler; 20 | 21 | /** 22 | * Synapse handler related Constants. 23 | */ 24 | public class Constants { 25 | public static final String ZIPKIN_HOST_ENV_VAR = "ZIPKIN_HOST"; 26 | public static final String ZIPKIN_PORT_ENV_VAR = "ZIPKIN_PORT"; 27 | public static final String ZIPKIN_API_CONTEXT_ENV_VAR = "ZIPKIN_API_CONTEXT"; 28 | public static final String CELLERY_TRACING_SERVICE_NAME_ENV_VAR = "CELLERY_TRACING_SERVICE_NAME"; 29 | public static final String CELLERY_TRACING_NAMESPACE_ENV_VAR = "CELLERY_TRACING_NAMESPACE"; 30 | public static final String ZIPKIN_HOST_DEFAULT_VALUE = "wso2sp-worker.cellery-system"; 31 | public static final int ZIPKIN_PORT_DEFAULT_VALUE = 9411; 32 | public static final String ZIPKIN_API_CONTEXT_DEFAULT_VALUE = "/api/v1/spans"; 33 | public static final String CELLERY_TRACING_SERVICE_NAME_DEFAULT_VALUE = "global-gateway"; 34 | 35 | public static final String TRACING_CORRELATION_ID = "TRACING_CORRELATION_ID"; 36 | public static final boolean TRACING_SENDER_COMPRESSION_ENABLED = false; 37 | public static final String B3_GLOBAL_GATEWAY_CORRELATION_ID_HEADER = "X-B3-GlobalGatewayCorrelationId"; 38 | 39 | // Tag keys 40 | public static final String TAG_KEY_HTTP_METHOD = "http.method"; 41 | public static final String TAG_KEY_HTTP_URL = "http.url"; 42 | public static final String TAG_KEY_PROTOCOL = "protocol"; 43 | public static final String TAG_KEY_PEER_ADDRESS = "peer.address"; 44 | public static final String TAG_KEY_SPAN_KIND = "span.kind"; 45 | public static final String TAG_KEY_HTTP_STATUS_CODE = "http.status_code"; 46 | public static final String TAG_KEY_ERROR = "error"; 47 | 48 | // Tag values 49 | public static final String SPAN_KIND_CLIENT = "client"; 50 | public static final String SPAN_KIND_SERVER = "server"; 51 | 52 | // Synapse message context properties 53 | public static final String SYNAPSE_MESSAGE_CONTEXT_PROPERTY_HTTP_METHOD = "REST_METHOD"; 54 | public static final String SYNAPSE_MESSAGE_CONTEXT_PROPERTY_ENDPOINT = "ENDPOINT_ADDRESS"; 55 | public static final String SYNAPSE_MESSAGE_CONTEXT_PROPERTY_PEER_ADDRESS = "api.ut.hostName"; 56 | public static final String SYNAPSE_MESSAGE_CONTEXT_PROPERTY_TRANSPORT = "TRANSPORT_IN_NAME"; 57 | 58 | // Axis2 message context properties 59 | public static final String AXIS2_MESSAGE_CONTEXT_PROPERTY_HTTP_STATUS_CODE = "HTTP_SC"; 60 | public static final String AXIS2_MESSAGE_CONTEXT_PROPERTY_HTTP_METHOD = "HTTP_METHOD"; 61 | public static final String AXIS2_MESSAGE_CONTEXT_PROPERTY_REMOTE_HOST = "REMOTE_HOST"; 62 | } 63 | -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.telemetry.deduplicator/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 22 | io.cellery.observability.core 23 | io.cellery.observability 24 | 0.6.2-SNAPSHOT 25 | 26 | 27 | 4.0.0 28 | io.cellery.observability.telemetry.deduplicator 29 | 0.6.2-SNAPSHOT 30 | Cellery Observability Components - Global Plane - Core - Deduplicator 31 | bundle 32 | 33 | 34 | 35 | org.wso2.siddhi 36 | siddhi-core 37 | 38 | 39 | org.wso2.siddhi 40 | siddhi-query-api 41 | 42 | 43 | org.wso2.siddhi 44 | siddhi-annotations 45 | 46 | 47 | 48 | 49 | org.testng 50 | testng 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | org.apache.felix 59 | maven-bundle-plugin 60 | true 61 | 62 | 63 | ${project.artifactId} 64 | ${project.artifactId} 65 | 66 | io.cellery.observability.telemetry.deduplicator.*, 67 | 68 | 69 | *;resolution:=optional 70 | 71 | 72 | META-INF=target/classes/META-INF 73 | 74 | * 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /components/global/portal/io.cellery.observability.ui/src/utils/api/authUtils.test.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | import AuthUtils from "./authUtils"; 20 | import {StateHolder} from "../../components/common/state"; 21 | 22 | describe("AuthUtils", () => { 23 | const username = "User1"; 24 | const loggedInUser = { 25 | username: username, 26 | accessToken: "12345", 27 | idToken: "54321" 28 | }; 29 | afterEach(() => { 30 | localStorage.removeItem(StateHolder.USER); 31 | }); 32 | 33 | describe("signIn()", () => { 34 | it("should set the username provided", () => { 35 | const stateHolder = new StateHolder(); 36 | const spy = jest.spyOn(stateHolder, "set"); 37 | AuthUtils.signIn(loggedInUser, stateHolder); 38 | 39 | expect(spy).toHaveBeenCalledTimes(1); 40 | expect(spy).toHaveBeenCalledWith(StateHolder.USER, loggedInUser); 41 | expect(localStorage.getItem(StateHolder.USER)).toBe(JSON.stringify(loggedInUser)); 42 | }); 43 | 44 | it("should not set a username and should throw and error", () => { 45 | const stateHolder = new StateHolder(); 46 | const spy = jest.spyOn(stateHolder, "set"); 47 | 48 | expect(() => AuthUtils.signIn(null, stateHolder)).toThrow(); 49 | expect(() => AuthUtils.signIn(undefined, stateHolder)).toThrow(); 50 | expect(() => AuthUtils.signIn("", stateHolder)).toThrow(); 51 | expect(spy).toHaveBeenCalledTimes(0); 52 | expect(spy).not.toHaveBeenCalled(); 53 | expect(localStorage.getItem(StateHolder.USER)).toBeNull(); 54 | }); 55 | }); 56 | 57 | describe("signOut()", () => { 58 | it("should unset the user in the state", () => { 59 | const stateHolder = new StateHolder(); 60 | localStorage.setItem(StateHolder.USER, JSON.stringify(loggedInUser)); 61 | stateHolder.state[StateHolder.USER] = { 62 | value: {...loggedInUser}, 63 | listeners: [] 64 | }; 65 | stateHolder.state[StateHolder.CONFIG] = { 66 | value: { 67 | idp: { 68 | idpURL: "http://test-url", 69 | callBackURL: "http://test-callbak-url" 70 | } 71 | }, 72 | listener: [] 73 | }; 74 | AuthUtils.signOut(stateHolder); 75 | expect(localStorage.getItem(StateHolder.USER)).toBeNull(); 76 | }); 77 | }); 78 | 79 | describe("getAuthenticatedUser()", () => { 80 | localStorage.setItem(StateHolder.USER, JSON.stringify(loggedInUser)); 81 | const user = AuthUtils.getAuthenticatedUser(); 82 | 83 | expect(user).toEqual({...user}); 84 | }); 85 | }); 86 | -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.model.generator/src/test/java/io/cellery/observability/model/generator/model/NodeTestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package io.cellery.observability.model.generator.model; 20 | 21 | import org.testng.Assert; 22 | import org.testng.annotations.Test; 23 | 24 | /** 25 | * Node related test cases. 26 | */ 27 | public class NodeTestCase { 28 | 29 | @Test 30 | public void testNodeEquality() { 31 | Node nodeA = new Node("test-namespace", "test-instance", "test-component"); 32 | nodeA.setInstanceKind("Cell"); 33 | Node nodeB = new Node("test-namespace", "test-instance", "test-component"); 34 | nodeB.setInstanceKind("Cell"); 35 | Assert.assertEquals(nodeA, nodeB); 36 | } 37 | 38 | @Test 39 | public void testNodeEqualityWithMismatchedInstanceKind() { 40 | Node nodeA = new Node("test-namespace", "test-instance", "test-component"); 41 | nodeA.setInstanceKind("Cell"); 42 | Node nodeB = new Node("test-namespace", "test-instance", "test-component"); 43 | nodeB.setInstanceKind("Composite"); 44 | Assert.assertEquals(nodeA, nodeB); 45 | } 46 | 47 | @Test 48 | public void testNodeInEqualityWithMismatchedNamespace() { 49 | Node nodeA = new Node("test-namespace", "test-instance", "test-component"); 50 | nodeA.setInstanceKind("Cell"); 51 | Node nodeB = new Node("different-namespace", "test-instance", "test-component"); 52 | nodeB.setInstanceKind("Cell"); 53 | Assert.assertNotEquals(nodeA, nodeB); 54 | } 55 | 56 | @Test 57 | public void testNodeInEqualityWithMismatchedInstance() { 58 | Node nodeA = new Node("test-namespace", "test-instance", "test-component"); 59 | nodeA.setInstanceKind("Cell"); 60 | Node nodeB = new Node("test-namespace", "different-instance", "test-component"); 61 | nodeB.setInstanceKind("Cell"); 62 | Assert.assertNotEquals(nodeA, nodeB); 63 | } 64 | 65 | @Test 66 | public void testNodeInEqualityWithMismatchedComponent() { 67 | Node nodeA = new Node("test-namespace", "test-instance", "test-component"); 68 | nodeA.setInstanceKind("Cell"); 69 | Node nodeB = new Node("test-namespace", "test-instance", "different-component"); 70 | nodeB.setInstanceKind("Cell"); 71 | Assert.assertNotEquals(nodeA, nodeB); 72 | } 73 | 74 | @Test 75 | public void testNodeFQN() { 76 | Node nodeA = new Node("test-namespace", "test-instance", "test-component"); 77 | nodeA.setInstanceKind("Cell"); 78 | Assert.assertEquals(Model.getNodeFQN(nodeA), nodeA.getFQN()); 79 | 80 | Node nodeB = new Node("test-namespace", "test-instance", "test-component"); 81 | nodeB.setInstanceKind("Composite"); 82 | Assert.assertEquals(Model.getNodeFQN(nodeB), nodeB.getFQN()); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.api/src/test/java/io/cellery/observability/api/siddhi/SiddhiStoreQueryManagerTestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package io.cellery.observability.api.siddhi; 20 | 21 | import io.cellery.observability.api.internal.ServiceHolder; 22 | import org.mockito.Mockito; 23 | import org.powermock.core.classloader.annotations.PowerMockIgnore; 24 | import org.powermock.core.classloader.annotations.PrepareForTest; 25 | import org.powermock.modules.testng.PowerMockObjectFactory; 26 | import org.powermock.reflect.Whitebox; 27 | import org.testng.IObjectFactory; 28 | import org.testng.annotations.AfterMethod; 29 | import org.testng.annotations.BeforeMethod; 30 | import org.testng.annotations.ObjectFactory; 31 | import org.testng.annotations.Test; 32 | import org.wso2.siddhi.core.SiddhiAppRuntime; 33 | import org.wso2.siddhi.core.SiddhiManager; 34 | 35 | /** 36 | * Test Cases for Siddhi Store Query Manager. 37 | */ 38 | @PrepareForTest(SiddhiStoreQueryManager.class) 39 | @PowerMockIgnore("org.apache.log4j.*") 40 | public class SiddhiStoreQueryManagerTestCase { 41 | 42 | private SiddhiStoreQueryManager siddhiStoreQueryManager; 43 | private SiddhiManager siddhiManager; 44 | private SiddhiAppRuntime internalSiddhiAppRuntime; 45 | 46 | @ObjectFactory 47 | public IObjectFactory getObjectFactory() { 48 | return new PowerMockObjectFactory(); 49 | } 50 | 51 | @BeforeMethod 52 | public void init() { 53 | String siddhiAppString = Whitebox.getInternalState(SiddhiStoreQueryManager.class, "SIDDHI_APP"); 54 | internalSiddhiAppRuntime = Mockito.mock(SiddhiAppRuntime.class); 55 | 56 | siddhiManager = Mockito.mock(SiddhiManager.class); 57 | Mockito.when(siddhiManager.createSiddhiAppRuntime(siddhiAppString)) 58 | .thenReturn(internalSiddhiAppRuntime); 59 | ServiceHolder.setSiddhiManager(siddhiManager); 60 | 61 | siddhiStoreQueryManager = new SiddhiStoreQueryManager(); 62 | } 63 | 64 | @AfterMethod 65 | public void cleanUp() { 66 | ServiceHolder.setSiddhiManager(null); 67 | } 68 | 69 | @Test 70 | public void testInitialization() throws Exception { 71 | String siddhiAppString = Whitebox.getInternalState(SiddhiStoreQueryManager.class, "SIDDHI_APP"); 72 | Mockito.verify(siddhiManager, Mockito.times(1)) 73 | .createSiddhiAppRuntime(siddhiAppString); 74 | Mockito.verify(internalSiddhiAppRuntime, Mockito.times(1)).start(); 75 | } 76 | 77 | @Test 78 | public void testQuery() { 79 | siddhiStoreQueryManager.query("test"); 80 | Mockito.verify(internalSiddhiAppRuntime, Mockito.times(1)).query("test"); 81 | } 82 | 83 | @Test 84 | public void testShutdown() { 85 | siddhiStoreQueryManager.stop(); 86 | Mockito.verify(internalSiddhiAppRuntime, Mockito.times(1)).shutdown(); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /components/global/core/io.cellery.observability.api/src/main/java/io/cellery/observability/api/AuthAPI.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package io.cellery.observability.api; 20 | 21 | import com.google.gson.JsonObject; 22 | import com.google.gson.JsonParser; 23 | import io.cellery.observability.api.exception.APIInvocationException; 24 | import io.cellery.observability.api.internal.ServiceHolder; 25 | import io.cellery.observability.auth.AuthUtils; 26 | import org.apache.oltu.oauth2.client.response.OAuthAccessTokenResponse; 27 | 28 | import java.util.HashMap; 29 | import java.util.Map; 30 | import javax.ws.rs.GET; 31 | import javax.ws.rs.OPTIONS; 32 | import javax.ws.rs.Path; 33 | import javax.ws.rs.PathParam; 34 | import javax.ws.rs.Produces; 35 | import javax.ws.rs.core.NewCookie; 36 | import javax.ws.rs.core.Response; 37 | 38 | /** 39 | * MSF4J service for Authentication services. 40 | * 41 | * All endpoints in this API are unauthenticated 42 | */ 43 | @Path("/api/auth") 44 | public class AuthAPI { 45 | private static final JsonParser jsonParser = new JsonParser(); 46 | 47 | @GET 48 | @Path("/tokens/{authCode}") 49 | @Produces("application/json") 50 | public Response getTokens(@PathParam("authCode") String authCode) throws APIInvocationException { 51 | try { 52 | OAuthAccessTokenResponse oAuthResponse = AuthUtils.exchangeAuthCode(authCode); 53 | JsonObject jsonObj = jsonParser.parse(oAuthResponse.getBody()).getAsJsonObject(); 54 | String accessToken = oAuthResponse.getAccessToken(); 55 | String idToken = jsonObj.get(Constants.ID_TOKEN).getAsString(); 56 | 57 | final int mid = accessToken.length() / 2; 58 | 59 | Map responseMap = new HashMap<>(); 60 | responseMap.put(Constants.ACCESS_TOKEN, accessToken.substring(0, mid)); 61 | responseMap.put(Constants.ID_TOKEN, idToken); 62 | 63 | NewCookie cookie = new NewCookie(Constants.HTTP_ONLY_SESSION_COOKIE, accessToken.substring(mid), 64 | "/", "", "", 3600, false, true); 65 | 66 | return Response.ok().cookie(cookie).entity(responseMap).build(); 67 | } catch (Throwable e) { 68 | throw new APIInvocationException("Error while getting tokens from token endpoint", e); 69 | } 70 | } 71 | 72 | @GET 73 | @Path("/client-id") 74 | @Produces("application/json") 75 | public Response getCredentials() throws APIInvocationException { 76 | try { 77 | return Response.ok().entity(ServiceHolder.getDcrProvider().getClientId()).build(); 78 | } catch (Throwable e) { 79 | throw new APIInvocationException("Error while getting Client ID for Observability Portal", e); 80 | } 81 | } 82 | 83 | @OPTIONS 84 | @Path(".*") 85 | public Response getOptions() { 86 | return Response.ok().build(); 87 | } 88 | 89 | } 90 | -------------------------------------------------------------------------------- /components/global/portal/io.cellery.observability.ui/src/components/common/color/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | /* eslint react/prefer-stateless-function: ["off"] */ 20 | 21 | import ColorGenerator from "./colorGenerator"; 22 | import React from "react"; 23 | import * as PropTypes from "prop-types"; 24 | 25 | // Creating a context that can be accessed 26 | const ColorContext = React.createContext(null); 27 | 28 | /** 29 | * Color Provider to provide the color generator. 30 | * 31 | * @param {Object} props Props passed into the color provider 32 | * @constructor 33 | */ 34 | class ColorProvider extends React.Component { 35 | 36 | constructor(props) { 37 | super(props); 38 | 39 | const colorGenerator = new ColorGenerator(); 40 | this.state = { 41 | colorGenerator: colorGenerator 42 | }; 43 | colorGenerator.addListener(this.handleColorChange); 44 | } 45 | 46 | handleColorChange = () => { 47 | this.state.colorGenerator.removeListener(this.handleColorChange); 48 | 49 | // Adding the new color generator 50 | const colorGenerator = new ColorGenerator(); 51 | this.setState({ 52 | colorGenerator: colorGenerator 53 | }); 54 | colorGenerator.addListener(this.handleColorChange); 55 | }; 56 | 57 | componentWillUnmount() { 58 | this.state.colorGenerator.removeListener(this.handleColorChange); 59 | } 60 | 61 | render = () => { 62 | const {children} = this.props; 63 | const {colorGenerator} = this.state; 64 | 65 | return ( 66 | 67 | {children} 68 | 69 | ); 70 | }; 71 | 72 | } 73 | 74 | ColorProvider.propTypes = { 75 | children: PropTypes.any.isRequired 76 | }; 77 | 78 | /** 79 | * Higher Order Component for accessing the Color Generator. 80 | * 81 | * @param {React.ComponentType} Component component which needs access to the color generator. 82 | * @returns {React.ComponentType} The new HOC with access to the color generator. 83 | */ 84 | const withColor = (Component) => { 85 | class ColorGeneratorProvider extends React.Component { 86 | 87 | render() { 88 | const {forwardedRef, ...otherProps} = this.props; 89 | 90 | return ( 91 | 92 | {(colorGenerator) => ( 93 | 94 | )} 95 | 96 | ); 97 | } 98 | 99 | } 100 | 101 | return React.forwardRef((props, ref) => ); 102 | }; 103 | 104 | export default withColor; 105 | export {ColorProvider, ColorGenerator}; 106 | -------------------------------------------------------------------------------- /components/global/observability-agent/pkg/config/config_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package config 20 | 21 | import ( 22 | "io/ioutil" 23 | "os" 24 | "path/filepath" 25 | "testing" 26 | ) 27 | 28 | var ( 29 | testStr = "{" + 30 | "\r\n \"mixer\": {" + 31 | "\r\n \"tls\": {" + 32 | "\r\n \"certificate\": \"\"," + 33 | "\r\n \"privateKey\": \"\"," + 34 | "\r\n \"caCertificate\": \"\"" + 35 | "\r\n }" + 36 | "\r\n }," + 37 | "\r\n \"spEndpoint\": {" + 38 | "\r\n \"url\": \"http://wso2sp-worker.cellery-system.svc.cluster.local:9091\"," + 39 | "\r\n \"sendIntervalSeconds\": 60" + 40 | "\r\n }," + 41 | "\r\n \"store\": {" + 42 | "\r\n \"fileStorage\": {" + 43 | "\r\n \"path\": \"/mnt/observability-metrics\"" + 44 | "\r\n }," + 45 | "\r\n \"database\": {" + 46 | "\r\n \"host\": \"wso2apim-with-analytics-rdbms-service.cellery-system.svc.cluster.local\"," + 47 | "\r\n \"port\": 3306," + 48 | "\r\n \"protocol\": \"tcp\"," + 49 | "\r\n \"username\": \"root\"," + 50 | "\r\n \"password\": \"root\"," + 51 | "\r\n \"name\": \"PERSISTENCE\"" + 52 | "\r\n }," + 53 | "\r\n \"inMemory\": {}" + 54 | "\r\n }," + 55 | "\r\n \"advanced\": {" + 56 | "\r\n \"accessToken\": \"test-token\"," + 57 | "\r\n \"runtimeId\": \"cellery-test\"," + 58 | "\r\n \"maxRecordsForSingleWrite\": 100," + 59 | "\r\n \"bufferSizeFactor\": 100," + 60 | "\r\n \"bufferTimeoutSeconds\": 60" + 61 | "\r\n }" + 62 | "\r\n}" 63 | ) 64 | 65 | func TestNewWithCorrectFile(t *testing.T) { 66 | _ = ioutil.WriteFile("./config.json", []byte(testStr), 0644) 67 | _, err := New("./config.json") 68 | if err != nil { 69 | t.Errorf("Unexpected error occurred : %v", err) 70 | } 71 | files, _ := filepath.Glob("./*.json") 72 | for _, fname := range files { 73 | err = os.Remove(fname) 74 | } 75 | } 76 | 77 | func TestNewWithEmptyFile(t *testing.T) { 78 | _ = ioutil.WriteFile("./config.json", []byte(""), 0644) 79 | _, err := New("./config.json") 80 | expectedErr := "could not unmarshal the config file : unexpected end of JSON input" 81 | if err == nil { 82 | t.Errorf("An error was not thrown, but expected : %s", expectedErr) 83 | return 84 | } 85 | if err.Error() != expectedErr { 86 | t.Errorf("Expected error was not thrown, received error : %v", err) 87 | } 88 | files, _ := filepath.Glob("./*.json") 89 | for _, fname := range files { 90 | err = os.Remove(fname) 91 | } 92 | } 93 | 94 | func TestNewWithNoFile(t *testing.T) { 95 | _, err := New("./config.json") 96 | expectedErr := "could not read the config file : open ./config.json: no such file or directory" 97 | if err == nil { 98 | t.Errorf("An error was not thrown, but expected : %s", expectedErr) 99 | return 100 | } 101 | if err.Error() != expectedErr { 102 | t.Errorf("Expected error was not thrown, received error : %v", err) 103 | } 104 | } 105 | --------------------------------------------------------------------------------