Skip to content

Commit

Permalink
Changes for release 2.1.0. (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
AnashOommen authored May 23, 2019
1 parent 20e1d20 commit f29efa7
Show file tree
Hide file tree
Showing 78 changed files with 17,288 additions and 2,905 deletions.
8 changes: 8 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
2.1.0
=====
- Added support for Google Ads API v1.3. See release notes:
https://developers.google.com/google-ads/api/docs/release-notes#130_2019-05-22
- Increased the default timeout for services to 120 seconds.
- Made a change to generate logs only if appropriate logging levels are set.
- Fixed https://github.com/googleads/google-ads-dotnet/issues/59.

2.0.0
=====
- Added support for Google Ads API v1.2 See release notes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
<ProjectReference Condition="Exists('..\..\..\src\Google.Ads.GoogleAds.csproj')" Include="..\..\..\src\Google.Ads.GoogleAds.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="Google.Ads.GoogleAds, Version=2.0.0.0, Culture=neutral, PublicKeyToken=52807268f2b614dc, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Google.Ads.GoogleAds.2.0.0\lib\net452\Google.Ads.GoogleAds.dll</HintPath>
<Reference Include="Google.Ads.GoogleAds, Version=2.1.0.0, Culture=neutral, PublicKeyToken=52807268f2b614dc, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Google.Ads.GoogleAds.2.1.0\lib\net452\Google.Ads.GoogleAds.dll</HintPath>
</Reference>
<Reference Include="Google.Api.CommonProtos, Version=1.6.0.0, Culture=neutral, PublicKeyToken=3ec5ea7f18953e47, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Google.Api.CommonProtos.1.6.0\lib\net45\Google.Api.CommonProtos.dll</HintPath>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Google.Ads.GoogleAds" version="2.0.0" targetFramework="net452" />
<package id="Google.Ads.GoogleAds" version="2.1.0" targetFramework="net452" />
<package id="Google.Api.CommonProtos" version="1.6.0" targetFramework="net452" />
<package id="Google.Api.Gax" version="2.7.0" targetFramework="net452" />
<package id="Google.Api.Gax.Grpc" version="2.7.0" targetFramework="net452" />
Expand Down
2 changes: 1 addition & 1 deletion examples/Google.Ads.GoogleAds.Examples.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<None Remove="Migration\**" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Google.Ads.GoogleAds" Version="2.0.0" />
<PackageReference Include="Google.Ads.GoogleAds" Version="2.1.0" />
</ItemGroup>
<ItemGroup>
<Reference Include="System.Web" />
Expand Down
5 changes: 3 additions & 2 deletions src/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@

<!-- Settings related to general library behaviour. -->

<!-- Set the service timeout in milliseconds. -->
<add key="Timeout" value="10000" />
<!-- Set the service timeout in milliseconds. Use this setting to increase the timeout if you
face DeadlineExceeded errors frequently. The default is currently set to 120000 ms. -->
<!-- <add key="Timeout" value="120000" /> -->

<!-- Proxy settings for library. -->
<!--
Expand Down
2 changes: 1 addition & 1 deletion src/Config/GoogleAdsConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class GoogleAdsConfig : ConfigBase
/// <summary>
/// The default timeout for API calls in milliseconds.
/// </summary>
private const int DEFAULT_TIMEOUT = 60000;
private const int DEFAULT_TIMEOUT = 120_000;

/// <summary>
/// The default value of OAuth2 server URL.
Expand Down
6 changes: 3 additions & 3 deletions src/Google.Ads.GoogleAds.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<Title>Google Ads API Dotnet Client Library</Title>
<PackageId>Google.Ads.GoogleAds</PackageId>
<Version>2.0.0</Version>
<Version>2.1.0</Version>
<Description>This library provides you with functionality to access the Google Ads API.</Description>
<PackageReleaseNotes>https://github.com/googleads/google-ads-dotnet/blob/master/ChangeLog</PackageReleaseNotes>
<PackageTags>GoogleAds Google</PackageTags>
Expand All @@ -30,8 +30,8 @@
<IncludeSource>true</IncludeSource>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<FileVersion>2.0.0.0</FileVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
<FileVersion>2.1.0.0</FileVersion>
</PropertyGroup>
<ItemGroup>
<Content Include="app.config.transform" PackagePath="content" />
Expand Down
5 changes: 5 additions & 0 deletions src/Lib/GoogleAdsServiceClientFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,11 @@ private Channel CreateChannel(GoogleAdsConfig config)
Environment.SetEnvironmentVariable("http_proxy", config.Proxy.Address.ToString());
}

// GRPC uses c-ares DNS resolver, which doesn't seem to work on some Windows machines.
// Turn it off for now.
// https://github.com/googleads/google-ads-dotnet/issues/59
Environment.SetEnvironmentVariable("GRPC_DNS_RESOLVER", "native");

Uri uri = new Uri(config.ServerUrl);
return new Channel(uri.Host, uri.Port, channelCredentials, null);
}
Expand Down
30 changes: 18 additions & 12 deletions src/Logging/LoggingInterceptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.

using Google.Ads.GoogleAds.Config;
using Google.Ads.GoogleAds.Util;
using Grpc.Core;
using Grpc.Core.Interceptors;
using System;
Expand Down Expand Up @@ -106,19 +107,24 @@ public override AsyncUnaryCall<TResponse> AsyncUnaryCall<TRequest, TResponse>(
Task t = call.ResponseAsync.ContinueWith(
delegate (Task<TResponse> oldTask)
{
LogEntry logEntry = new LogEntry()
// Generating log entry is expensive, so let's do that only if the log source
// has been configured to do so.
if (TraceUtilities.ShouldGenerateRequestLogs())
{
Host = Config.ServerUrl,
Method = context.Method.FullName,
RequestHeaders = context.Options.Headers,
Request = request,
ResponseHeaders = GetResponseHeader(call),
Response = (oldTask.IsFaulted) ? default(TResponse) : oldTask.Result,
Exception = GetGoogleAdsException(oldTask.Exception),
IsFailure = oldTask.IsFaulted,
CustomerId = GetCustomerId(request)
};
OnLogEventAvailable?.Invoke(this, logEntry);
LogEntry logEntry = new LogEntry()
{
Host = Config.ServerUrl,
Method = context.Method.FullName,
RequestHeaders = context.Options.Headers,
Request = request,
ResponseHeaders = GetResponseHeader(call),
Response = (oldTask.IsFaulted) ? default(TResponse) : oldTask.Result,
Exception = GetGoogleAdsException(oldTask.Exception),
IsFailure = oldTask.IsFaulted,
CustomerId = GetCustomerId(request)
};
OnLogEventAvailable?.Invoke(this, logEntry);
}
});
t.Wait();
return call;
Expand Down
19 changes: 17 additions & 2 deletions src/Util/TraceUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,21 @@ public static void Configure(string source, string filePath, SourceLevels levels
Configure(source, textWriter, levels);
}

/// <summary>
/// Decide whether the library should attempt to generate logs.
/// </summary>
internal static bool ShouldGenerateRequestLogs()
{
TraceSource detailedSource = GetSource(DETAILED_REQUEST_LOGS_SOURCE);
TraceSource summarySource = GetSource(SUMMARY_REQUEST_LOGS_SOURCE);

return (
((detailedSource.Switch.Level & SourceLevels.Information) ==
SourceLevels.Information) ||
((summarySource.Switch.Level & SourceLevels.Warning) == SourceLevels.Warning)
);
}

/// <summary>
/// Writes the deprecation warnings.
/// </summary>
Expand Down Expand Up @@ -160,7 +175,7 @@ public static void WriteGeneralErrors(string message)
/// <param name="isError">Indicates whether or not these are error logs.</param>
/// <remarks>The trace levels may be controlled from App.config by setting
/// the level for AdsClientLibs.DetailedRequestLogs trace switch.</remarks>
public static void WriteDetailedRequestLogs(string message, Boolean isError)
public static void WriteDetailedRequestLogs(string message, bool isError)
{
TraceEventType type = isError ? TraceEventType.Information : TraceEventType.Verbose;
Write(DETAILED_REQUEST_LOGS_SOURCE, type, message);
Expand All @@ -173,7 +188,7 @@ public static void WriteDetailedRequestLogs(string message, Boolean isError)
/// <param name="isError">Indicates whether or not these are error logs.</param>
/// <remarks>The trace levels may be controlled from App.config by setting
/// the level for AdsClientLibs.SummaryRequestLogs trace switch.</remarks>
public static void WriteSummaryRequestLogs(string message, Boolean isError)
public static void WriteSummaryRequestLogs(string message, bool isError)
{
TraceEventType type = isError ? TraceEventType.Warning : TraceEventType.Information;
Write(SUMMARY_REQUEST_LOGS_SOURCE, type, message);
Expand Down
10 changes: 10 additions & 0 deletions src/V1/ResourceNames.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,16 @@ public static string CampaignBudget(long customerId, long budgetId)
return $"customers/{customerId}/campaignBudgets/{budgetId}";
}

public static string CampaignDraft(long customerId, long baseCampaignId, long draftId)
{
return $"customers/{customerId}/campaignDrafts/{baseCampaignId}~{draftId}";
}

public static string CampaignExperiments(long customerId, long campaignExperimentId)
{
return $"customers/{customerId}/campaignExperiments/{campaignExperimentId}";
}

public static string CampaignCriteria(long customerId, long campaignId, long criterionId)
{
return $"customers/{customerId}/campaignCriteria/{campaignId}~{criterionId}";
Expand Down
2 changes: 2 additions & 0 deletions src/V1/ServiceExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public abstract partial class CampaignBidModifierServiceClient : GoogleAdsServic
public abstract partial class CampaignBudgetServiceClient : GoogleAdsServiceClientBase {}
public abstract partial class CampaignCriterionServiceClient : GoogleAdsServiceClientBase {}
public abstract partial class CampaignCriterionSimulationServiceClient : GoogleAdsServiceClientBase {}
public abstract partial class CampaignDraftServiceClient : GoogleAdsServiceClientBase {}
public abstract partial class CampaignExperimentServiceClient : GoogleAdsServiceClientBase {}
public abstract partial class CampaignExtensionSettingServiceClient : GoogleAdsServiceClientBase {}
public abstract partial class CampaignFeedServiceClient : GoogleAdsServiceClientBase {}
public abstract partial class CampaignLabelServiceClient : GoogleAdsServiceClientBase {}
Expand Down
14 changes: 14 additions & 0 deletions src/V1/Services.V1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,20 @@ public class V1
public static readonly ServiceTemplate<CampaignCriterionSimulationServiceClient, CampaignCriterionSimulationServiceSettings> CampaignCriterionSimulationService;


/// <summary>
/// See https://developers.google.com/google-ads/api/reference/rpc/google.ads.googleads.v1.services#google.ads.googleads.v1.services.CampaignDraftService
/// for details.
/// </summary>
public static readonly ServiceTemplate<CampaignDraftServiceClient, CampaignDraftServiceSettings> CampaignDraftService;


/// <summary>
/// See https://developers.google.com/google-ads/api/reference/rpc/google.ads.googleads.v1.services#google.ads.googleads.v1.services.CampaignExperimentService
/// for details.
/// </summary>
public static readonly ServiceTemplate<CampaignExperimentServiceClient, CampaignExperimentServiceSettings> CampaignExperimentService;


/// <summary>
/// See https://developers.google.com/google-ads/api/reference/rpc/google.ads.googleads.v1.services#google.ads.googleads.v1.services.CampaignExtensionSettingService
/// for details.
Expand Down
Loading

0 comments on commit f29efa7

Please sign in to comment.