Skip to content

Commit

Permalink
Noop types comply with schema
Browse files Browse the repository at this point in the history
  • Loading branch information
russcam committed Dec 14, 2020
1 parent 358f8ea commit b2b83b1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
12 changes: 11 additions & 1 deletion src/Elastic.Apm/Model/NoopSpan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
using System.Diagnostics;
using System.Threading.Tasks;
using Elastic.Apm.Api;
using Elastic.Apm.Api.Constraints;
using Newtonsoft.Json;

namespace Elastic.Apm.Model
{
Expand Down Expand Up @@ -42,23 +44,31 @@ internal NoopSpan(string name, string type, string subtype, string action,
_currentExecutionSegmentsContainer.CurrentSpan = this;
_parentSpan = parentSpan;
}

[MaxLength]
public string Action { get; set; }
public SpanContext Context => ReusableContextInstance;

public double? Duration { get; set; }
[MaxLength]
public string Id { get; }
public bool IsSampled => false;
public Dictionary<string, string> Labels => _labels.Value;
[MaxLength]
public string Name { get; set; }
public Outcome Outcome { get; set; }
public DistributedTracingData OutgoingDistributedTracingData => null;
[JsonProperty("parent_id")]
[MaxLength]
public string ParentId { get; }
public List<CapturedStackFrame> StackTrace { get; }
[MaxLength]
public string Subtype { get; set; }
public long Timestamp { get; }
[JsonProperty("trace_id")]
[MaxLength]
public string TraceId { get; }
public string TransactionId { get; }
[MaxLength]
public string Type { get; set; }

public void CaptureError(string message, string culprit, StackFrame[] frames, string parentId = null, Dictionary<string, Label> labels = null
Expand Down
13 changes: 11 additions & 2 deletions src/Elastic.Apm/Model/NoopTransaction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
using System.Diagnostics;
using System.Threading.Tasks;
using Elastic.Apm.Api;
using Elastic.Apm.Api.Constraints;
using Newtonsoft.Json;

namespace Elastic.Apm.Model
{
Expand Down Expand Up @@ -38,18 +40,25 @@ public NoopTransaction(string name, string type, ICurrentExecutionSegmentsContai

public Dictionary<string, string> Custom => _custom.Value;
public double? Duration { get; set; }
[MaxLength]
public string Id { get; }
public bool IsSampled => false;
public Dictionary<string, string> Labels => _labels.Value;
[MaxLength]
public string Name { get; set; }
public Outcome Outcome { get; set; }
public DistributedTracingData OutgoingDistributedTracingData { get; }
[JsonProperty("parent_id")]
[MaxLength]
public string ParentId { get; }
[MaxLength]
public string Result { get; set; }

[JsonProperty("span_count")]
public SpanCount SpanCount { get; }
[JsonProperty("trace_id")]
[MaxLength]
public string TraceId { get; }

[MaxLength]
public string Type { get; set; }

public void CaptureError(string message, string culprit, StackFrame[] frames, string parentId = null, Dictionary<string, Label> labels = null
Expand Down

0 comments on commit b2b83b1

Please sign in to comment.