Skip to content

Commit

Permalink
Use ComponentId instead of ComponentName (#498)
Browse files Browse the repository at this point in the history
  • Loading branch information
feiyun0112 authored Aug 19, 2022
1 parent 51fc719 commit 596b357
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@
*
*/

using SkyApm.Common;
using System.Data.Common;

namespace SkyApm.Diagnostics.EntityFrameworkCore
{
public class NpgsqlEntityFrameworkCoreSpanMetadataProvider : IEntityFrameworkCoreSpanMetadataProvider
{
public string Component { get; } = Common.Components.NPGSQL_ENTITYFRAMEWORKCORE_POSTGRESQL.GetStringValue();
public StringOrIntValue Component { get; } = Common.Components.NPGSQL_ENTITYFRAMEWORKCORE_POSTGRESQL;

public bool Match(DbConnection connection)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@
*
*/

using SkyApm.Common;
using System.Data.Common;

namespace SkyApm.Diagnostics.EntityFrameworkCore
{
public class MySqlEntityFrameworkCoreSpanMetadataProvider : IEntityFrameworkCoreSpanMetadataProvider
{
public string Component { get; } = Common.Components.POMELO_ENTITYFRAMEWORKCORE_MYSQL.GetStringValue();
public StringOrIntValue Component { get; } = Common.Components.POMELO_ENTITYFRAMEWORKCORE_MYSQL;

public bool Match(DbConnection connection)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@
*
*/

using SkyApm.Common;
using System.Data.Common;

namespace SkyApm.Diagnostics.EntityFrameworkCore
{
public class SqliteEntityFrameworkCoreSpanMetadataProvider : IEntityFrameworkCoreSpanMetadataProvider
{
public string Component { get; } = Common.Components.ENTITYFRAMEWORKCORE_SQLITE.GetStringValue();
public StringOrIntValue Component { get; } = Common.Components.ENTITYFRAMEWORKCORE_SQLITE;

public bool Match(DbConnection connection)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ private SegmentContext CreateExitSegment(string operationName, DbCommand dbComma
{
var context = _tracingContext.CreateExitSegmentContext(operationName,
metadataProvider.GetPeer(dbCommand.Connection));
context.Span.Component = new StringOrIntValue(metadataProvider.Component);
context.Span.Component = metadataProvider.Component;
return context;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@
*
*/

using SkyApm.Common;
using System.Data.Common;

namespace SkyApm.Diagnostics.EntityFrameworkCore
{
public interface IEntityFrameworkCoreSpanMetadataProvider
{
string Component { get; }
StringOrIntValue Component { get; }

bool Match(DbConnection connection);

Expand Down

0 comments on commit 596b357

Please sign in to comment.