-
Notifications
You must be signed in to change notification settings - Fork 297
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated MassTransit instrumentation to OpenTelemetry 1.0 (#85)
* Updated MassTransit instrumentation * fixed unit tests * Assert only sampled traces * Update CODEOWNERS
- Loading branch information
1 parent
8323c83
commit 3bac8e7
Showing
10 changed files
with
138 additions
and
84 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
...ntrib.Instrumentation.MassTransit/Implementation/MassTransitInstrumentationEventSource.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// <copyright file="MassTransitInstrumentationEventSource.cs" company="OpenTelemetry Authors"> | ||
// Copyright The OpenTelemetry Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// </copyright> | ||
|
||
using System; | ||
using System.Diagnostics.Tracing; | ||
using OpenTelemetry.Internal; | ||
|
||
namespace OpenTelemetry.Contrib.Instrumentation.MassTransit.Implementation | ||
{ | ||
/// <summary> | ||
/// EventSource events emitted from the project. | ||
/// </summary> | ||
[EventSource(Name = "OpenTelemetry-Instrumentation-MassTransit")] | ||
internal class MassTransitInstrumentationEventSource : EventSource | ||
{ | ||
public static MassTransitInstrumentationEventSource Log = new MassTransitInstrumentationEventSource(); | ||
|
||
[Event(1, Message = "Request is filtered out.", Level = EventLevel.Verbose)] | ||
public void RequestIsFilteredOut(string eventName) | ||
{ | ||
this.WriteEvent(1, eventName); | ||
} | ||
|
||
[NonEvent] | ||
public void EnrichmentException(Exception ex) | ||
{ | ||
if (this.IsEnabled(EventLevel.Error, (EventKeywords)(-1))) | ||
{ | ||
this.EnrichmentException(ex.ToInvariantString()); | ||
} | ||
} | ||
|
||
[Event(2, Message = "Enrich threw exception. Exception {0}.", Level = EventLevel.Error)] | ||
public void EnrichmentException(string exception) | ||
{ | ||
this.WriteEvent(2, exception); | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...etry.Contrib.Instrumentation.MassTransit/Implementation/MassTransitSemanticConventions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// <copyright file="MassTransitSemanticConventions.cs" company="OpenTelemetry Authors"> | ||
// Copyright The OpenTelemetry Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// </copyright> | ||
|
||
namespace OpenTelemetry.Contrib.Instrumentation.MassTransit.Implementation | ||
{ | ||
internal class MassTransitSemanticConventions | ||
{ | ||
public const string AttributeMessagingMassTransitInitiatorId = "messaging.masstransit.initiator_id"; | ||
public const string AttributeMessagingMassTransitCorrelationId = "messaging.masstransit.correlation_id"; | ||
public const string AttributeMessagingMassTransitConsumerType = "messaging.masstransit.consumer_type"; | ||
} | ||
} |
46 changes: 0 additions & 46 deletions
46
src/OpenTelemetry.Contrib.Instrumentation.MassTransit/Implementation/SemanticConventions.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters