Skip to content

Commit

Permalink
OpenTelemetry@SAP instrumentation
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorwolf committed Feb 12, 2024
1 parent 805594d commit b636d98
Show file tree
Hide file tree
Showing 8 changed files with 158 additions and 44 deletions.
4 changes: 2 additions & 2 deletions HTML5Module/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion HTML5Module/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "html5userapi-ui",
"version": "1.1.19",
"version": "1.1.20",
"description": "",
"engines": {
"node": "^20"
Expand Down
1 change: 1 addition & 0 deletions HTML5Module/webapp/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>HTML5 User API for Cloud Foundry</title>
<meta name="sap.allowlistService" content="/allowlist/service" />
<meta name="sap-ui-fesr" content="/fesr" />
<script
id="sap-ui-bootstrap"
src="https://sapui5.hana.ondemand.com/resources/sap-ui-core.js"
Expand Down
7 changes: 7 additions & 0 deletions approuter/xs-app.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
"target": "$1",
"service": "sap-approuter-userapi"
},
{
"source": "^/fesr$",
"target": "/fesr",
"destination": "html5userapi-srv",
"csrfProtection": false,
"authenticationType": "xsuaa"
},
{
"source": "^/api/(.*)$",
"target": "/api/$1",
Expand Down
79 changes: 38 additions & 41 deletions mta.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
ID: html5userapi
_schema-version: '2.1'
_schema-version: "2.1"
version: 0.2.2
parameters:
enable-parallel-deployments: true

modules:

- name: html5userapi-srv
type: nodejs
path: srv
build-parameters:
ignore: ["node_modules/"]
parameters:
memory: 256M
disk-quota: 1024M
Expand Down Expand Up @@ -112,17 +109,17 @@ modules:
- name: srv_api
group: destinations
properties:
forwardAuthToken: true
strictSSL: false
name: html5userapi-srv
url: ~{url}
forwardAuthToken: true
strictSSL: false
name: html5userapi-srv
url: ~{url}
- name: srv_java_api
group: destinations
properties:
forwardAuthToken: true
strictSSL: false
name: html5userapi-srv-java
url: ~{url}
forwardAuthToken: true
strictSSL: false
name: html5userapi-srv-java
url: ~{url}
- name: html5userapi-deployer
type: com.sap.application.content
path: .
Expand Down Expand Up @@ -150,40 +147,40 @@ modules:
- name: html5userapi-destination-content
type: com.sap.application.content
requires:
- name: html5userapi-uaa
parameters:
service-key:
name: html5userapi-uaa-key
- name: html5userapi-repo-host
parameters:
service-key:
name: html5userapi-repo-host-key
- name: html5userapi-uaa-apiaccess
parameters:
service-key:
name: html5userapi-uaa-apiaccess-key
- name: html5userapi-destination-service
parameters:
content-target: true
- name: html5userapi-connectivity-service
- name: html5userapi-uaa
parameters:
service-key:
name: html5userapi-uaa-key
- name: html5userapi-repo-host
parameters:
service-key:
name: html5userapi-repo-host-key
- name: html5userapi-uaa-apiaccess
parameters:
service-key:
name: html5userapi-uaa-apiaccess-key
- name: html5userapi-destination-service
parameters:
content-target: true
- name: html5userapi-connectivity-service
parameters:
content:
instance:
existing_destinations_policy: update
destinations:
- Name: html5userapi-repo-host
ServiceInstanceName: html5userapi-repo-host
ServiceKeyName: html5userapi-repo-host-key
sap.cloud.service: cloud.service
- Authentication: OAuth2UserTokenExchange
Name: html5userapi-uaa
ServiceInstanceName: html5userapi-uaa
ServiceKeyName: html5userapi-uaa-key
sap.cloud.service: cloud.service
- Authentication: OAuth2ClientCredentials
Name: html5userapi-uaa-apiaccess
ServiceInstanceName: html5userapi-uaa-apiaccess
ServiceKeyName: html5userapi-uaa-apiaccess-key
- Name: html5userapi-repo-host
ServiceInstanceName: html5userapi-repo-host
ServiceKeyName: html5userapi-repo-host-key
sap.cloud.service: cloud.service
- Authentication: OAuth2UserTokenExchange
Name: html5userapi-uaa
ServiceInstanceName: html5userapi-uaa
ServiceKeyName: html5userapi-uaa-key
sap.cloud.service: cloud.service
- Authentication: OAuth2ClientCredentials
Name: html5userapi-uaa-apiaccess
ServiceInstanceName: html5userapi-uaa-apiaccess
ServiceKeyName: html5userapi-uaa-apiaccess-key
build-parameters:
no-source: true

Expand Down
3 changes: 3 additions & 0 deletions srv/express.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// load modules
const express = require("express");
const fesr = require("@sap/fesr-to-otel-js");

// For authentication test
const passport = require("passport");
const xsenv = require("@sap/xsenv");
Expand Down Expand Up @@ -29,6 +31,7 @@ function getJWT(req) {
(async () => {
// create new app
const app = express();
fesr.registerFesrEndpoint(app);
// Authentication using JWT
await app.use(passport.initialize());
await app.use(passport.authenticate("JWT", { session: false }));
Expand Down
105 changes: 105 additions & 0 deletions srv/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions srv/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"node": "^20"
},
"dependencies": {
"@sap/fesr-to-otel-js": "https://73555000100200018064.npmsrv.cdn.repositories.cloud.sap/@sap/fesr-to-otel-js/-/fesr-to-otel-js-1.5.3.tgz",
"@sap-cloud-sdk/http-client": "^3.10.0",
"@sap/xsenv": "^4.2.0",
"@sap/xssec": "^3.6.1",
Expand Down

0 comments on commit b636d98

Please sign in to comment.