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

key (labelSet) already existed in dictionary #809

Closed
MaSUB opened this issue Nov 11, 2021 · 2 comments
Closed

key (labelSet) already existed in dictionary #809

MaSUB opened this issue Nov 11, 2021 · 2 comments
Assignees
Labels
Component/Management Issues related to Steeltoe Management (actuators) ReleaseLine/3.x Identified as a feature/fix for the 3.x release line Type/bug Something isn't working
Milestone

Comments

@MaSUB
Copy link

MaSUB commented Nov 11, 2021

Describe the bug

Periodically we get the following exception:

System.ArgumentException: The key already existed in the dictionary.
   at System.Collections.Concurrent.ConcurrentDictionary`2.System.Collections.Generic.IDictionary<TKey,TValue>.Add(TKey key, TValue value)
   at Steeltoe.Management.OpenTelemetry.Metrics.MeasureMetricSdk`1.Bind(LabelSet labelset)
   at Steeltoe.Management.OpenTelemetry.Metrics.MeasureMetricSdk`1.Bind(IEnumerable`1 labels)
   at Steeltoe.Management.OpenTelemetry.Metrics.MeasureMetric`1.Record(SpanContext& context, T value, IEnumerable`1 labels)
   at Steeltoe.Management.Endpoint.Metrics.Observer.AspNetCoreHostingObserver.HandleStopEvent(Activity current, HttpContext arg)
   at Steeltoe.Management.Endpoint.Metrics.Observer.AspNetCoreHostingObserver.ProcessEvent(String evnt, Object arg)
   at Steeltoe.Common.Diagnostics.DiagnosticObserver.OnNext(KeyValuePair`2 event)

This seems to be tied to code in the class CounterMetricSdkBase<T> Bind(LabelSet labelset, bool isShortLived) when adding to the _counterBoundInstruments I believe this should be an AddOrUpdate.

Steps to reproduce

Steps to reproduce the behavior:
Generally have just been allowing my app to run locally and it will eventually throw this exception without any outside input or requests to the API/service.

Expected behavior

labelSet should be updated if already existing

Environment (please complete the following information):

  • Steeltoe Version 3.1.0
  • Platform: Cloud Foundry
  • OS: Linux
  • .NET Version .Net Core 3.1
  • Any other library versions to note

Additional context or links

Link to code in question

@MaSUB MaSUB added the Type/bug Something isn't working label Nov 11, 2021
@TimHess TimHess added Component/Management Issues related to Steeltoe Management (actuators) ReleaseLine/3.x Identified as a feature/fix for the 3.x release line labels Nov 15, 2021
@TimHess TimHess added this to the 3.2.0 milestone Dec 8, 2021
@hananiel
Copy link
Contributor

hananiel commented Dec 8, 2021

will be addressed in #299

@hananiel
Copy link
Contributor

Resolved by #828

@TimHess TimHess closed this as completed May 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component/Management Issues related to Steeltoe Management (actuators) ReleaseLine/3.x Identified as a feature/fix for the 3.x release line Type/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants