-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from crshanks/crshanks-add-obfuscation
Add obfuscation example and sharedflow
- Loading branch information
Showing
22 changed files
with
527 additions
and
4 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
...ewrelic-trace-and-metric-and-log-obfuscate/apiproxy/newrelic-trace-and-metric-and-log.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<APIProxy revision="1" name="newrelic-trace-and-metric-and-log-obfuscate"> | ||
<DisplayName/> | ||
<Description/> | ||
<Policies/> | ||
<ProxyEndpoints> | ||
<ProxyEndpoint>default</ProxyEndpoint> | ||
</ProxyEndpoints> | ||
<Resources/> | ||
<TargetEndpoints> | ||
<TargetEndpoint>backend</TargetEndpoint> | ||
</TargetEndpoints> | ||
</APIProxy> |
6 changes: 6 additions & 0 deletions
6
...es/newrelic-trace-and-metric-and-log-obfuscate/apiproxy/policies/FC-NRInstrumentation.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<FlowCallout continueOnError="true" enabled="true" name="FC-NRInstrumentationObfuscate"> | ||
<DisplayName>FC-NRInstrumentationObfuscate</DisplayName> | ||
<Parameters/> | ||
<SharedFlowBundle>nr-instrumentation-obfuscate-sharedflow</SharedFlowBundle> | ||
</FlowCallout> |
6 changes: 6 additions & 0 deletions
6
examples/newrelic-trace-and-metric-and-log-obfuscate/apiproxy/policies/FC-NRLogAPI.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<FlowCallout continueOnError="true" enabled="true" name="FC-NRLogAPI"> | ||
<DisplayName>FC-NRLogAPI</DisplayName> | ||
<Parameters/> | ||
<SharedFlowBundle>nr-log-api-sharedflow</SharedFlowBundle> | ||
</FlowCallout> |
6 changes: 6 additions & 0 deletions
6
examples/newrelic-trace-and-metric-and-log-obfuscate/apiproxy/policies/FC-NRMetricAPI.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<FlowCallout continueOnError="true" enabled="true" name="FC-NRMetricAPI"> | ||
<DisplayName>FC-NRMetricAPI</DisplayName> | ||
<Parameters/> | ||
<SharedFlowBundle>nr-metric-api-sharedflow</SharedFlowBundle> | ||
</FlowCallout> |
6 changes: 6 additions & 0 deletions
6
examples/newrelic-trace-and-metric-and-log-obfuscate/apiproxy/policies/FC-NRTraceAPI.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<FlowCallout continueOnError="true" enabled="true" name="FC-NRTraceAPI"> | ||
<DisplayName>FC-NRTraceAPI</DisplayName> | ||
<Parameters/> | ||
<SharedFlowBundle>nr-trace-api-sharedflow</SharedFlowBundle> | ||
</FlowCallout> |
35 changes: 35 additions & 0 deletions
35
examples/newrelic-trace-and-metric-and-log-obfuscate/apiproxy/proxies/default.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<ProxyEndpoint name="default"> | ||
<PreFlow name="PreFlow"> | ||
<Request/> | ||
<Response/> | ||
</PreFlow> | ||
<Flows/> | ||
<PostFlow name="PostFlow"> | ||
<Request/> | ||
<Response> | ||
<Step> | ||
<Name>FC-NRInstrumentationObfuscate</Name> | ||
</Step> | ||
</Response> | ||
</PostFlow> | ||
<PostClientFlow name="PostClientFlow"> | ||
<Response> | ||
<Step> | ||
<Name>FC-NRTraceAPI</Name> | ||
</Step> | ||
<Step> | ||
<Name>FC-NRMetricAPI</Name> | ||
</Step> | ||
<Step> | ||
<Name>FC-NRLogAPI</Name> | ||
</Step> | ||
</Response> | ||
</PostClientFlow> | ||
<HTTPProxyConnection> | ||
<BasePath>/swapi/trace-and-metric-and-log-obfuscate</BasePath> | ||
</HTTPProxyConnection> | ||
<RouteRule name="backend"> | ||
<TargetEndpoint>backend</TargetEndpoint> | ||
</RouteRule> | ||
</ProxyEndpoint> |
5 changes: 5 additions & 0 deletions
5
examples/newrelic-trace-and-metric-and-log-obfuscate/apiproxy/targets/backend.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<TargetEndpoint name="backend"> | ||
<HTTPTargetConnection> | ||
<URL>replaced_by_config_json</URL> | ||
</HTTPTargetConnection> | ||
</TargetEndpoint> |
30 changes: 30 additions & 0 deletions
30
examples/newrelic-trace-and-metric-and-log-obfuscate/config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"configurations": [ | ||
{ | ||
"name": "test", | ||
"policies": [], | ||
"proxies": [ | ||
{ | ||
"name": "default.xml", | ||
"tokens": [ | ||
{ | ||
"xpath": "/ProxyEndpoint/HTTPProxyConnection/BasePath", | ||
"value": "/newrelic/trace-and-metric-and-log-obfuscate" | ||
} | ||
] | ||
} | ||
], | ||
"targets": [ | ||
{ | ||
"name": "backend.xml", | ||
"tokens": [ | ||
{ | ||
"xpath": "/TargetEndpoint/HTTPTargetConnection/URL", | ||
"value": "https://swapi.dev/api/people/1/?format=json" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} |
5 changes: 5 additions & 0 deletions
5
examples/newrelic-trace-and-metric-and-log-obfuscate/deploy.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
ORG=${APIGEE_ORG:-"default here if not set as an env variable"} | ||
ENV=${APIGEE_ENV:-"default here if not set as an env variable"} | ||
|
||
mvn clean install -Ptest -Dorg=$ORG -Denv=$ENV -Dbearer=$(gcloud auth print-access-token) |
24 changes: 24 additions & 0 deletions
24
examples/newrelic-trace-and-metric-and-log-obfuscate/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<!-- Copyright (C) 2014 Apigee Corporation Licensed under the Apache License, | ||
Version 2.0 (the "License"); you may not use this file except in compliance | ||
with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software distributed | ||
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES | ||
OR CONDITIONS OF ANY KIND, either express or implied. See the License for | ||
the specific language governing permissions and limitations under the License. --> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>parent-pom</artifactId> | ||
<groupId>com.newrelic.apigee</groupId> | ||
<version>1.0</version> | ||
<relativePath>../shared-pom.xml</relativePath> | ||
</parent> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.newrelic.apigee</groupId> | ||
<artifactId>newrelic-trace-and-metric-and-log-obfuscate</artifactId> | ||
<version>1.0</version> | ||
<name>newrelic-trace-and-metric-and-log-obfuscate</name> | ||
<packaging>pom</packaging> | ||
</project> |
22 changes: 22 additions & 0 deletions
22
sharedflows/src/gateway/nr-instrumentation-obfuscate-sharedflow/config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"configurations": [ | ||
{ | ||
"name": "test", | ||
"policies": [ | ||
{ | ||
"name": "JS-NRInstrumentationObfuscate.xml", | ||
"tokens": [ | ||
{ | ||
"xpath": "/Javascript/Properties/Property[@name='tracesSampler']", | ||
"value": "parentbased_always_on" | ||
}, | ||
{ | ||
"xpath": "/Javascript/Properties/Property[@name='tracesSamplerArg']", | ||
"value": 1.0 | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} |
5 changes: 5 additions & 0 deletions
5
sharedflows/src/gateway/nr-instrumentation-obfuscate-sharedflow/deploy.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
ORG=${APIGEE_ORG:-"default here if not set as an env variable"} | ||
ENV=${APIGEE_ENV:-"default here if not set as an env variable"} | ||
|
||
mvn clean install -Ptest -Dorg=$ORG -Denv=$ENV -Dbearer=$(gcloud auth print-access-token) |
33 changes: 33 additions & 0 deletions
33
sharedflows/src/gateway/nr-instrumentation-obfuscate-sharedflow/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<!-- | ||
Copyright (C) 2014 Apigee Corporation | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>parent-pom</artifactId> | ||
<groupId>com.newrelic.apigee</groupId> | ||
<version>1.0</version> | ||
<relativePath>../parent-sharedflow-pom.xml</relativePath> | ||
</parent> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.newrelic.apigee</groupId> | ||
<artifactId>nr-instrumentation-obfuscate-sharedflow</artifactId> | ||
<version>1.0</version> | ||
<name>nr-instrumentation-obfuscate-sharedflow</name> | ||
<packaging>pom</packaging> | ||
</project> |
14 changes: 14 additions & 0 deletions
14
...ntation-obfuscate-sharedflow/sharedflowbundle/nr-instrumentation-obfuscate-sharedflow.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<SharedFlowBundle revision="1" name="nr-instrumentation-obfuscate-sharedflow"> | ||
<DisplayName>nr-instrumentation-obfuscate-sharedflow</DisplayName> | ||
<Description>Shared flow to prepare New Relic Trace API distributed tracing and Metric API metrics</Description> | ||
<Policies> | ||
<Policy>JS-NRInstrumentationObfuscate</Policy> | ||
</Policies> | ||
<Resources> | ||
<Resource>jsc://JS-NRInstrumentationObfuscate.js</Resource> | ||
</Resources> | ||
<SharedFlows> | ||
<SharedFlow>default</SharedFlow> | ||
</SharedFlows> | ||
</SharedFlowBundle> |
22 changes: 22 additions & 0 deletions
22
...entation-obfuscate-sharedflow/sharedflowbundle/policies/JS-NRInstrumentationObfuscate.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<Javascript async="false" continueOnError="true" enabled="true" timeLimit="200" name="JS-NRInstrumentationObfuscate"> | ||
<DisplayName>JS-NRInstrumentationObfuscate</DisplayName> | ||
<Properties> | ||
<!-- | ||
Tracer sampler configuration: | ||
- always_on - Sampler that always samples spans, regardless of the parent span’s sampling decision. | ||
- always_off - Sampler that never samples spans, regardless of the parent span’s sampling decision. | ||
- traceidratio - Sampler that samples probabalistically based on rate. | ||
- parentbased_always_on - (default) Sampler that respects its parent span’s sampling decision, but otherwise always samples. | ||
- parentbased_always_off - Sampler that respects its parent span’s sampling decision, but otherwise never samples. | ||
- parentbased_traceidratio - Sampler that respects its parent span’s sampling decision, but otherwise samples probabalistically based on rate. | ||
--> | ||
<Property name='tracesSampler'>replaced_by_config_json</Property> | ||
<!-- | ||
Sampling probability can be set with tracesSamplerArg if the sampler is traceidratio or parentbased_traceidratio. | ||
Rate must be in the range [0.0,1.0]. When not provided rate will be set to 1.0 (maximum rate possible). | ||
--> | ||
<Property name='tracesSamplerArg'>replaced_by_config_json</Property> | ||
</Properties> | ||
<ResourceURL>jsc://NRInstrumentationObfuscate.js</ResourceURL> | ||
</Javascript> |
Oops, something went wrong.