Skip to content

Commit

Permalink
Merge pull request #2 from Dynatrace/v1.1.0-alpha
Browse files Browse the repository at this point in the history
v1.1.0-alpha
  • Loading branch information
arminru authored Dec 4, 2018
2 parents 738f87c + 4fa1632 commit faa04d9
Show file tree
Hide file tree
Showing 28 changed files with 1,466 additions and 725 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ orleans.codegen.cs

# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
*.snk

# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
Expand Down Expand Up @@ -320,3 +320,7 @@ ASALocalRun/

# MSBuild Binary and Structured Log
*.binlog

.vscode/*
.gradle/
.project
192 changes: 134 additions & 58 deletions readme.md

Large diffs are not rendered by default.

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
79 changes: 79 additions & 0 deletions sample/Dynatrace.OneAgent.Sdk.Sample/CombinedSamples.cs
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();
}
}
}
}
Loading

0 comments on commit faa04d9

Please sign in to comment.