-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1925030
commit 453eeef
Showing
31 changed files
with
1,642 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,111 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<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"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>com.navercorp.pinpoint</groupId> | ||
<artifactId>pinpoint-agent-testweb</artifactId> | ||
<version>3.0.1-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>pinpoint-ktor-plugin-testweb</artifactId> | ||
|
||
<packaging>jar</packaging> | ||
|
||
<properties> | ||
<pinpoint.agent.jvmargument> | ||
${pinpoint.agent.default.jvmargument} | ||
</pinpoint.agent.jvmargument> | ||
<kotlin.version>2.0.0</kotlin.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.ktor</groupId> | ||
<artifactId>ktor-server-status-pages</artifactId> | ||
<version>2.3.12</version> | ||
<scope>runtime</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.ktor</groupId> | ||
<artifactId>ktor-server-core-jvm</artifactId> | ||
<version>2.3.12</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.ktor</groupId> | ||
<artifactId>ktor-server-netty-jvm</artifactId> | ||
<version>2.3.12</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.ktor</groupId> | ||
<artifactId>ktor-server-config-yaml-jvm</artifactId> | ||
<version>2.3.12</version> | ||
<scope>runtime</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.ktor</groupId> | ||
<artifactId>ktor-server-tests-jvm</artifactId> | ||
<version>2.3.12</version> | ||
</dependency> | ||
<!-- https://mvnrepository.com/artifact/io.ktor/ktor-client-core-jvm --> | ||
<dependency> | ||
<groupId>io.ktor</groupId> | ||
<artifactId>ktor-client-core-jvm</artifactId> | ||
<version>2.3.12</version> | ||
</dependency> | ||
<!-- https://mvnrepository.com/artifact/io.ktor/ktor-client-cio-jvm --> | ||
<dependency> | ||
<groupId>io.ktor</groupId> | ||
<artifactId>ktor-client-cio-jvm</artifactId> | ||
<version>2.3.12</version> | ||
</dependency> | ||
|
||
|
||
<dependency> | ||
<groupId>org.jetbrains.kotlin</groupId> | ||
<artifactId>kotlin-stdlib-jdk8</artifactId> | ||
<version>${kotlin.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jetbrains.kotlin</groupId> | ||
<artifactId>kotlin-test</artifactId> | ||
<version>${kotlin.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.jetbrains.kotlin</groupId> | ||
<artifactId>kotlin-maven-plugin</artifactId> | ||
<version>${kotlin.version}</version> | ||
<executions> | ||
<execution> | ||
<id>compile</id> | ||
<phase>compile</phase> | ||
<goals> | ||
<goal>compile</goal> | ||
</goals> | ||
</execution> | ||
<execution> | ||
<id>test-compile</id> | ||
<phase>test-compile</phase> | ||
<goals> | ||
<goal>test-compile</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<jvmTarget>1.8</jvmTarget> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
30 changes: 30 additions & 0 deletions
30
...e/agent-testweb/ktor-plugin-testweb/src/main/java/com/pinpoint/test/plugin/Application.kt
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 @@ | ||
/* | ||
* Copyright 2024 NAVER Corp. | ||
* | ||
* 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. | ||
*/ | ||
|
||
package com.pinpoint.test.plugin | ||
|
||
import io.ktor.server.application.* | ||
import io.ktor.server.engine.* | ||
import io.ktor.server.netty.* | ||
|
||
fun main() { | ||
embeddedServer(Netty, port = 8080, host = "0.0.0.0", module = Application::module) | ||
.start(wait = true) | ||
} | ||
|
||
fun Application.module() { | ||
configureRouting() | ||
} |
60 changes: 60 additions & 0 deletions
60
...odule/agent-testweb/ktor-plugin-testweb/src/main/java/com/pinpoint/test/plugin/Routing.kt
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,60 @@ | ||
/* | ||
* Copyright 2024 NAVER Corp. | ||
* | ||
* 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. | ||
*/ | ||
|
||
package com.pinpoint.test.plugin | ||
|
||
import io.ktor.client.* | ||
import io.ktor.client.engine.cio.* | ||
import io.ktor.client.request.* | ||
import io.ktor.client.statement.* | ||
import io.ktor.http.* | ||
import io.ktor.server.application.* | ||
import io.ktor.server.http.content.* | ||
import io.ktor.server.plugins.statuspages.* | ||
import io.ktor.server.response.* | ||
import io.ktor.server.routing.* | ||
|
||
fun Application.configureRouting() { | ||
install(StatusPages) { | ||
exception<IllegalStateException> { call, cause -> | ||
call.respondText("App in illegal state as ${cause.message}") | ||
} | ||
} | ||
routing { | ||
staticResources("/content", "mycontent") | ||
|
||
get("/") { | ||
call.respondText("Hello World!") | ||
} | ||
|
||
get("/test1") { | ||
val text = "<h1>Hello From Ktor</h1>" | ||
val type = ContentType.parse("text/html") | ||
call.respondText(text, type) | ||
} | ||
get("/client") { | ||
val client = HttpClient(CIO) | ||
val response: HttpResponse = client.get("https://ktor.io/") | ||
println(response.status) | ||
client.close() | ||
call.respondText(response.toString()) | ||
} | ||
|
||
get("/error-test") { | ||
throw IllegalStateException("Too Busy") | ||
} | ||
} | ||
} |
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 @@ | ||
## Ktor | ||
* Since: Pinpoint 3.0.1 | ||
* See: https://ktor.io/ | ||
|
||
### Pinpoint Configuration | ||
pinpoint.config | ||
|
||
#### Set enable options. | ||
~~~ | ||
########################################################### | ||
# Ktor | ||
########################################################### | ||
profiler.ktor.enable=false | ||
# Server | ||
# Classes for detecting application server type. Comma separated list of fully qualified class names. Wildcard not supported. | ||
profiler.ktor.server.bootstrap.main= | ||
# trace param in request ,default value is true | ||
profiler.ktor.server.tracerequestparam=true | ||
# URLs to exclude from tracing. | ||
# Support ant style pattern. e.g. /aa/*.html, /??/exclude.html | ||
profiler.ktor.server.excludeurl= | ||
# profiler.ktor.server.trace.excludemethod= | ||
# HTTP Request methods to exclude from tracing | ||
#profiler.ktor.server.excludemethod= | ||
# original IP address header | ||
# https://en.wikipedia.org/wiki/X-Forwarded-For | ||
#profiler.ktor.server.realipheader=X-Forwarded-For | ||
# nginx real ip header | ||
#profiler.ktor.server.realipheader=X-Real-IP | ||
# optional parameter, If the header value is ${profiler.ktor.realipemptyvalue}, Ignore header value. | ||
#profiler.ktor.server.realipemptyvalue=unknown | ||
# Retransform | ||
profiler.ktor.http.server.retransform.configure-routing=true | ||
~~~ |
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,59 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<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/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>com.navercorp.pinpoint</groupId> | ||
<artifactId>pinpoint-plugins</artifactId> | ||
<version>3.0.1-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>pinpoint-ktor-plugin</artifactId> | ||
<name>pinpoint-ktor-plugin</name> | ||
<packaging>jar</packaging> | ||
|
||
<properties> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.navercorp.pinpoint</groupId> | ||
<artifactId>pinpoint-bootstrap-core</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.navercorp.pinpoint</groupId> | ||
<artifactId>pinpoint-common-servlet</artifactId> | ||
<version>${project.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>io.ktor</groupId> | ||
<artifactId>ktor-server-core-jvm</artifactId> | ||
<version>2.3.12</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.ktor</groupId> | ||
<artifactId>ktor-server-netty-jvm</artifactId> | ||
<version>2.3.12</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<configuration> | ||
<includes> | ||
<include>com/navercorp/**/*</include> | ||
<include>META-INF/**/*</include> | ||
</includes> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
Oops, something went wrong.