Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
2 parents 1930c85 + 4ab0052 commit ebd0b9d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
6 changes: 3 additions & 3 deletions src/Momento.Sdk/Internal/Middleware/HeaderMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ namespace Momento.Sdk.Internal.Middleware
{
internal class Header
{
public const string AuthorizationKey = "Authorization";
public const string AgentKey = "Agent";
public const string RuntimeVersionKey = "Runtime_Version";
public const string AuthorizationKey = "authorization";
public const string AgentKey = "agent";
public const string RuntimeVersionKey = "runtime-version";
public readonly List<string> onceOnlyHeaders = new List<string> { Header.AgentKey, Header.RuntimeVersionKey };
public string Name;
public string Value;
Expand Down
13 changes: 7 additions & 6 deletions src/Momento.Sdk/Internal/ScsDataClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,22 @@ public ScsDataClientBase(IConfiguration config, string authToken, string endpoin
this._logger = config.LoggerFactory.CreateLogger<ScsDataClient>();
this._exceptionMapper = new CacheExceptionMapper(config.LoggerFactory);
}

internal Task EagerConnectAsync(TimeSpan eagerConnectionTimeout)
{
return this.grpcManager.EagerConnectAsync(eagerConnectionTimeout);
}

protected Metadata MetadataWithCache(string cacheName)
{
if (this.hasSentOnetimeHeaders) {
if (this.hasSentOnetimeHeaders)
{
return new Metadata() { { "cache", cacheName } };
}
this.hasSentOnetimeHeaders = true;
string sdkVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
string runtimeVer = System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription;
return new Metadata() { { "cache", cacheName }, { "Agent", $"dotnet:cache:{sdkVersion}" }, { "Runtime-Version", runtimeVer } };
return new Metadata() { { "cache", cacheName }, { "agent", $"dotnet:cache:{sdkVersion}" }, { "runtime-version", runtimeVer } };
}
protected DateTime CalculateDeadline()
{
Expand Down Expand Up @@ -998,8 +999,8 @@ private async Task<CacheSetFetchResponse> SendSetFetchAsync(string cacheName, st

return this._logger.LogTraceCollectionRequestSuccess(REQUEST_TYPE_SET_FETCH, cacheName, setName, new CacheSetFetchResponse.Miss());
}


const string REQUEST_TYPE_SET_SAMPLE = "SET_SAMPLE";
private async Task<CacheSetSampleResponse> SendSetSampleAsync(string cacheName, string setName, ulong limit)
{
Expand All @@ -1023,7 +1024,7 @@ private async Task<CacheSetSampleResponse> SendSetSampleAsync(string cacheName,

return this._logger.LogTraceCollectionRequestSuccess(REQUEST_TYPE_SET_SAMPLE, cacheName, setName, new CacheSetSampleResponse.Miss());
}

const string REQUEST_TYPE_SET_LENGTH = "SET_LENGTH";
private async Task<CacheSetLengthResponse> SendSetLengthAsync(string cacheName, string setName)
{
Expand Down
7 changes: 4 additions & 3 deletions src/Momento.Sdk/Internal/ScsTokenClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,17 @@ public ScsTokenClient(IAuthConfiguration config, string authToken, string endpoi
this._logger = config.LoggerFactory.CreateLogger<ScsTokenClient>();
this._exceptionMapper = new CacheExceptionMapper(config.LoggerFactory);
}

private Metadata Metadata()
{
if (this.hasSentOnetimeHeaders) {
if (this.hasSentOnetimeHeaders)
{
return new Metadata();
}
this.hasSentOnetimeHeaders = true;
string sdkVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
string runtimeVer = System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription;
return new Metadata() { { "Agent", $"dotnet:auth:{sdkVersion}" }, { "Runtime-Version", runtimeVer } };
return new Metadata() { { "agent", $"dotnet:auth:{sdkVersion}" }, { "runtime-version", runtimeVer } };
}

private DateTime CalculateDeadline()
Expand Down
5 changes: 3 additions & 2 deletions src/Momento.Sdk/Internal/ScsTopicClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,14 @@ public ScsTopicClientBase(ITopicConfiguration config, string authToken, string e

private Metadata MetadataWithCache(string cacheName)
{
if (this.hasSentOnetimeHeaders) {
if (this.hasSentOnetimeHeaders)
{
return new Metadata() { { "cache", cacheName } };
}
this.hasSentOnetimeHeaders = true;
string sdkVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
string runtimeVer = System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription;
return new Metadata() { { "cache", cacheName }, { "Agent", $"dotnet:topic:{sdkVersion}" }, { "Runtime-Version", runtimeVer } };
return new Metadata() { { "cache", cacheName }, { "agent", $"dotnet:topic:{sdkVersion}" }, { "runtime-v]ersion", runtimeVer } };
}

protected DateTime CalculateDeadline()
Expand Down

0 comments on commit ebd0b9d

Please sign in to comment.