-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into gen-sdk-updates
- Loading branch information
Showing
77 changed files
with
40,948 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
a8ec45c8ea4ba559247b654d01b0d35b21a68865 | ||
33f3224cb40e3fa8c56ddb88962e3a4e9319685d | ||
430a1a0a5dd4efe78e21526c37bec9dbce036401 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
HELP.md | ||
.gradle | ||
build/ | ||
!gradle/wrapper/gradle-wrapper.jar | ||
!**/src/main/**/build/ | ||
!**/src/test/**/build/ | ||
**/application.properties | ||
|
||
### STS ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
bin/ | ||
!**/src/main/**/bin/ | ||
!**/src/test/**/bin/ | ||
|
||
### IntelliJ IDEA ### | ||
.idea | ||
*.iws | ||
*.iml | ||
*.ipr | ||
out/ | ||
!**/src/main/**/out/ | ||
!**/src/test/**/out/ | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
|
||
### VS Code ### | ||
.vscode/ |
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 @@ | ||
17.0 |
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 @@ | ||
# Use an official OpenJDK runtime as a base image | ||
FROM openjdk:17-jdk-slim | ||
|
||
ENV DT_PAAS_TOKEN="your PAAS token from Dynatrace (https://docs.dynatrace.com/docs/manage/access-control/access-tokens#paas-token)" | ||
ENV DT_ENVIRONMENT_URL="your environment URL from Dynatrace (https://docs.dynatrace.com/docs/setup-and-configuration/setup-on-container-platforms/docker/set-up-oneagent-on-containers-for-application-only-monitoring#cloud-platforms)" | ||
ENV CTP_CLIENT_SECRET="CTP client secret" | ||
ENV CTP_CLIENT_ID="CTP client ID" | ||
ENV CTP_PROJECT_KEY="CTP project key" | ||
|
||
# Set the working directory inside the container | ||
WORKDIR /app | ||
|
||
# Copy the packaged JAR file into the container at the specified path | ||
COPY build/libs/spring-dynatrace-oneagent-0.0.1-SNAPSHOT.jar /app/spring-dynatrace-oneagent-0.0.1-SNAPSHOT.jar | ||
|
||
# Expose the port that your Spring Boot application will run on | ||
EXPOSE 8080 | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y wget unzip && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# ARGs for Dynatrace OneAgent | ||
|
||
RUN mkdir -p /opt/dynatrace/oneagent && ARCHIVE=$(mktemp) && wget -O $ARCHIVE "https://$DT_ENVIRONMENT_URL.live.dynatrace.com/api/v1/deployment/installer/agent/unix/paas/latest?Api-Token=$DT_PAAS_TOKEN&flavor=default&arch=arm&include=$DT_ONEAGENT_TECHNOLOGY" && unzip -o -d /opt/dynatrace/oneagent $ARCHIVE && rm -f $ARCHIVE | ||
|
||
ENV LD_PRELOAD /opt/dynatrace/oneagent/agent/lib64/liboneagentproc.so | ||
|
||
# Set the entry point to start Dynatrace OneAgent | ||
ENTRYPOINT [ "java", "-jar", "spring-dynatrace-oneagent-0.0.1-SNAPSHOT.jar" ] |
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,40 @@ | ||
# Spring MVC example app | ||
|
||
Example to show how Java SDK can be used in a Spring Boot application with Dynatrace OneAgent monitoring. | ||
|
||
## Requirements | ||
|
||
- A Composable Commerce Project with a configured [API Client](https://docs.commercetools.com/tutorials/getting-started#creating-an-api-client). | ||
Necessary scopes: `view_published_products`, `manage_orders` | ||
- Your Project must have existing products containing variants with SKUs, and at least one customer, the storefront search endpoint must be active. | ||
- If your Project is currently empty, you can install the [SUNRISE sample data](https://docs.commercetools.com/sdk/sunrise-data). | ||
|
||
## Installation | ||
|
||
1. Clone/Download the example folder. | ||
2. Navigate to the path `spring-dynatrace-oneagent/`. | ||
3. Register the client credentials in environment variables: | ||
`CTP_CLIENT_ID`, `CTP_CLIENT_SECRET` and `CTP_PROJECT_KEY` | ||
|
||
## Using the Spring MVC Example app | ||
|
||
### Install Dynatrace OneAgent | ||
Follow the instructions on the [Dynatrace OneAgent page]( | ||
https://docs.dynatrace.com/docs/setup-and-configuration/dynatrace-oneagent#tabgroup--technology-support--operating-systems) to install the OneAgent on your system. | ||
|
||
#### Install Dynatrace OneAgent on Mac | ||
Currently, it is NOT possible to install Dynatrace OneAgent on macOS. For this case a [Dockerfile](./Dockerfile) is provided. | ||
Use this file to build the application with the OneAgent included on Docker. | ||
1. Run `./gradlew bootJar` to build a JAR file. This JAR file is necessary to build the Docker image. | ||
2. Update ENV variables in the [Dockerfile](./Dockerfile) with your Dynatrace and CTP credentials. | ||
3. Run `docker build -t spring-dynatrace-oneagent .` to build the Docker image. | ||
4. Run `docker run -p 8080:8080 spring-dynatrace-oneagent` to start the Docker container. | ||
|
||
### Navigate the application | ||
|
||
1. Open a new browser window/tab | ||
2. Navigate to [http://localhost:8080/p](http://localhost:8080/p) and a list of products should appear. | ||
|
||
## Using Dynatrace with OpenTelemetry | ||
|
||
If you want to use Dynatrace with OpenTelemetry, we also provide [an example Spring Boot application](../spring-otel). |
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,42 @@ | ||
plugins { | ||
id 'java' | ||
id 'org.springframework.boot' version '3.0.4' | ||
id 'io.spring.dependency-management' version '1.1.0' | ||
} | ||
|
||
group = 'com.commercetools.sdk.examples' | ||
version = '0.0.1-SNAPSHOT' | ||
|
||
java { | ||
toolchain { | ||
languageVersion = JavaLanguageVersion.of(17) | ||
} | ||
} | ||
|
||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
} | ||
|
||
ext { | ||
versions = [ | ||
commercetools: "17.3.0", | ||
] | ||
} | ||
|
||
dependencies { | ||
implementation "com.commercetools.sdk:commercetools-sdk-java-api:${versions.commercetools}" | ||
implementation "com.commercetools.sdk:commercetools-apachehttp-client:${versions.commercetools}" | ||
implementation 'org.springframework.boot:spring-boot-starter-actuator' | ||
implementation 'org.springframework.boot:spring-boot-starter-security' | ||
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' | ||
implementation 'org.springframework.boot:spring-boot-starter-web' | ||
implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity6' | ||
testImplementation 'org.springframework.boot:spring-boot-starter-test' | ||
testImplementation 'org.springframework.security:spring-security-test' | ||
developmentOnly "org.springframework.boot:spring-boot-devtools" | ||
} | ||
|
||
tasks.named('test') { | ||
useJUnitPlatform() | ||
} |
Binary file not shown.
5 changes: 5 additions & 0 deletions
5
examples/spring-dynatrace-oneagent/gradle/wrapper/gradle-wrapper.properties
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 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.