40 | *
41 | * {@link #start()}, {@link #end()}, {@link #error(String)},
42 | * {@link #error(Throwable)} are not thread-safe. They must be called from the
43 | * same thread where {@link #start()} has been invoked.
44 | *
45 | * @since 1.0
46 | */
47 | void start();
48 |
49 | /**
50 | * Ends timing of a node. Typically this method is called via finally block.
51 | *
52 | * {@link #start()}, {@link #end()}, {@link #error(String)},
53 | * {@link #error(Throwable)} are not thread-safe. They must be called from the
54 | * same thread where {@link #start()} has been invoked.
55 | *
56 | * @since 1.0
57 | */
58 | void end();
59 |
60 | /**
61 | * Marks the node as 'exited by exception'. An additional error message can be
62 | * provided as String.
63 | * {@link #start()}, {@link #end()}, {@link #error(String)},
64 | * {@link #error(Throwable)} are not thread-safe. They must be called from the
65 | * same thread where {@link #start()} has been invoked.
66 | *
67 | * @param message
68 | * error message with details about occurred error (eg. return code).
69 | * must not be null.
70 | * @since 1.0
71 | */
72 | void error(String message);
73 |
74 | /**
75 | * Marks the node as 'exited by exception'.Additional information can be
76 | * provided as Throwable.
77 | * {@link #start()}, {@link #end()}, {@link #error(String)},
78 | * {@link #error(Throwable)} are not thread-safe. They must be called from the
79 | * same thread where {@link #start()} has been invoked.
80 | *
81 | * @param throwable
82 | * exception, that occurred. must not null.
83 | * @since 1.0
84 | */
85 | void error(Throwable throwable);
86 | }
87 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/api/enums/ChannelType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | package com.dynatrace.oneagent.sdk.api.enums;
17 |
18 | /**
19 | * Defines the type of communication channel being used.
20 | *
21 | * @author Alram.Lechner
22 | *
23 | */
24 | public enum ChannelType {
25 |
26 | OTHER(0), TCP_IP(1), UNIX_DOMAIN_SOCKET(2), NAMED_PIPE(3), IN_PROCESS(4);
27 |
28 | /** constant is being used in API call to OneAgent. don't change it! */
29 | private final int sdkConstant;
30 |
31 | private ChannelType(int sdkConstant) {
32 | this.sdkConstant = sdkConstant;
33 | }
34 |
35 | public int getSDKConstant() {
36 | return sdkConstant;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/api/enums/DatabaseVendor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | package com.dynatrace.oneagent.sdk.api.enums;
17 |
18 | import com.dynatrace.oneagent.sdk.api.OneAgentSDK;
19 |
20 | /**
21 | * Enumerates all well-known database vendors. See {@link OneAgentSDK#createDatabaseInfo(String, String, ChannelType, String)}.
22 | * Using these constants ensures that services captured by OneAgentSDK are handled the same way as traced via built-in sensors.
23 | * @since 1.7.0
24 | */
25 | public enum DatabaseVendor {
26 |
27 | APACHE_HIVE("ApacheHive"),
28 | CLOUDSCAPE("Cloudscape"),
29 | HSQLDB("HSQLDB"),
30 | PROGRESS("Progress"),
31 | MAXDB("MaxDB"),
32 | HANADB("HanaDB"),
33 | INGRES("Ingres"),
34 | FIRST_SQL("FirstSQL"),
35 | ENTERPRISE_DB("EnterpriseDB"),
36 | CACHE("Cache"),
37 | ADABAS("Adabas"),
38 | FIREBIRD("Firebird"),
39 | DB2("DB2"),
40 | DERBY_CLIENT("Derby Client"),
41 | DERBY_EMBEDDED("Derby Embedded"),
42 | FILEMAKER("Filemaker"),
43 | INFORMIX("Informix"),
44 | INSTANT_DB("InstantDb"),
45 | INTERBASE("Interbase"),
46 | MYSQL("MySQL"),
47 | MARIADB("MariaDB"),
48 | NETEZZA("Netezza"),
49 | ORACLE("Oracle"),
50 | PERVASIVE("Pervasive"),
51 | POINTBASE("Pointbase"),
52 | POSTGRESQL("PostgreSQL"),
53 | SQLSERVER("SQL Server"),
54 | SQLITE("sqlite"),
55 | SYBASE("Sybase"),
56 | TERADATA("Teradata"),
57 | VERTICA("Vertica"),
58 | CASSANDRA("Cassandra"),
59 | H2("H2"),
60 | COLDFUSION_IMQ("ColdFusion IMQ"),
61 | REDSHIFT("Amazon Redshift"),
62 | COUCHBASE("Couchbase");
63 |
64 | private final String vendorName;
65 |
66 | private DatabaseVendor(String vendorName) {
67 | this.vendorName = vendorName;
68 | }
69 |
70 | public String getVendorName() {
71 | return vendorName;
72 | }
73 |
74 | @Override
75 | public String toString() {
76 | return vendorName;
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/api/enums/MessageDestinationType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | package com.dynatrace.oneagent.sdk.api.enums;
17 |
18 | import com.dynatrace.oneagent.sdk.api.OneAgentSDK;
19 |
20 | /**
21 | * Enumerates all well-known messaging destination types. See
22 | * {@link OneAgentSDK#createMessagingSystemInfo(String, String, MessageDestinationType, ChannelType, String)}
23 | *
24 | * @since 1.5
25 | */
26 | public enum MessageDestinationType {
27 |
28 | QUEUE("Queue"),
29 | TOPIC("Topic");
30 |
31 | private final String name;
32 |
33 | private MessageDestinationType(String name) {
34 | this.name = name;
35 | }
36 |
37 | public String getName() {
38 | return name;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/api/enums/MessageSystemVendor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | package com.dynatrace.oneagent.sdk.api.enums;
17 |
18 | import com.dynatrace.oneagent.sdk.api.OneAgentSDK;
19 |
20 | /**
21 | * Enumerates all well-known messaging systems. See {@link OneAgentSDK#createMessagingSystemInfo(String, String, MessageDestinationType, ChannelType, String)}.
22 | * Using these constants ensures that services captured by OneAgentSDK are handled the same way as traced via built-in sensors.
23 | *
24 | * @since 1.5
25 | */
26 | public enum MessageSystemVendor {
27 |
28 | HORNETQ("HornetQ"),
29 | ACTIVE_MQ("ActiveMQ"),
30 | RABBIT_MQ("RabbitMQ"),
31 | ARTEMIS("Artemis"),
32 | WEBSPHERE("WebSphere"),
33 | MQSERIES_JMS("MQSeries JMS"),
34 | MQSERIES("MQSeries"),
35 | TIBCO("Tibco");
36 |
37 | private final String vendorName;
38 |
39 | private MessageSystemVendor(String vendorName) {
40 | this.vendorName = vendorName;
41 | }
42 |
43 | public String getVendorName() {
44 | return vendorName;
45 | }
46 |
47 | @Override
48 | public String toString() {
49 | return vendorName;
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/api/enums/SDKState.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | package com.dynatrace.oneagent.sdk.api.enums;
17 |
18 | /**
19 | * Defines the possible states of the SDK.
20 | */
21 | public enum SDKState {
22 |
23 | /**
24 | * SDK is connected to OneAgent and capturing data.
25 | *
26 | * @since 1.0
27 | */
28 | ACTIVE,
29 |
30 | /**
31 | * SDK is connected to OneAgent, but capturing is disabled.It is good practice
32 | * to skip creating SDK transactions to save resources. The SDK state should be
33 | * checked regularly as it may change at every point in time.
34 | *
35 | * @since 1.0
36 | */
37 | TEMPORARILY_INACTIVE,
38 |
39 | /**
40 | * SDK isn't connected to OneAgent, so it will never capture data. This SDK
41 | * state will never change during the lifetime of a JVM. It is good practice to
42 | * never call any SDK API to save resources.
43 | *
44 | * @since 1.0
45 | */
46 | PERMANENTLY_INACTIVE;
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/api/infos/DatabaseInfo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | package com.dynatrace.oneagent.sdk.api.infos;
17 |
18 | import com.dynatrace.oneagent.sdk.api.OneAgentSDK;
19 |
20 | /**
21 | * Type returned by {@link OneAgentSDK#createDatabaseInfo(String, String, com.dynatrace.oneagent.sdk.api.enums.ChannelType, String)}
22 | * @since 1.7.0
23 | */
24 | public interface DatabaseInfo {
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/api/infos/MessagingSystemInfo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | package com.dynatrace.oneagent.sdk.api.infos;
17 |
18 | import com.dynatrace.oneagent.sdk.api.OneAgentSDK;
19 |
20 | /**
21 | * Type returned by {@link OneAgentSDK#createMessagingSystemInfo(String, String, com.dynatrace.oneagent.sdk.api.enums.MessageDestinationType, com.dynatrace.oneagent.sdk.api.enums.ChannelType, String)}
22 | *
23 | * @since 1.5
24 | */
25 | public interface MessagingSystemInfo {
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/api/infos/TraceContextInfo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | package com.dynatrace.oneagent.sdk.api.infos;
17 |
18 | /**
19 | * Provides information about a PurePath node using the TraceContext (Trace-Id, Span-Id) model as defined in
20 | * These are a few common reasons for why you may be unable to get a valid trace context:
49 | * */
50 | boolean isValid();
51 |
52 | /** The W3C trace ID hex string (never empty or null, but might be all-zero if {@link #isValid()}) is false) */
53 | String getTraceId();
54 |
55 | /** The W3C span ID hex string (never empty or null, but might be all-zero if {@link #isValid()}) is false) */
56 | String getSpanId();
57 | }
58 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/api/infos/WebApplicationInfo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | package com.dynatrace.oneagent.sdk.api.infos;
17 |
18 | import com.dynatrace.oneagent.sdk.api.OneAgentSDK;
19 |
20 | /**
21 | * Type returned by
22 | * {@link OneAgentSDK#createWebApplicationInfo(String, String, String)}
23 | *
24 | * @since 1.3
25 | *
26 | */
27 | public interface WebApplicationInfo {
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/impl/OneAgentSDKFactoryImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | package com.dynatrace.oneagent.sdk.impl;
17 |
18 | import com.dynatrace.oneagent.sdk.api.OneAgentSDK;
19 | import com.dynatrace.oneagent.sdk.impl.noop.OneAgentSDKNoop;
20 | import com.dynatrace.oneagent.sdk.impl.proxy.OneAgentSDKProxy;
21 | import com.dynatrace.oneagent.sdk.impl.proxy.SDK2AgentInternalApiProxy;
22 |
23 | /**
24 | * Entry point for customer application.
25 | */
26 | public class OneAgentSDKFactoryImpl {
27 |
28 | /*
29 | * increase version with every change. in case of non breaking change (to
30 | * OneAgent), increase oneSdkFix only.
31 | */
32 | static final int oneSdkMajor = 1;
33 | static final int oneSdkMinor = 9;
34 | static final int oneSdkFix = 0;
35 |
36 | public static final boolean debugOneAgentSdkStub = Boolean.parseBoolean(System.getProperty("com.dynatrace.oneagent.sdk.debug", "false"));
37 |
38 | private static OneAgentSDK createOneSDK() {
39 | Object agentApiImpl = SDKInstanceProvider.create(oneSdkMajor, oneSdkMinor, oneSdkFix);
40 | if (agentApiImpl == null) {
41 | // OneAgent not present or not compatible
42 | if (debugOneAgentSdkStub) {
43 | logDebug("- no OneAgent present or OneAgent declined to work with OneAgentSdk version " + oneSdkMajor
44 | + "." + oneSdkMinor + "." + oneSdkFix);
45 | }
46 | return new OneAgentSDKNoop();
47 | }
48 | try {
49 | SDK2AgentInternalApiProxy agentApi = new SDK2AgentInternalApiProxy(agentApiImpl);
50 | Object agentSdkImpl = agentApi.oneAgentSDKFactory_createSdk();
51 | if (agentSdkImpl != null) {
52 | return new OneAgentSDKProxy(agentApi, agentSdkImpl);
53 | }
54 | if (debugOneAgentSdkStub) {
55 | logDebug("- OneAgent failed to provide sdk object.");
56 | }
57 | return new OneAgentSDKNoop();
58 | } catch (Throwable e) {
59 | if (debugOneAgentSdkStub) {
60 | logDebug("- failed to contact OneAgent: " + e.getClass().getName() + ": " + e.getMessage());
61 | }
62 | return new OneAgentSDKNoop();
63 | }
64 | }
65 |
66 | public static OneAgentSDK createInstance() {
67 | return createOneSDK();
68 | }
69 |
70 | public static void logDebug(String msg) {
71 | System.out.println("[onesdk ] " + msg);
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/impl/SDKInstanceProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | package com.dynatrace.oneagent.sdk.impl;
17 |
18 | /** class gets replaced by OneAgent, if OneAgent is loaded. */
19 | class SDKInstanceProvider {
20 |
21 | /**
22 | * @return SDK Object provided by OneAgent. null if no OneAgent is loaded or
23 | * declines to work with current SDK.
24 | */
25 | static Object create(int onesdkmajor, int onesdkminor, int onesdkfix) {
26 | return null;
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/impl/noop/CustomServiceTracerNoop.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | package com.dynatrace.oneagent.sdk.impl.noop;
17 |
18 | import com.dynatrace.oneagent.sdk.api.CustomServiceTracer;
19 |
20 | public final class CustomServiceTracerNoop extends NodeNoop implements CustomServiceTracer {
21 |
22 | public static final CustomServiceTracer INSTANCE = new CustomServiceTracerNoop();
23 |
24 | private CustomServiceTracerNoop() {
25 | }
26 |
27 | @Override
28 | public void start() {
29 | }
30 |
31 | @Override
32 | public void end() {
33 | }
34 |
35 | @Override
36 | public void error(String message) {
37 | }
38 |
39 | @Override
40 | public void error(Throwable throwable) {
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/impl/noop/DatabaseInfoNoop.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | package com.dynatrace.oneagent.sdk.impl.noop;
17 |
18 | import com.dynatrace.oneagent.sdk.api.infos.DatabaseInfo;
19 |
20 | public final class DatabaseInfoNoop implements DatabaseInfo {
21 | public static final DatabaseInfo INSTANCE = new DatabaseInfoNoop();
22 |
23 | private DatabaseInfoNoop() {
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/impl/noop/DatabaseRequestTracerNoop.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | package com.dynatrace.oneagent.sdk.impl.noop;
17 |
18 | import com.dynatrace.oneagent.sdk.api.DatabaseRequestTracer;
19 |
20 | public final class DatabaseRequestTracerNoop extends NodeNoop implements DatabaseRequestTracer {
21 |
22 | public static final DatabaseRequestTracerNoop INSTANCE = new DatabaseRequestTracerNoop();
23 |
24 | private DatabaseRequestTracerNoop() {
25 | }
26 |
27 | @Override
28 | public void start() {
29 | }
30 |
31 | @Override
32 | public void end() {
33 | }
34 |
35 | @Override
36 | public void error(String message) {
37 | }
38 |
39 | @Override
40 | public void error(Throwable throwable) {
41 | }
42 |
43 | @Override
44 | public void setReturnedRowCount(int rowsReturned) {
45 | }
46 |
47 | @Override
48 | public void setRoundTripCount(int roundTripCount) {
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/impl/noop/InProcessLinkNoop.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | package com.dynatrace.oneagent.sdk.impl.noop;
17 |
18 | import com.dynatrace.oneagent.sdk.api.InProcessLink;
19 |
20 | public final class InProcessLinkNoop implements InProcessLink {
21 |
22 | public final static InProcessLink INSTANCE = new InProcessLinkNoop();
23 |
24 | private InProcessLinkNoop() {
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/impl/noop/InProcessLinkTracerNoop.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | package com.dynatrace.oneagent.sdk.impl.noop;
17 |
18 | import com.dynatrace.oneagent.sdk.api.InProcessLinkTracer;
19 |
20 | public final class InProcessLinkTracerNoop extends NodeNoop implements InProcessLinkTracer {
21 |
22 | public final static InProcessLinkTracer INSTANCE = new InProcessLinkTracerNoop();
23 |
24 | private InProcessLinkTracerNoop() {
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/impl/noop/IncomingMessageProcessTracerNoop.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | package com.dynatrace.oneagent.sdk.impl.noop;
17 |
18 | import com.dynatrace.oneagent.sdk.api.IncomingMessageProcessTracer;
19 |
20 | public final class IncomingMessageProcessTracerNoop extends NodeNoop implements IncomingMessageProcessTracer {
21 |
22 | public static final IncomingMessageProcessTracerNoop INSTANCE = new IncomingMessageProcessTracerNoop();
23 |
24 | private IncomingMessageProcessTracerNoop() {
25 | }
26 |
27 | @Override
28 | public void setDynatraceStringTag(String tag) {
29 | }
30 |
31 | @Override
32 | public void setDynatraceByteTag(byte[] tag) {
33 | }
34 |
35 | @Override
36 | public void setVendorMessageId(String vendorMessageId) {
37 | }
38 |
39 | @Override
40 | public void setCorrelationId(String correlationId) {
41 | }
42 |
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/impl/noop/IncomingMessageReceiveTracerNoop.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | package com.dynatrace.oneagent.sdk.impl.noop;
17 |
18 | import com.dynatrace.oneagent.sdk.api.IncomingMessageReceiveTracer;
19 |
20 | public final class IncomingMessageReceiveTracerNoop extends NodeNoop implements IncomingMessageReceiveTracer {
21 |
22 | public static final IncomingMessageReceiveTracerNoop INSTANCE = new IncomingMessageReceiveTracerNoop();
23 |
24 | private IncomingMessageReceiveTracerNoop() {
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/impl/noop/IncomingWebRequestTracerNoop.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | package com.dynatrace.oneagent.sdk.impl.noop;
17 |
18 | import com.dynatrace.oneagent.sdk.api.IncomingWebRequestTracer;
19 |
20 | public final class IncomingWebRequestTracerNoop extends NodeNoop implements IncomingWebRequestTracer {
21 |
22 | public static final IncomingWebRequestTracer INSTANCE = new IncomingWebRequestTracerNoop();
23 |
24 | private IncomingWebRequestTracerNoop() {
25 | }
26 |
27 | @Override
28 | public void setDynatraceStringTag(String tag) {
29 | }
30 |
31 | @Override
32 | public void setDynatraceByteTag(byte[] tag) {
33 | }
34 |
35 | @Override
36 | public void setRemoteAddress(String remoteAddress) {
37 |
38 | }
39 |
40 | @Override
41 | public void addRequestHeader(String name, String value) {
42 |
43 | }
44 |
45 | @Override
46 | public void addParameter(String name, String value) {
47 |
48 | }
49 |
50 | @Override
51 | public void addResponseHeader(String name, String value) {
52 |
53 | }
54 |
55 | @Override
56 | public void setStatusCode(int statusCode) {
57 |
58 | }
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/impl/noop/MessagingSystemInfoNoop.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | package com.dynatrace.oneagent.sdk.impl.noop;
17 |
18 | import com.dynatrace.oneagent.sdk.api.infos.MessagingSystemInfo;
19 |
20 | public final class MessagingSystemInfoNoop implements MessagingSystemInfo {
21 |
22 | public static final MessagingSystemInfoNoop INSTANCE = new MessagingSystemInfoNoop();
23 |
24 | private MessagingSystemInfoNoop() {
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/impl/noop/NodeNoop.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | package com.dynatrace.oneagent.sdk.impl.noop;
17 |
18 | import com.dynatrace.oneagent.sdk.api.Tracer;
19 |
20 | abstract class NodeNoop implements Tracer {
21 |
22 | protected static final byte[] NO_TAG_BLOB = new byte[] {};
23 | protected static final String NO_TAG_STRING = "";
24 |
25 | @Override
26 | public void start() {
27 | }
28 |
29 | @Override
30 | public void end() {
31 | }
32 |
33 | @Override
34 | public void error(String message) {
35 | }
36 |
37 | @Override
38 | public void error(Throwable throwable) {
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/impl/noop/OneAgentSDKNoop.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | package com.dynatrace.oneagent.sdk.impl.noop;
17 |
18 | import com.dynatrace.oneagent.sdk.api.CustomServiceTracer;
19 | import com.dynatrace.oneagent.sdk.api.DatabaseRequestTracer;
20 | import com.dynatrace.oneagent.sdk.api.InProcessLink;
21 | import com.dynatrace.oneagent.sdk.api.InProcessLinkTracer;
22 | import com.dynatrace.oneagent.sdk.api.IncomingMessageProcessTracer;
23 | import com.dynatrace.oneagent.sdk.api.IncomingMessageReceiveTracer;
24 | import com.dynatrace.oneagent.sdk.api.IncomingRemoteCallTracer;
25 | import com.dynatrace.oneagent.sdk.api.IncomingWebRequestTracer;
26 | import com.dynatrace.oneagent.sdk.api.LoggingCallback;
27 | import com.dynatrace.oneagent.sdk.api.OneAgentSDK;
28 | import com.dynatrace.oneagent.sdk.api.OutgoingMessageTracer;
29 | import com.dynatrace.oneagent.sdk.api.OutgoingRemoteCallTracer;
30 | import com.dynatrace.oneagent.sdk.api.OutgoingWebRequestTracer;
31 | import com.dynatrace.oneagent.sdk.api.enums.ChannelType;
32 | import com.dynatrace.oneagent.sdk.api.enums.MessageDestinationType;
33 | import com.dynatrace.oneagent.sdk.api.enums.SDKState;
34 | import com.dynatrace.oneagent.sdk.api.infos.DatabaseInfo;
35 | import com.dynatrace.oneagent.sdk.api.infos.MessagingSystemInfo;
36 | import com.dynatrace.oneagent.sdk.api.infos.TraceContextInfo;
37 | import com.dynatrace.oneagent.sdk.api.infos.WebApplicationInfo;
38 |
39 | /**
40 | * This class provides an empty (NOOP) implementation of the {@link OneAgentSDK}
41 | * interface.
42 | *
43 | * @author Alram.Lechner
44 | *
45 | */
46 | public final class OneAgentSDKNoop implements OneAgentSDK {
47 |
48 | // ***** Webrequests (incoming) *****
49 | @Override
50 | public WebApplicationInfo createWebApplicationInfo(String webServerName, String applicationID, String contextRoot) {
51 | return WebApplicationInfoNoop.INSTANCE;
52 | }
53 |
54 | @Override
55 | public IncomingWebRequestTracer traceIncomingWebRequest(WebApplicationInfo webApplicationInfo, String url,
56 | String method) {
57 | return IncomingWebRequestTracerNoop.INSTANCE;
58 | }
59 |
60 | // ***** Remote Calls (outgoing & incoming) *****
61 | @Override
62 | public IncomingRemoteCallTracer traceIncomingRemoteCall(String remoteMethod, String remoteService,
63 | String clientEndpoint) {
64 | return RemoteCallServerTracerNoop.INSTANCE;
65 | }
66 |
67 | @Override
68 | public OutgoingRemoteCallTracer traceOutgoingRemoteCall(String remoteMethod, String remoteService,
69 | String serviceEndpoint, ChannelType channelType, String channelEndpoint) {
70 | return RemoteCallClientTracerNoop.INSTANCE;
71 | }
72 |
73 | // ***** Common *****
74 |
75 | @Override
76 | public void setLoggingCallback(LoggingCallback loggingCallback) {
77 | }
78 |
79 | @Override
80 | public SDKState getCurrentState() {
81 | return SDKState.PERMANENTLY_INACTIVE;
82 | }
83 |
84 | @Override
85 | public InProcessLink createInProcessLink() {
86 | return InProcessLinkNoop.INSTANCE;
87 | }
88 |
89 | @Override
90 | public InProcessLinkTracer traceInProcessLink(InProcessLink inProcessLink) {
91 | return InProcessLinkTracerNoop.INSTANCE;
92 | }
93 |
94 | @Override
95 | public void addCustomRequestAttribute(String key, String value) {
96 | }
97 |
98 | @Override
99 | public void addCustomRequestAttribute(String key, long value) {
100 | }
101 |
102 | @Override
103 | public void addCustomRequestAttribute(String key, double value) {
104 | }
105 |
106 | @Override
107 | public OutgoingWebRequestTracer traceOutgoingWebRequest(String url, String method) {
108 | return OutgoingWebRequestTracerNoop.INSTANCE;
109 | }
110 |
111 | @Override
112 | public MessagingSystemInfo createMessagingSystemInfo(String vendorName, String destinationName,
113 | MessageDestinationType destinationType, ChannelType channelType, String channelEndpoint) {
114 | return MessagingSystemInfoNoop.INSTANCE;
115 | }
116 |
117 | @Override
118 | public OutgoingMessageTracer traceOutgoingMessage(MessagingSystemInfo messagingSystem) {
119 | return OutgoingMessageTracerNoop.INSTANCE;
120 | }
121 |
122 | @Override
123 | public IncomingMessageReceiveTracer traceIncomingMessageReceive(MessagingSystemInfo messagingSystem) {
124 | return IncomingMessageReceiveTracerNoop.INSTANCE;
125 | }
126 |
127 | @Override
128 | public IncomingMessageProcessTracer traceIncomingMessageProcess(MessagingSystemInfo messagingSystem) {
129 | return IncomingMessageProcessTracerNoop.INSTANCE;
130 | }
131 |
132 | @Override
133 | public DatabaseInfo createDatabaseInfo(String name, String vendor, ChannelType channelType,
134 | String channelEndpoint) {
135 | return DatabaseInfoNoop.INSTANCE;
136 | }
137 |
138 | @Override
139 | public DatabaseRequestTracer traceSqlDatabaseRequest(DatabaseInfo databaseInfo, String statement) {
140 | return DatabaseRequestTracerNoop.INSTANCE;
141 | }
142 |
143 | @Override
144 | public CustomServiceTracer traceCustomService(String serviceMethod, String serviceName) {
145 | return CustomServiceTracerNoop.INSTANCE;
146 | }
147 |
148 | @Override
149 | public TraceContextInfo getTraceContextInfo() {
150 | return TraceContextInfoNoop.INSTANCE;
151 | }
152 | }
153 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/impl/noop/OutgoingMessageTracerNoop.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | package com.dynatrace.oneagent.sdk.impl.noop;
17 |
18 | import com.dynatrace.oneagent.sdk.api.OutgoingMessageTracer;
19 |
20 | public final class OutgoingMessageTracerNoop extends NodeNoop implements OutgoingMessageTracer {
21 |
22 | public static final OutgoingMessageTracerNoop INSTANCE = new OutgoingMessageTracerNoop();
23 |
24 | private OutgoingMessageTracerNoop() {
25 | }
26 |
27 | @Override
28 | public void start() {
29 | }
30 |
31 | @Override
32 | public void end() {
33 | }
34 |
35 | @Override
36 | public void error(String message) {
37 | }
38 |
39 | @Override
40 | public void error(Throwable throwable) {
41 | }
42 |
43 | @Override
44 | public String getDynatraceStringTag() {
45 | return NO_TAG_STRING;
46 | }
47 |
48 | @Override
49 | public byte[] getDynatraceByteTag() {
50 | return NO_TAG_BLOB;
51 | }
52 |
53 | @Override
54 | public void setVendorMessageId(String vendorMessageId) {
55 |
56 | }
57 |
58 | @Override
59 | public void setCorrelationId(String correlationId) {
60 | }
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/impl/noop/OutgoingWebRequestTracerNoop.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | package com.dynatrace.oneagent.sdk.impl.noop;
17 |
18 | import com.dynatrace.oneagent.sdk.api.OutgoingWebRequestTracer;
19 |
20 | public final class OutgoingWebRequestTracerNoop extends NodeNoop implements OutgoingWebRequestTracer {
21 | public static final OutgoingWebRequestTracerNoop INSTANCE = new OutgoingWebRequestTracerNoop();
22 |
23 | private OutgoingWebRequestTracerNoop() {
24 | }
25 |
26 | @Override
27 | public String getDynatraceStringTag() {
28 | return NO_TAG_STRING;
29 | }
30 |
31 | @Override
32 | public byte[] getDynatraceByteTag() {
33 | return NO_TAG_BLOB;
34 | }
35 |
36 | @Override
37 | public void addRequestHeader(String name, String value) {
38 | }
39 |
40 | @Override
41 | public void addResponseHeader(String name, String value) {
42 | }
43 |
44 | @Override
45 | public void setStatusCode(int statusCode) {
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/impl/noop/RemoteCallClientTracerNoop.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | package com.dynatrace.oneagent.sdk.impl.noop;
17 |
18 | import com.dynatrace.oneagent.sdk.api.OutgoingRemoteCallTracer;
19 |
20 | public final class RemoteCallClientTracerNoop extends NodeNoop implements OutgoingRemoteCallTracer {
21 |
22 | public static final OutgoingRemoteCallTracer INSTANCE = new RemoteCallClientTracerNoop();
23 |
24 | private RemoteCallClientTracerNoop() {
25 | }
26 |
27 | @Override
28 | public String getDynatraceStringTag() {
29 | return NO_TAG_STRING;
30 | }
31 |
32 | @Override
33 | public byte[] getDynatraceByteTag() {
34 | return NO_TAG_BLOB;
35 | }
36 |
37 | @Override
38 | public void setProtocolName(String protocolName) {
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/impl/noop/RemoteCallServerTracerNoop.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | package com.dynatrace.oneagent.sdk.impl.noop;
17 |
18 | import com.dynatrace.oneagent.sdk.api.IncomingRemoteCallTracer;
19 |
20 | public final class RemoteCallServerTracerNoop extends NodeNoop implements IncomingRemoteCallTracer {
21 |
22 | public static final IncomingRemoteCallTracer INSTANCE = new RemoteCallServerTracerNoop();
23 |
24 | private RemoteCallServerTracerNoop() {
25 | }
26 |
27 | @Override
28 | public void setDynatraceStringTag(String tag) {
29 | }
30 |
31 | @Override
32 | public void setDynatraceByteTag(byte[] tag) {
33 | }
34 |
35 | @Override
36 | public void setProtocolName(String protocolName) {
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/impl/noop/TraceContextInfoNoop.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | package com.dynatrace.oneagent.sdk.impl.noop;
17 |
18 | import com.dynatrace.oneagent.sdk.api.infos.TraceContextInfo;
19 |
20 | public final class TraceContextInfoNoop implements TraceContextInfo {
21 | public static final TraceContextInfoNoop INSTANCE = new TraceContextInfoNoop();
22 |
23 | private TraceContextInfoNoop() {}
24 |
25 | @Override
26 | public boolean isValid() {
27 | return false;
28 | }
29 |
30 | @Override
31 | public String getTraceId() {
32 | return INVALID_TRACE_ID;
33 | }
34 |
35 | @Override
36 | public String getSpanId() {
37 | return INVALID_SPAN_ID;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/impl/noop/WebApplicationInfoNoop.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | package com.dynatrace.oneagent.sdk.impl.noop;
17 |
18 | import com.dynatrace.oneagent.sdk.api.infos.WebApplicationInfo;
19 |
20 | public final class WebApplicationInfoNoop implements WebApplicationInfo {
21 |
22 | public static final WebApplicationInfo INSTANCE = new WebApplicationInfoNoop();
23 |
24 | private WebApplicationInfoNoop() {
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/impl/proxy/CustomServiceTracerProxy.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | package com.dynatrace.oneagent.sdk.impl.proxy;
17 |
18 | import com.dynatrace.oneagent.sdk.api.CustomServiceTracer;
19 |
20 | final class CustomServiceTracerProxy extends TraceableProxy implements CustomServiceTracer {
21 |
22 | CustomServiceTracerProxy(SDK2AgentInternalApiProxy apiProxy, Object customServiceTracer) {
23 | super(apiProxy, customServiceTracer);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/impl/proxy/DatabaseInfoImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | package com.dynatrace.oneagent.sdk.impl.proxy;
17 |
18 | import com.dynatrace.oneagent.sdk.api.enums.ChannelType;
19 | import com.dynatrace.oneagent.sdk.api.infos.DatabaseInfo;
20 |
21 | final class DatabaseInfoImpl implements DatabaseInfo {
22 |
23 | private final String name;
24 | private final String vendor;
25 | private final ChannelType channelType;
26 | private final String channelEndpoint;
27 |
28 | DatabaseInfoImpl(String name, String vendor, ChannelType channelType, String channelEndpoint) {
29 | this.name = name;
30 | this.vendor = vendor;
31 | this.channelType = channelType;
32 | this.channelEndpoint = channelEndpoint;
33 | }
34 |
35 | String getName() {
36 | return name;
37 | }
38 |
39 | String getVendor() {
40 | return vendor;
41 | }
42 |
43 | ChannelType getChannelType() {
44 | return channelType;
45 | }
46 |
47 | String getChannelEndpoint() {
48 | return channelEndpoint;
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/impl/proxy/DatabaseRequestTracerProxy.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | package com.dynatrace.oneagent.sdk.impl.proxy;
17 |
18 | import com.dynatrace.oneagent.sdk.api.DatabaseRequestTracer;
19 |
20 | final class DatabaseRequestTracerProxy extends TraceableProxy implements DatabaseRequestTracer {
21 |
22 | DatabaseRequestTracerProxy(SDK2AgentInternalApiProxy apiProxy, Object outgoingMessageTracer) {
23 | super(apiProxy, outgoingMessageTracer);
24 | }
25 |
26 | @Override
27 | public void setReturnedRowCount(int rowsReturned) {
28 | apiProxy.databaseRequestTracer_setRowsReturned(agentsNodeObject, rowsReturned);
29 | }
30 |
31 | @Override
32 | public void setRoundTripCount(int roundTripCount) {
33 | apiProxy.databaseRequestTracer_setRoundTripCount(agentsNodeObject, roundTripCount);
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/impl/proxy/InProcessLinkImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | package com.dynatrace.oneagent.sdk.impl.proxy;
17 |
18 | import com.dynatrace.oneagent.sdk.api.InProcessLink;
19 |
20 | final class InProcessLinkImpl implements InProcessLink {
21 |
22 | private final Object agentProvidedLink;
23 |
24 | InProcessLinkImpl(Object agentProvidedLink) {
25 | this.agentProvidedLink = agentProvidedLink;
26 | }
27 |
28 | Object getAgentProvidedLink() {
29 | return agentProvidedLink;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/impl/proxy/InProcessLinkTracerProxy.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | package com.dynatrace.oneagent.sdk.impl.proxy;
17 |
18 | import com.dynatrace.oneagent.sdk.api.InProcessLinkTracer;
19 |
20 | final class InProcessLinkTracerProxy extends TraceableProxy implements InProcessLinkTracer {
21 |
22 | InProcessLinkTracerProxy(SDK2AgentInternalApiProxy apiProxy, Object node) {
23 | super(apiProxy, node);
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/impl/proxy/IncomingMessageProcessTracerProxy.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | package com.dynatrace.oneagent.sdk.impl.proxy;
17 |
18 | import com.dynatrace.oneagent.sdk.api.IncomingMessageProcessTracer;
19 |
20 | final class IncomingMessageProcessTracerProxy extends TraceableProxy implements IncomingMessageProcessTracer {
21 |
22 | IncomingMessageProcessTracerProxy(SDK2AgentInternalApiProxy apiProxy, Object agentObject) {
23 | super(apiProxy, agentObject);
24 | }
25 |
26 | @Override
27 | public void setDynatraceStringTag(String tag) {
28 | apiProxy.incomingTaggable_setDynatraceStringTag(agentsNodeObject, tag);
29 | }
30 |
31 | @Override
32 | public void setDynatraceByteTag(byte[] tag) {
33 | apiProxy.incomingTaggable_setDynatraceByteTag(agentsNodeObject, tag);
34 | }
35 |
36 | @Override
37 | public void setVendorMessageId(String vendorMessageId) {
38 | apiProxy.messageTracer_setVendorMessageId(agentsNodeObject, vendorMessageId);
39 | }
40 |
41 | @Override
42 | public void setCorrelationId(String correlationId) {
43 | apiProxy.messageTracer_setCorrelationId(agentsNodeObject, correlationId);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/impl/proxy/IncomingMessageReceiveTracerProxy.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | package com.dynatrace.oneagent.sdk.impl.proxy;
17 |
18 | import com.dynatrace.oneagent.sdk.api.IncomingMessageReceiveTracer;
19 |
20 | final class IncomingMessageReceiveTracerProxy extends TraceableProxy implements IncomingMessageReceiveTracer {
21 |
22 | IncomingMessageReceiveTracerProxy(SDK2AgentInternalApiProxy apiProxy, Object agentObject) {
23 | super(apiProxy, agentObject);
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/impl/proxy/IncomingWebRequestProxy.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | package com.dynatrace.oneagent.sdk.impl.proxy;
17 |
18 | import com.dynatrace.oneagent.sdk.api.IncomingWebRequestTracer;
19 |
20 | final class IncomingWebRequestProxy extends TraceableProxy implements IncomingWebRequestTracer {
21 |
22 | IncomingWebRequestProxy(SDK2AgentInternalApiProxy apiProxy, Object agentObject) {
23 | super(apiProxy, agentObject);
24 | }
25 |
26 | @Override
27 | public void setDynatraceStringTag(String tag) {
28 | apiProxy.incomingTaggable_setDynatraceStringTag(agentsNodeObject, tag);
29 | }
30 |
31 | @Override
32 | public void setDynatraceByteTag(byte[] tag) {
33 | apiProxy.incomingTaggable_setDynatraceByteTag(agentsNodeObject, tag);
34 | }
35 |
36 | @Override
37 | public void setRemoteAddress(String remoteAddress) {
38 | apiProxy.incomingWebRequestTracer_setRemoteAddress(agentsNodeObject, remoteAddress);
39 |
40 | }
41 |
42 | @Override
43 | public void addRequestHeader(String name, String value) {
44 | apiProxy.webRequestTracer_addRequestHeader(agentsNodeObject, name, value);
45 | }
46 |
47 | @Override
48 | public void addParameter(String name, String value) {
49 | apiProxy.incomingWebRequestTracer_addParameter(agentsNodeObject, name, value);
50 | }
51 |
52 | @Override
53 | public void addResponseHeader(String name, String value) {
54 | apiProxy.webRequestTracer_addResponseHeader(agentsNodeObject, name, value);
55 | }
56 |
57 | @Override
58 | public void setStatusCode(int statusCode) {
59 | apiProxy.webRequestTracer_setStatusCode(agentsNodeObject, statusCode);
60 | }
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/impl/proxy/MessagingSystemInfoImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | package com.dynatrace.oneagent.sdk.impl.proxy;
17 |
18 | import com.dynatrace.oneagent.sdk.api.enums.ChannelType;
19 | import com.dynatrace.oneagent.sdk.api.enums.MessageDestinationType;
20 |
21 | final class MessagingSystemInfoImpl implements com.dynatrace.oneagent.sdk.api.infos.MessagingSystemInfo {
22 |
23 | private final String vendorName;
24 | private final String destinationName;
25 | private final MessageDestinationType destinationType;
26 | private final ChannelType channelType;
27 | private final String channelEndpoint;
28 |
29 | MessagingSystemInfoImpl(String vendorName, String destinationName, MessageDestinationType destinationType,
30 | ChannelType channelType, String channelEndpoint) {
31 | this.vendorName = vendorName;
32 | this.destinationName = destinationName;
33 | this.destinationType = destinationType;
34 | this.channelType = channelType;
35 | this.channelEndpoint = channelEndpoint;
36 | }
37 |
38 | String getVendorName() {
39 | return vendorName;
40 | }
41 |
42 | String getDestinationName() {
43 | return destinationName;
44 | }
45 |
46 | MessageDestinationType getDestinationType() {
47 | return destinationType;
48 | }
49 |
50 | ChannelType getChannelType() {
51 | return channelType;
52 | }
53 |
54 | String getChannelEndpoint() {
55 | return channelEndpoint;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/impl/proxy/OutgoingMessageTracerProxy.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | package com.dynatrace.oneagent.sdk.impl.proxy;
17 |
18 | import com.dynatrace.oneagent.sdk.api.OutgoingMessageTracer;
19 |
20 | final class OutgoingMessageTracerProxy extends TraceableProxy implements OutgoingMessageTracer {
21 |
22 | OutgoingMessageTracerProxy(SDK2AgentInternalApiProxy apiProxy, Object outgoingMessageTracer) {
23 | super(apiProxy, outgoingMessageTracer);
24 | }
25 |
26 | @Override
27 | public String getDynatraceStringTag() {
28 | return apiProxy.outgoingTaggable_getDynatraceStringTag(agentsNodeObject);
29 | }
30 |
31 | @Override
32 | public byte[] getDynatraceByteTag() {
33 | return apiProxy.outgoingTaggable_getDynatraceByteTag(agentsNodeObject);
34 | }
35 |
36 | @Override
37 | public void setVendorMessageId(String vendorMessageId) {
38 | apiProxy.messageTracer_setVendorMessageId(agentsNodeObject, vendorMessageId);
39 | }
40 |
41 | @Override
42 | public void setCorrelationId(String correlationId) {
43 | apiProxy.messageTracer_setCorrelationId(agentsNodeObject, correlationId);
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/impl/proxy/OutgoingWebRequestTracerProxy.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | package com.dynatrace.oneagent.sdk.impl.proxy;
17 |
18 | import com.dynatrace.oneagent.sdk.api.OutgoingWebRequestTracer;
19 |
20 | final class OutgoingWebRequestTracerProxy extends TraceableProxy implements OutgoingWebRequestTracer {
21 |
22 | OutgoingWebRequestTracerProxy(SDK2AgentInternalApiProxy apiProxy,
23 | Object oneAgentSDK_createOutgoingWebreqeustTracer) {
24 | super(apiProxy, oneAgentSDK_createOutgoingWebreqeustTracer);
25 | }
26 |
27 | @Override
28 | public String getDynatraceStringTag() {
29 | return apiProxy.outgoingTaggable_getDynatraceStringTag(agentsNodeObject);
30 | }
31 |
32 | @Override
33 | public byte[] getDynatraceByteTag() {
34 | return apiProxy.outgoingTaggable_getDynatraceByteTag(agentsNodeObject);
35 | }
36 |
37 | @Override
38 | public void addRequestHeader(String name, String value) {
39 | apiProxy.webRequestTracer_addRequestHeader(agentsNodeObject, name, value);
40 | }
41 |
42 | @Override
43 | public void addResponseHeader(String name, String value) {
44 | apiProxy.webRequestTracer_addResponseHeader(agentsNodeObject, name, value);
45 | }
46 |
47 | @Override
48 | public void setStatusCode(int statusCode) {
49 | apiProxy.webRequestTracer_setStatusCode(agentsNodeObject, statusCode);
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/impl/proxy/RemoteCallClientProxy.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | package com.dynatrace.oneagent.sdk.impl.proxy;
17 |
18 | import com.dynatrace.oneagent.sdk.api.OutgoingRemoteCallTracer;
19 |
20 | final class RemoteCallClientProxy extends TraceableProxy implements OutgoingRemoteCallTracer {
21 |
22 | RemoteCallClientProxy(SDK2AgentInternalApiProxy apiProxy, Object oneAgentSDK_createLocalOutgoingRemoteCall) {
23 | super(apiProxy, oneAgentSDK_createLocalOutgoingRemoteCall);
24 | }
25 |
26 | @Override
27 | public String getDynatraceStringTag() {
28 | return apiProxy.outgoingTaggable_getDynatraceStringTag(agentsNodeObject);
29 | }
30 |
31 | @Override
32 | public byte[] getDynatraceByteTag() {
33 | return apiProxy.outgoingTaggable_getDynatraceByteTag(agentsNodeObject);
34 | }
35 |
36 | @Override
37 | public void setProtocolName(String protocolName) {
38 | apiProxy.outgoingRemoteCallTracer_setProtocolName(agentsNodeObject, protocolName);
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/impl/proxy/RemoteCallServerProxy.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | package com.dynatrace.oneagent.sdk.impl.proxy;
17 |
18 | import com.dynatrace.oneagent.sdk.api.IncomingRemoteCallTracer;
19 |
20 | final class RemoteCallServerProxy extends TraceableProxy implements IncomingRemoteCallTracer {
21 |
22 | RemoteCallServerProxy(SDK2AgentInternalApiProxy apiProxy, Object remoteCallObject) {
23 | super(apiProxy, remoteCallObject);
24 | }
25 |
26 | @Override
27 | public void setDynatraceStringTag(String tag) {
28 | apiProxy.incomingTaggable_setDynatraceStringTag(agentsNodeObject, tag);
29 | }
30 |
31 | @Override
32 | public void setDynatraceByteTag(byte[] tag) {
33 | apiProxy.incomingTaggable_setDynatraceByteTag(agentsNodeObject, tag);
34 | }
35 |
36 | @Override
37 | public void setProtocolName(String protocolName) {
38 | apiProxy.incomingRemoteCallTracer_setProtocolName(agentsNodeObject, protocolName);
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/impl/proxy/TraceContextInfoImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | package com.dynatrace.oneagent.sdk.impl.proxy;
17 |
18 | import com.dynatrace.oneagent.sdk.api.infos.TraceContextInfo;
19 |
20 | final class TraceContextInfoImpl implements TraceContextInfo {
21 |
22 | private final String traceId;
23 | private final String spanId;
24 |
25 | public TraceContextInfoImpl(String traceId, String spanId) {
26 | this.traceId = traceId;
27 | this.spanId = spanId;
28 | }
29 |
30 | @Override
31 | public boolean isValid() {
32 | // Always true; for the invalid trace context, TraceContextInfoNoop is used.
33 | return true;
34 | }
35 |
36 | @Override
37 | public String getTraceId() {
38 | return traceId;
39 | }
40 |
41 | @Override
42 | public String getSpanId() {
43 | return spanId;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/impl/proxy/TraceableProxy.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | package com.dynatrace.oneagent.sdk.impl.proxy;
17 |
18 | import com.dynatrace.oneagent.sdk.api.Tracer;
19 |
20 | abstract class TraceableProxy implements Tracer {
21 |
22 | protected final SDK2AgentInternalApiProxy apiProxy;
23 | protected final Object agentsNodeObject;
24 |
25 | TraceableProxy(SDK2AgentInternalApiProxy apiProxy, Object agentsNodeObject) {
26 | this.apiProxy = apiProxy;
27 | this.agentsNodeObject = agentsNodeObject;
28 | }
29 |
30 | @Override
31 | public void start() {
32 | apiProxy.tracer_start(agentsNodeObject);
33 |
34 | }
35 |
36 | @Override
37 | public void end() {
38 | apiProxy.tracer_end(agentsNodeObject);
39 |
40 | }
41 |
42 | @Override
43 | public void error(String message) {
44 | apiProxy.tracer_error(agentsNodeObject, message);
45 |
46 | }
47 |
48 | @Override
49 | public void error(Throwable throwable) {
50 | apiProxy.tracer_error(agentsNodeObject, throwable);
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/impl/proxy/WebApplicationInfoImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | package com.dynatrace.oneagent.sdk.impl.proxy;
17 |
18 | import com.dynatrace.oneagent.sdk.api.infos.WebApplicationInfo;
19 |
20 | final class WebApplicationInfoImpl implements WebApplicationInfo {
21 |
22 | private final String webServerName;
23 | private final String applicationID;
24 | private final String contextRoot;
25 |
26 | WebApplicationInfoImpl(String webServerName, String applicationID, String contextRoot) {
27 | this.webServerName = webServerName;
28 | this.applicationID = applicationID;
29 | this.contextRoot = contextRoot;
30 | }
31 |
32 | String getWebServerName() {
33 | return webServerName;
34 | }
35 |
36 | String getApplicationID() {
37 | return applicationID;
38 | }
39 |
40 | String getContextRoot() {
41 | return contextRoot;
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/src/main/java/com/dynatrace/oneagent/sdk/impl/proxy/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Dynatrace LLC
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 | * internal SDK implementation. direct usage is forbidden. package provides
18 | * proxy classes for forwarding requests to OneAgent.
19 | */
20 | package com.dynatrace.oneagent.sdk.impl.proxy;
21 |
--------------------------------------------------------------------------------
/src/test/java/com/dynatrace/oneagent/sdk/impl/OneAgentSDKFactoryImplTest.java:
--------------------------------------------------------------------------------
1 | package com.dynatrace.oneagent.sdk.impl;
2 |
3 | import org.assertj.core.api.Assertions;
4 | import org.junit.Test;
5 |
6 | import com.dynatrace.oneagent.sdk.impl.OneAgentSDKFactoryImpl;
7 |
8 | public class OneAgentSDKFactoryImplTest {
9 |
10 | @Test
11 | public void versionCheckTest() {
12 | // *** public version of SDK
13 | String buildVersion = System.getProperty("sdk.version");
14 | Assertions.assertThat(buildVersion).isEqualTo("1.9.0");
15 |
16 | // *** internal version (between SDK and agent)
17 | String[] splitted = buildVersion.split("\\.");
18 | int major = Integer.parseInt(splitted[0]);
19 | int minor = Integer.parseInt(splitted[1]);
20 | int fix = Integer.parseInt(splitted[2]);
21 |
22 | Assertions.assertThat(major).isEqualTo(OneAgentSDKFactoryImpl.oneSdkMajor);
23 | Assertions.assertThat(minor).isEqualTo(OneAgentSDKFactoryImpl.oneSdkMinor);
24 | Assertions.assertThat(fix).isEqualTo(OneAgentSDKFactoryImpl.oneSdkFix);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/test/java/com/dynatrace/oneagent/sdk/impl/SDKInstanceProviderTest.java:
--------------------------------------------------------------------------------
1 | package com.dynatrace.oneagent.sdk.impl;
2 |
3 | import static org.junit.Assert.assertThat;
4 |
5 | import org.hamcrest.core.IsEqual;
6 | import org.junit.Test;
7 |
8 | import com.dynatrace.oneagent.sdk.impl.SDKInstanceProvider;
9 |
10 | public class SDKInstanceProviderTest {
11 |
12 | @Test
13 | public void testClassName() {
14 | assertThat("class name changed. incompatible with older agents.", SDKInstanceProvider.class.getName(),
15 | IsEqual.equalTo("com.dynatrace.oneagent.sdk.impl.SDKInstanceProvider"));
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------