Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dynatrace integration #189

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions fixtures/fake_dynatrace_api/Default.aspx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
41 changes: 41 additions & 0 deletions fixtures/fake_dynatrace_api/Default.aspx.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using System;
using System.Collections;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections.Generic;
using System.IO;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string path = HttpContext.Current.Request.Headers["X-Original-URL"];
switch(path) {
case "/v1/deployment/installer/agent/windows/paas/latest?bitness=64&include=dotnet&include=process":
case "/v1/deployment/installer/agent/windows/paas/latest?bitness=64&include=dotnet&include=process&networkZone=testzone":
string zipFilePath = Server.MapPath("paas.zip");
Response.ContentType = "application/zip";
Response.AddHeader("Content-Disposition", "attachment; filename=paas.zip");
Response.WriteFile(zipFilePath);
break;
case "/no-manifest":
string zipFilePathNoManifest = Server.MapPath("paas-no-manifest.zip");
Response.ContentType = "application/zip";
Response.AddHeader("Content-Disposition", "attachment; filename=paas.zip");
Response.WriteFile(zipFilePathNoManifest);
break;
case "/v1/deployment/installer/agent/processmoduleconfig":
string configPath = Server.MapPath("fake_config.json");
Response.ContentType = "application/json";
Response.WriteFile(configPath);
break;
default:
Response.StatusCode = 404;
break;
}

Response.End();
}
}
136 changes: 136 additions & 0 deletions fixtures/fake_dynatrace_api/FakeAPI.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>
</ProductVersion>
<SchemaVersion>
</SchemaVersion>
<ProjectGuid>{B29B307C-710A-4ABA-820C-89F943105CE2}</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<RootNamespace>FakeAPI</RootNamespace>
<AssemblyName>FakeAPI</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<MyType>Custom</MyType>
<UseIISExpress>true</UseIISExpress>
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
<UseGlobalApplicationHostFile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\</OutputPath>
<DocumentationFile>
</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DocumentationFile>
</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Core" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web.Entity" />
<Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Web" />
<Reference Include="System.Xml" />
<Reference Include="System.Configuration" />
<Reference Include="System.Web.Services" />
<Reference Include="System.EnterpriseServices" />
<Reference Include="System.IO.Compression" />
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Data" />
<Import Include="System.Linq" />
<Import Include="System.Xml.Linq" />
<Import Include="System.Diagnostics" />
<Import Include="System.Collections.Specialized" />
<Import Include="System.Configuration" />
<Import Include="System.Text" />
<Import Include="System.Text.RegularExpressions" />
<Import Include="System.Web" />
<Import Include="System.Web.Caching" />
<Import Include="System.Web.SessionState" />
<Import Include="System.Web.Security" />
<Import Include="System.Web.Profile" />
<Import Include="System.Web.UI" />
<Import Include="System.Web.UI.WebControls" />
<Import Include="System.Web.UI.WebControls.WebParts" />
<Import Include="System.Web.UI.HtmlControls" />
<Import Include="System.IO.Compression" />
</ItemGroup>
<ItemGroup>
<Content Include="Default.aspx" />
<Content Include="paas.zip" />
<Content Include="paas-no-manifest.zip" />
<Content Include="Default.aspx.cs">
<SubType>ASPXCodeBehind</SubType>
</Content>
<Content Include="Web.config">
<SubType>Designer</SubType>
</Content>
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<PropertyGroup>
<OptionExplicit>On</OptionExplicit>
</PropertyGroup>
<PropertyGroup>
<OptionCompare>Binary</OptionCompare>
</PropertyGroup>
<PropertyGroup>
<OptionStrict>Off</OptionStrict>
</PropertyGroup>
<PropertyGroup>
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<UseIIS>True</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>5941</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:5941/</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
</CustomServerUrl>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
</Project>
18 changes: 18 additions & 0 deletions fixtures/fake_dynatrace_api/Web.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Rewrite to Default.aspx" stopProcessing="true">
<match url=".*" />
<action type="Rewrite" url="Default.aspx" />
</rule>
</rules>
</rewrite>
</system.webServer>
<system.web>
<customErrors mode="Off"/>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
</configuration>
1 change: 1 addition & 0 deletions fixtures/fake_dynatrace_api/fake_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Binary file added fixtures/fake_dynatrace_api/paas-no-manifest.zip
Binary file not shown.
Binary file added fixtures/fake_dynatrace_api/paas.zip
Binary file not shown.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ require (
github.com/golang/mock v1.6.0
github.com/onsi/ginkgo v1.16.5
github.com/onsi/gomega v1.30.0
github.com/Dynatrace/libbuildpack-dynatrace v1.7.0
)

require (
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
code.cloudfoundry.org/lager v2.0.0+incompatible h1:WZwDKDB2PLd/oL+USK4b4aEjUymIej9My2nUQ9oWEwQ=
code.cloudfoundry.org/lager v2.0.0+incompatible/go.mod h1:O2sS7gKP3HM2iemG+EnwvyNQK7pTSC6Foi4QiMp9sSk=
github.com/BurntSushi/toml v0.4.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/Dynatrace/libbuildpack-dynatrace v1.7.0 h1:t1k1qjzZs0dV9GrA8WjfJNueeJvhp/jnHg3GQuvqL8o=
github.com/Dynatrace/libbuildpack-dynatrace v1.7.0/go.mod h1:Uu9aa5UFAk1Ua+zZXnvzo+avDXuEi+GtegeOyja9xg4=
github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww=
github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
Expand Down
10 changes: 10 additions & 0 deletions src/hwc/hooks/dynatrace.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package hooks

import (
dynatrace "github.com/Dynatrace/libbuildpack-dynatrace"
"github.com/cloudfoundry/libbuildpack"
)

func init() {
libbuildpack.AddHook(dynatrace.NewHook("dotnet", "process"))
}
Loading