-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from Dynatrace/v1.1.0-alpha
v1.1.0-alpha
- Loading branch information
Showing
28 changed files
with
1,466 additions
and
725 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
56 changes: 25 additions & 31 deletions
56
Dynatrace.OneAgent.Sdk.sln → sample/Dynatrace.OneAgent.Sdk.Sample.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 15 | ||
VisualStudioVersion = 15.0.27130.2027 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dynatrace.OneAgent.Sdk", "src\Dynatrace.OneAgent.Sdk.csproj", "{A8128352-47FA-4BDA-8BF5-CFFCA7C16F97}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dynatrace.OneAgent.Sdk.Sample", "sample\Dynatrace.OneAgent.Sdk.Sample\Dynatrace.OneAgent.Sdk.Sample.csproj", "{B47F5422-23F6-4FDC-8E16-ED41FDD76993}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{A8128352-47FA-4BDA-8BF5-CFFCA7C16F97}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{A8128352-47FA-4BDA-8BF5-CFFCA7C16F97}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{A8128352-47FA-4BDA-8BF5-CFFCA7C16F97}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{A8128352-47FA-4BDA-8BF5-CFFCA7C16F97}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{B47F5422-23F6-4FDC-8E16-ED41FDD76993}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{B47F5422-23F6-4FDC-8E16-ED41FDD76993}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{B47F5422-23F6-4FDC-8E16-ED41FDD76993}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{B47F5422-23F6-4FDC-8E16-ED41FDD76993}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {0E3F7DC6-9C05-41CA-A5A4-E1420CB4A095} | ||
EndGlobalSection | ||
EndGlobal | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 15 | ||
VisualStudioVersion = 15.0.27130.2027 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dynatrace.OneAgent.Sdk.Sample", "Dynatrace.OneAgent.Sdk.Sample\Dynatrace.OneAgent.Sdk.Sample.csproj", "{B47F5422-23F6-4FDC-8E16-ED41FDD76993}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{B47F5422-23F6-4FDC-8E16-ED41FDD76993}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{B47F5422-23F6-4FDC-8E16-ED41FDD76993}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{B47F5422-23F6-4FDC-8E16-ED41FDD76993}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{B47F5422-23F6-4FDC-8E16-ED41FDD76993}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {0E3F7DC6-9C05-41CA-A5A4-E1420CB4A095} | ||
EndGlobalSection | ||
EndGlobal |
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,79 @@ | ||
// | ||
// Copyright 2018 Dynatrace LLC | ||
// | ||
// 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. | ||
// | ||
|
||
using Dynatrace.OneAgent.Sdk.Api; | ||
using Dynatrace.OneAgent.Sdk.Api.Enums; | ||
using System; | ||
using System.Threading; | ||
|
||
namespace Dynatrace.OneAgent.Sdk.Sample | ||
{ | ||
class CombinedSamples | ||
{ | ||
public static void RemoteCallWithDatabase() | ||
{ | ||
IOutgoingRemoteCallTracer outgoingRemoteCallTracer = SampleApplication.OneAgentSdk | ||
.TraceOutgoingRemoteCall("RemoteMethod", "RemoteServiceName", "mrcp://endpoint/service", ChannelType.TCP_IP, "myRemoteHost:1234"); | ||
outgoingRemoteCallTracer.SetProtocolName("MyRemoteCallProtocol"); | ||
|
||
outgoingRemoteCallTracer.Start(); | ||
try | ||
{ | ||
string outgoingDynatraceStringTag = outgoingRemoteCallTracer.GetDynatraceStringTag(); | ||
// make the call and transport the tag across to server | ||
|
||
// represents server side processing | ||
Thread server = new Thread(() => | ||
{ | ||
IIncomingRemoteCallTracer incomingRemoteCallTracer = SampleApplication.OneAgentSdk | ||
.TraceIncomingRemoteCall("RemoteMethod", "RemoteServiceName", "mrcp://endpoint/service"); | ||
|
||
string incomingDynatraceStringTag = outgoingDynatraceStringTag; // retrieve from incoming call metadata | ||
incomingRemoteCallTracer.SetDynatraceStringTag(incomingDynatraceStringTag); | ||
|
||
incomingRemoteCallTracer.Start(); | ||
try | ||
{ | ||
incomingRemoteCallTracer.SetProtocolName("MyRemoteCallProtocol"); | ||
|
||
// execute database request on server | ||
DatabaseRequestTracerSamples.Sync_StartEnd(); | ||
} | ||
catch (Exception e) | ||
{ | ||
incomingRemoteCallTracer.Error(e.Message); | ||
// handle or rethrow | ||
} | ||
finally | ||
{ | ||
incomingRemoteCallTracer.End(); | ||
} | ||
}); | ||
server.Start(); | ||
server.Join(); // sync call, wait for db result | ||
} | ||
catch (Exception e) | ||
{ | ||
outgoingRemoteCallTracer.Error(e.Message); | ||
// handle or rethrow | ||
} | ||
finally | ||
{ | ||
outgoingRemoteCallTracer.End(); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.