Skip to content

Commit 30c1fe0

Browse files
committed
Shorten up metric names so they meet otel standards
1 parent e239e13 commit 30c1fe0

File tree

8 files changed

+49
-51
lines changed

8 files changed

+49
-51
lines changed

k8s/ex-prod-elasticsearch.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ spec:
1616
- name: main-v2
1717
count: 4
1818
config:
19-
node.master: true
20-
node.data: true
21-
node.ingest: true
19+
node.roles: [data, ingest, master]
2220
action.destructive_requires_name: true
2321
# if not setting max_map_count in an init container, then use this setting
2422
#node.store.allow_mmap: false

k8s/ex-prod-values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ config:
3636
EX_SmtpFrom: "Exceptionless <noreply@exceptionless.io>"
3737
EX_TestEmailAddress: "test@exceptionless.io"
3838
EX_EnableArchive: "false"
39-
EX_Apm__Endpoint: http://ex-prod-monitor-apm-http:8200
39+
EX_Apm__Endpoint: http://apm.elastic-system.svc:8200
4040
EX_Apm__EnableLogs: "true"
4141
EX_Apm__EnableMetrics: "true"
4242
EX_Apm__EnableTracing: "true"

k8s/ex-setup.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ choco install azure-cli
1212
choco install kubernetes-helm
1313
helm repo add "stable" "https://charts.helm.sh/stable" --force-update
1414
helm repo add jetstack https://charts.jetstack.io
15+
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts ❮ 3s 868ms  
1516
helm repo update
1617

1718
### setup
@@ -98,6 +99,9 @@ curl -X PUT -H "Content-Type: application/json" -k `
9899

99100
Remove-Job $ELASTIC_JOB
100101

102+
# install kube-state-metrics
103+
helm install --namespace elastic-system kube-state-metrics prometheus-community/kube-state-metrics
104+
101105
# install nginx ingress
102106
helm install --namespace ingress-nginx -f nginx-values.yaml ingress-nginx ingress-nginx/ingress-nginx
103107

src/Exceptionless.Core/Pipeline/Base/PipelineBase.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace Exceptionless.Core.Pipeline;
1818
/// </remarks>
1919
public abstract class PipelineBase<TContext, TAction> where TAction : class, IPipelineAction<TContext> where TContext : IPipelineContext
2020
{
21-
protected static readonly ConcurrentDictionary<Type, IList<Type>> _actionTypeCache = new ConcurrentDictionary<Type, IList<Type>>();
21+
protected static readonly ConcurrentDictionary<Type, IList<Type>> _actionTypeCache = new();
2222
private readonly IServiceProvider _serviceProvider;
2323
private readonly AppOptions _options;
2424
private readonly IList<IPipelineAction<TContext>> _actions;
@@ -31,7 +31,7 @@ public PipelineBase(IServiceProvider serviceProvider, AppOptions options, ILogge
3131
_options = options;
3232

3333
var type = GetType();
34-
_metricPrefix = String.Concat("pipeline.", type.Name.ToLower(), ".");
34+
_metricPrefix = String.Concat(type.Name.ToLower(), ".");
3535
_logger = loggerFactory?.CreateLogger(type);
3636

3737
_actions = LoadDefaultActions();
@@ -55,10 +55,9 @@ public virtual async Task<ICollection<TContext>> RunAsync(ICollection<TContext>
5555
{
5656
PipelineRunning(contexts);
5757

58-
string metricPrefix = String.Concat(_metricPrefix, nameof(RunAsync).ToLower(), ".");
5958
foreach (var action in _actions)
6059
{
61-
string metricName = String.Concat(metricPrefix, action.Name.ToLower());
60+
string metricName = String.Concat(_metricPrefix, action.Name.ToLower());
6261
var contextsToProcess = contexts.Where(c => c.IsCancelled == false && !c.HasError).ToList();
6362
await AppDiagnostics.TimeAsync(() => action.ProcessBatchAsync(contextsToProcess), metricName).AnyContext();
6463
if (contextsToProcess.All(c => c.IsCancelled || c.HasError))

src/Exceptionless.Core/Plugins/EventProcessor/EventPluginManager.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,11 @@ public EventPluginManager(IServiceProvider serviceProvider, AppOptions options,
1212
/// </summary>
1313
public async Task StartupAsync()
1414
{
15-
string metricPrefix = String.Concat("events.startup.");
1615
foreach (var plugin in Plugins.Values.ToList())
1716
{
1817
try
1918
{
20-
string metricName = String.Concat(metricPrefix, plugin.Name.ToLower());
19+
string metricName = String.Concat(_metricPrefix, plugin.Name.ToLower());
2120
await AppDiagnostics.TimeAsync(() => plugin.StartupAsync(), metricName).AnyContext();
2221
}
2322
catch (Exception ex)
@@ -32,14 +31,13 @@ public async Task StartupAsync()
3231
/// </summary>
3332
public async Task EventBatchProcessingAsync(ICollection<EventContext> contexts)
3433
{
35-
string metricPrefix = String.Concat(_metricPrefix, "events.processing.");
3634
foreach (var plugin in Plugins.Values)
3735
{
3836
var contextsToProcess = contexts.Where(c => c.IsCancelled == false && !c.HasError).ToList();
3937
if (contextsToProcess.Count == 0)
4038
break;
4139

42-
string metricName = String.Concat(metricPrefix, plugin.Name.ToLower());
40+
string metricName = String.Concat(_metricPrefix, plugin.Name.ToLower());
4341
try
4442
{
4543
await AppDiagnostics.TimeAsync(() => plugin.EventBatchProcessingAsync(contextsToProcess), metricName).AnyContext();
@@ -58,14 +56,13 @@ public async Task EventBatchProcessingAsync(ICollection<EventContext> contexts)
5856
/// </summary>
5957
public async Task EventBatchProcessedAsync(ICollection<EventContext> contexts)
6058
{
61-
string metricPrefix = String.Concat("events.processed.");
6259
foreach (var plugin in Plugins.Values)
6360
{
6461
var contextsToProcess = contexts.Where(c => c.IsCancelled == false && !c.HasError).ToList();
6562
if (contextsToProcess.Count == 0)
6663
break;
6764

68-
string metricName = String.Concat(metricPrefix, plugin.Name.ToLower());
65+
string metricName = String.Concat(_metricPrefix, plugin.Name.ToLower());
6966
try
7067
{
7168
await AppDiagnostics.TimeAsync(() => plugin.EventBatchProcessedAsync(contextsToProcess), metricName).AnyContext();

src/Exceptionless.Core/Plugins/PluginManagerBase.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public abstract class PluginManagerBase<TPlugin> where TPlugin : class, IPlugin
1414
public PluginManagerBase(IServiceProvider serviceProvider, AppOptions options, ILoggerFactory loggerFactory = null)
1515
{
1616
var type = GetType();
17-
_metricPrefix = String.Concat("plugin.");
17+
_metricPrefix = "";
1818
_logger = loggerFactory?.CreateLogger(type);
1919
_serviceProvider = serviceProvider;
2020
_options = options;
@@ -42,7 +42,7 @@ private void LoadDefaultPlugins()
4242
{
4343
if (_options.DisabledPlugins.Contains(type.Name, StringComparer.InvariantCultureIgnoreCase))
4444
{
45-
_logger.LogWarning("Plugin {TypeName} is currently disabled and won't be executed.", type.Name);
45+
_logger.LogWarning("Plugin {TypeName} is currently disabled and won't be executed", type.Name);
4646
continue;
4747
}
4848

src/Exceptionless.Core/Plugins/WebHook/WebHookDataPluginManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public WebHookDataPluginManager(IServiceProvider serviceProvider, AppOptions opt
1212
/// </summary>
1313
public async Task<object> CreateFromEventAsync(WebHookDataContext context)
1414
{
15-
string metricPrefix = String.Concat(_metricPrefix, nameof(CreateFromEventAsync).ToLower(), ".");
15+
string metricPrefix = String.Concat(_metricPrefix, "ev-create", ".");
1616
foreach (var plugin in Plugins.Values)
1717
{
1818
string metricName = String.Concat(metricPrefix, plugin.Name.ToLower());
@@ -42,7 +42,7 @@ public async Task<object> CreateFromEventAsync(WebHookDataContext context)
4242
/// </summary>
4343
public async Task<object> CreateFromStackAsync(WebHookDataContext context)
4444
{
45-
string metricPrefix = String.Concat(_metricPrefix, nameof(CreateFromStackAsync).ToLower(), ".");
45+
string metricPrefix = String.Concat(_metricPrefix, "st-create", ".");
4646
foreach (var plugin in Plugins.Values)
4747
{
4848
string metricName = String.Concat(metricPrefix, plugin.Name.ToLower());

src/Exceptionless.Core/Utility/AppDiagnostics.cs

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public static class AppDiagnostics
1212
internal static readonly string AssemblyVersion = typeof(AppDiagnostics).Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion ?? AssemblyName.Version.ToString();
1313
internal static readonly ActivitySource ActivitySource = new(AssemblyName.Name, AssemblyVersion);
1414
internal static readonly Meter Meter = new("Exceptionless", AssemblyVersion);
15-
private static readonly string _metricsPrefix = "exceptionless.";
15+
private static readonly string _metricsPrefix = "ex.";
1616

1717
private static readonly ConcurrentDictionary<string, Counter<int>> _counters = new();
1818
private static readonly ConcurrentDictionary<string, GaugeInfo> _gauges = new();
@@ -79,38 +79,38 @@ public GaugeInfo(Meter meter, string name)
7979
public double Value { get; set; }
8080
}
8181

82-
internal static readonly Counter<int> EventsSubmitted = Meter.CreateCounter<int>("exceptionless.events.submitted", description: "Events submitted to the pipeline to be processed");
83-
internal static readonly Counter<int> EventsProcessed = Meter.CreateCounter<int>("exceptionless.events.all.processed", description: "Events successfully processed by the pipeline");
84-
internal static readonly Histogram<double> EventsProcessingTime = Meter.CreateHistogram<double>("exceptionless.events.processingtime", description: "Time to process an event", unit: "ms");
85-
internal static readonly Counter<int> EventsPaidProcessed = Meter.CreateCounter<int>("exceptionless.events.paid.processed", description: "Paid events processed");
86-
internal static readonly Counter<int> EventsProcessErrors = Meter.CreateCounter<int>("exceptionless.events.processing.errors", description: "Errors processing events");
87-
internal static readonly Counter<int> EventsDiscarded = Meter.CreateCounter<int>("exceptionless.events.discarded", description: "Events that were discarded");
88-
internal static readonly Counter<int> EventsBlocked = Meter.CreateCounter<int>("exceptionless.events.blocked", description: "Events that were blocked");
89-
internal static readonly Counter<int> EventsProcessCancelled = Meter.CreateCounter<int>("exceptionless.events.processing.cancelled", description: "Events that started processing and were cancelled");
90-
internal static readonly Counter<int> EventsRetryCount = Meter.CreateCounter<int>("exceptionless.events.retry.count", description: "Events where processing was retried");
91-
internal static readonly Counter<int> EventsRetryErrors = Meter.CreateCounter<int>("exceptionless.events.retry.errors", description: "Events where retry processing got an error");
92-
internal static readonly Histogram<double> EventsFieldCount = Meter.CreateHistogram<double>("exceptionless.events.field.count", description: "Number of fields per event");
93-
94-
internal static readonly Counter<int> PostsParsed = Meter.CreateCounter<int>("exceptionless.posts.parsed", description: "Post batch submission parsed");
95-
internal static readonly Histogram<double> PostsEventCount = Meter.CreateHistogram<double>("exceptionless.posts.eventcount", description: "Number of events in post batch submission");
96-
internal static readonly Histogram<double> PostsSize = Meter.CreateHistogram<double>("exceptionless.posts.size", description: "Size of post batch submission", unit: "bytes");
97-
internal static readonly Counter<int> PostsParseErrors = Meter.CreateCounter<int>("exceptionless.posts.parse.errors", description: "Error parsing post batch submission");
98-
internal static readonly Histogram<double> PostsMarkFileActiveTime = Meter.CreateHistogram<double>("exceptionless.posts.markfileactivetime", description: "Time to mark a post submission file active", unit: "ms");
99-
internal static readonly Histogram<double> PostsParsingTime = Meter.CreateHistogram<double>("exceptionless.posts.parsingtime", description: "Time to parse post batch submission", unit: "ms");
100-
internal static readonly Histogram<double> PostsRetryTime = Meter.CreateHistogram<double>("exceptionless.posts.retrytime", description: "Time to retry post batch parsing", unit: "ms");
101-
internal static readonly Histogram<double> PostsAbandonTime = Meter.CreateHistogram<double>("exceptionless.posts.abandontime", description: "Time to abandon post", unit: "ms");
102-
internal static readonly Histogram<double> PostsCompleteTime = Meter.CreateHistogram<double>("exceptionless.posts.completetime", description: "Time to complete a post", unit: "ms");
103-
internal static readonly Counter<int> PostsDiscarded = Meter.CreateCounter<int>("exceptionless.posts.discarded", description: "Post batch submissions discarded");
104-
internal static readonly Counter<int> PostTooBig = Meter.CreateCounter<int>("exceptionless.posts.toobig", description: "Post batch submission too big");
105-
internal static readonly Counter<int> PostsBlocked = Meter.CreateCounter<int>("exceptionless.posts.blocked", description: "Post batch submission blocked");
106-
107-
internal static readonly Histogram<long> PostsMessageSize = Meter.CreateHistogram<long>("exceptionless.posts.message.size", description: "Size of posts", unit: "bytes");
108-
internal static readonly Histogram<double> PostsCompressedSize = Meter.CreateHistogram<double>("exceptionless.posts.compressed.size", description: "Size of compressed post", unit: "bytes");
109-
internal static readonly Histogram<double> PostsUncompressedSize = Meter.CreateHistogram<double>("exceptionless.posts.uncompressed.size", description: "Size of uncompressed post", unit: "bytes");
110-
internal static readonly Histogram<double> PostsDecompressionTime = Meter.CreateHistogram<double>("exceptionless.posts.decompression.time", description: "Time to get event post", unit: "ms");
111-
internal static readonly Counter<int> PostsDecompressionErrors = Meter.CreateCounter<int>("exceptionless.posts.decompression.errors", description: "Time to get event post");
112-
113-
internal static readonly Counter<int> UsageGeocodingApi = Meter.CreateCounter<int>("exceptionless.usage.geocoding", description: "Geocode API calls");
82+
internal static readonly Counter<int> EventsSubmitted = Meter.CreateCounter<int>("ex.events.submitted", description: "Events submitted to the pipeline to be processed");
83+
internal static readonly Counter<int> EventsProcessed = Meter.CreateCounter<int>("ex.events.all.processed", description: "Events successfully processed by the pipeline");
84+
internal static readonly Histogram<double> EventsProcessingTime = Meter.CreateHistogram<double>("ex.events.processingtime", description: "Time to process an event", unit: "ms");
85+
internal static readonly Counter<int> EventsPaidProcessed = Meter.CreateCounter<int>("ex.events.paid.processed", description: "Paid events processed");
86+
internal static readonly Counter<int> EventsProcessErrors = Meter.CreateCounter<int>("ex.events.processing.errors", description: "Errors processing events");
87+
internal static readonly Counter<int> EventsDiscarded = Meter.CreateCounter<int>("ex.events.discarded", description: "Events that were discarded");
88+
internal static readonly Counter<int> EventsBlocked = Meter.CreateCounter<int>("ex.events.blocked", description: "Events that were blocked");
89+
internal static readonly Counter<int> EventsProcessCancelled = Meter.CreateCounter<int>("ex.events.processing.cancelled", description: "Events that started processing and were cancelled");
90+
internal static readonly Counter<int> EventsRetryCount = Meter.CreateCounter<int>("ex.events.retry.count", description: "Events where processing was retried");
91+
internal static readonly Counter<int> EventsRetryErrors = Meter.CreateCounter<int>("ex.events.retry.errors", description: "Events where retry processing got an error");
92+
internal static readonly Histogram<double> EventsFieldCount = Meter.CreateHistogram<double>("ex.events.field.count", description: "Number of fields per event");
93+
94+
internal static readonly Counter<int> PostsParsed = Meter.CreateCounter<int>("ex.posts.parsed", description: "Post batch submission parsed");
95+
internal static readonly Histogram<double> PostsEventCount = Meter.CreateHistogram<double>("ex.posts.eventcount", description: "Number of events in post batch submission");
96+
internal static readonly Histogram<double> PostsSize = Meter.CreateHistogram<double>("ex.posts.size", description: "Size of post batch submission", unit: "bytes");
97+
internal static readonly Counter<int> PostsParseErrors = Meter.CreateCounter<int>("ex.posts.parse.errors", description: "Error parsing post batch submission");
98+
internal static readonly Histogram<double> PostsMarkFileActiveTime = Meter.CreateHistogram<double>("ex.posts.markfileactivetime", description: "Time to mark a post submission file active", unit: "ms");
99+
internal static readonly Histogram<double> PostsParsingTime = Meter.CreateHistogram<double>("ex.posts.parsingtime", description: "Time to parse post batch submission", unit: "ms");
100+
internal static readonly Histogram<double> PostsRetryTime = Meter.CreateHistogram<double>("ex.posts.retrytime", description: "Time to retry post batch parsing", unit: "ms");
101+
internal static readonly Histogram<double> PostsAbandonTime = Meter.CreateHistogram<double>("ex.posts.abandontime", description: "Time to abandon post", unit: "ms");
102+
internal static readonly Histogram<double> PostsCompleteTime = Meter.CreateHistogram<double>("ex.posts.completetime", description: "Time to complete a post", unit: "ms");
103+
internal static readonly Counter<int> PostsDiscarded = Meter.CreateCounter<int>("ex.posts.discarded", description: "Post batch submissions discarded");
104+
internal static readonly Counter<int> PostTooBig = Meter.CreateCounter<int>("ex.posts.toobig", description: "Post batch submission too big");
105+
internal static readonly Counter<int> PostsBlocked = Meter.CreateCounter<int>("ex.posts.blocked", description: "Post batch submission blocked");
106+
107+
internal static readonly Histogram<long> PostsMessageSize = Meter.CreateHistogram<long>("ex.posts.message.size", description: "Size of posts", unit: "bytes");
108+
internal static readonly Histogram<double> PostsCompressedSize = Meter.CreateHistogram<double>("ex.posts.compressed.size", description: "Size of compressed post", unit: "bytes");
109+
internal static readonly Histogram<double> PostsUncompressedSize = Meter.CreateHistogram<double>("ex.posts.uncompressed.size", description: "Size of uncompressed post", unit: "bytes");
110+
internal static readonly Histogram<double> PostsDecompressionTime = Meter.CreateHistogram<double>("ex.posts.decompression.time", description: "Time to get event post", unit: "ms");
111+
internal static readonly Counter<int> PostsDecompressionErrors = Meter.CreateCounter<int>("ex.posts.decompression.errors", description: "Time to get event post");
112+
113+
internal static readonly Counter<int> UsageGeocodingApi = Meter.CreateCounter<int>("ex.usage.geocoding", description: "Geocode API calls");
114114
}
115115

116116
public static class MetricsClientExtensions

0 commit comments

Comments
 (0)