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

beam 3174 - open telemetry #1841

Draft
wants to merge 29 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ef329dc
playing with openTelemetry
cdhanna Oct 18, 2022
b5d22df
more tracing
cdhanna Oct 19, 2022
c3cd60e
cleaning up
chrisbeamable Oct 24, 2022
eb1298b
ignores datadog in base image
chrisbeamable Oct 24, 2022
e2d2ef7
fix null
chrisbeamable Oct 24, 2022
341dfc4
changelog
chrisbeamable Oct 24, 2022
80b7276
Merge branch 'main' into feature/beam-3174
chrisbeamable Oct 24, 2022
ef513cc
Making tracing work with DD
Brandoffsky Nov 3, 2022
fcc8066
Adding initial code for including Gateway trace spans.
Brandoffsky Nov 21, 2022
d6affa1
More code for connecting trace spans
Brandoffsky Nov 29, 2022
489207f
success and log trace name
chrisbeamable Nov 29, 2022
47886ec
set the client callable finish
chrisbeamable Nov 29, 2022
4939b99
env
chrisbeamable Nov 29, 2022
8634b3d
reduce logging
chrisbeamable Nov 29, 2022
bb4d9cd
less json
chrisbeamable Nov 29, 2022
669fbac
Update MicroserviceArgs.cs
Brandoffsky Nov 29, 2022
e6e5c7f
[BEAM-3280] C#MS - truncate log bodies over 1000 characters
LukaszwBeamable Nov 30, 2022
84fa8df
[BEAM-3280] changelog update
LukaszwBeamable Nov 30, 2022
d491e73
rate limiting test
chrisbeamable Nov 30, 2022
3882191
use ratelimiting
chrisbeamable Nov 30, 2022
ce2c473
Merge branch 'feature/beam-3281' into feature/beam-3174
chrisbeamable Nov 30, 2022
e34cdfa
flip ratelimit
chrisbeamable Nov 30, 2022
809272a
Merge branch 'feature/BEAM-3280' into feature/beam-3174
chrisbeamable Nov 30, 2022
f6ac345
use seconds instead of minutes
chrisbeamable Nov 30, 2022
e732246
[BEAM-3280] improvements
LukaszwBeamable Dec 1, 2022
7a190cb
[BEAM-3280] env setup
LukaszwBeamable Dec 1, 2022
6f0f787
[BEAM-3280] tweak
LukaszwBeamable Dec 1, 2022
968fc08
adjusting log limits and added disposal
chrisbeamable Dec 1, 2022
54da53f
Merge branch 'feature/BEAM-3280' into feature/beam-3174
chrisbeamable Dec 1, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions client/Packages/com.beamable.server/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]
### Changed
- Open Telemetry configuration in base image.
- Exposed methods for access to public player stats:
- `GetPublicPlayerStat`
- `GetPublicPlayerStats`
- `GetAllPublicPlayerStats`
- Inbound requests are rate limited to avoid out of memory failures.

### Added
- Microservice message log size limit.

## [1.6.2]
### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ public class RunServiceCommand : RunImageCommand
public const string ENV_WATCH_TOKEN = "WATCH_TOKEN";
public const string ENV_DISABLE_RUN_CUSTOM_HOOK = "DISABLE_CUSTOM_INITIALIZATION_HOOKS";
public const string ENV_DISABLE_EMOJI = "DOTNET_WATCH_SUPPRESS_EMOJIS";
public const string ENV_DISABLE_LOG_TRUNCATE = "DISABLE_LOG_TRUNCATE";

public RunServiceCommand(MicroserviceDescriptor service,
string cid,
Expand All @@ -186,6 +187,9 @@ public class RunServiceCommand : RunImageCommand
PruneAfterStartup = true;
Environment = new Dictionary<string, string>()
{
// ["OTEL_EXPORTER_OTLP_ENDPOINT"] = "http://otel-collector:4317",
// ["EMIT_OTEL"] = "true",
// ["EMIT_OTEL_METRICS"] = "true",
[ENV_CID] = cid,
[ENV_PID] = pid,
[ENV_SECRET] = secret,
Expand All @@ -194,7 +198,8 @@ public class RunServiceCommand : RunImageCommand
[ENV_NAME_PREFIX] = MicroserviceIndividualization.Prefix,
[ENV_WATCH_TOKEN] = watch.ToString(),
[ENV_DISABLE_RUN_CUSTOM_HOOK] = (!shouldRunCustomHooks).ToString(),
[ENV_DISABLE_EMOJI] = "1"
[ENV_DISABLE_EMOJI] = "1",
[ENV_DISABLE_LOG_TRUNCATE] = "true"
};

if (_watch)
Expand Down Expand Up @@ -241,6 +246,12 @@ public class RunServiceCommand : RunImageCommand
}
MapDotnetCompileErrors();
}

// // this will enable sending otel data to a local running signoz instance.
// protected override string GetCustomDockerFlags()
// {
// return "--net clickhouse-setup_default ";
// }

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using Beamable.Server.Api.Social;
using Beamable.Server.Api.Stats;
using Beamable.Server.Api.Tournament;
using beamable.server.Tracing;

namespace Beamable.Server
{
Expand Down Expand Up @@ -155,5 +156,10 @@ public interface IBeamableServices
/// %Microservice entry point for payment operations.
/// </summary>
IMicroservicePaymentsApi Payments { get; }

/// <summary>
/// Add custom tracing to client callables
/// </summary>
IBeamableTracer Tracing { get; }
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;

namespace beamable.server.Tracing
{

public interface IBeamableTracer
{
/// <summary>
/// Begin an Open Telemetry trace.
/// You must dispose the returned <see cref="IBeamTrace"/> to end the trace.
/// Consider a `using` statement.
/// </summary>
/// <param name="name">The name of the trace</param>
/// <returns>A <see cref="IBeamTrace"/> object that can store additional meta information.</returns>
IBeamTrace Start(string name);

/// <summary>
/// Retrieve a <see cref="IBeamMetricCounter{T}"/> for the given name.
/// The first time this method is invoked per <see cref="name"/> value, a new instance will be created.
/// However, every subsequent invocation per <see cref="name"/> value will return the initial instance.
///
/// The <see cref="unit"/> and <see cref="description"/> fields applied on the first invocation will stay permanent.
/// </summary>
/// <param name="name">The name of the metric. This should be unique.</param>
/// <param name="unit"></param>
/// <param name="description"></param>
/// <typeparam name="T">Must be a struct like type that is countable, like long, int, or double.</typeparam>
/// <returns>A <see cref="IBeamMetricCounter{T}"/> instance</returns>
IBeamMetricCounter<T> GetCounter<T>(string name, string unit=null, string description=null) where T : struct;
}

public interface IBeamTrace : IDisposable
{
/// <summary>
/// Set a tag value for the trace.
/// </summary>
/// <param name="tagName">The name of the tag; should be unique. </param>
/// <param name="value">The value of the tag. It can be a string, or simple object such as int, long, or bool. Complex types won't be supported. </param>
public void SetTag(string tagName, object value);

/// <summary>
/// Set many tags as key value pairs.
/// </summary>
/// <param name="tags">A set of <see cref="KeyValuePair{TKey,TValue}"/></param>
public void SetTags(IEnumerable<KeyValuePair<string, object>> tags);

/// <summary>
/// Mark the trace in an error state.
/// </summary>
/// <param name="ex">The exception that caused the trace to fail.</param>
public void RecordException(Exception ex);
}

public interface IBeamMetricCounter<T> where T : struct
{
/// <summary>
/// adds the given value to the metric value.
/// </summary>
/// <param name="value">How much to increment the metric by</param>
/// <param name="tags">An optional set of tags for the increase event</param>
void Add(T value, params KeyValuePair<string, object>[] tags);
}

public static class BeamMetricCounterExtensions
{
/// <summary>
/// Increment the given counter by 1.
/// </summary>
/// <param name="counter"></param>
/// <param name="tags">An optional set of tags for the event</param>
public static void Increment(this IBeamMetricCounter<int> counter, params KeyValuePair<string, object>[] tags) => counter.Add(1, tags);

/// <summary>
/// Increment the given counter by 1.
/// </summary>
/// <param name="counter"></param>
/// <param name="tags">An optional set of tags for the event</param>
public static void Increment(this IBeamMetricCounter<long> counter, params KeyValuePair<string, object>[] tags) => counter.Add(1, tags);
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion microservice/microservice/baseImageDocs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.