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

merge #1

Merged
merged 7 commits into from
Jun 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 123 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# To learn more about .editorconfig see https://aka.ms/editorconfigdocs
###############################
# Core EditorConfig Options #
###############################
# All files
[*]
indent_style = space
# Code files
[*.{cs,csx,vb,vbx}]
indent_size = 4
insert_final_newline = true
charset = utf-8-bom
###############################
# .NET Coding Conventions #
###############################
[*.{cs,vb}]
# Organize usings
dotnet_sort_system_directives_first = true
# this. preferences
dotnet_style_qualification_for_field = false:silent
dotnet_style_qualification_for_property = false:silent
dotnet_style_qualification_for_method = false:silent
dotnet_style_qualification_for_event = false:silent
# Language keywords vs BCL types preferences
dotnet_style_predefined_type_for_locals_parameters_members = true:silent
dotnet_style_predefined_type_for_member_access = true:silent
# Parentheses preferences
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
# Modifier preferences
dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
dotnet_style_readonly_field = true:suggestion
# Expression-level preferences
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:silent
dotnet_prefer_inferred_tuple_names = true:suggestion
dotnet_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_prefer_auto_properties = true:silent
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
dotnet_style_prefer_conditional_expression_over_return = true:silent
###############################
# Naming Conventions #
###############################
# Style Definitions
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
# Use PascalCase for constant fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
dotnet_naming_symbols.constant_fields.applicable_kinds = field
dotnet_naming_symbols.constant_fields.applicable_accessibilities = *
dotnet_naming_symbols.constant_fields.required_modifiers = const
###############################
# C# Coding Conventions #
###############################
[*.cs]
# var preferences
csharp_style_var_for_built_in_types = true:silent
csharp_style_var_when_type_is_apparent = true:silent
csharp_style_var_elsewhere = true:silent
# Expression-bodied members
csharp_style_expression_bodied_methods = false:silent
csharp_style_expression_bodied_constructors = false:silent
csharp_style_expression_bodied_operators = false:silent
csharp_style_expression_bodied_properties = true:silent
csharp_style_expression_bodied_indexers = true:silent
csharp_style_expression_bodied_accessors = true:silent
# Pattern matching preferences
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
# Null-checking preferences
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion
# Modifier preferences
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion
# Expression-level preferences
csharp_prefer_braces = true:silent
csharp_style_deconstructed_variable_declaration = true:suggestion
csharp_prefer_simple_default_expression = true:suggestion
csharp_style_pattern_local_over_anonymous_function = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
###############################
# C# Formatting Rules #
###############################
# New line preferences
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_between_query_expression_clauses = true
# Indentation preferences
csharp_indent_case_contents = true
csharp_indent_switch_labels = true
csharp_indent_labels = flush_left
# Space preferences
csharp_space_after_cast = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_around_binary_operators = before_and_after
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
# Wrapping preferences
csharp_preserve_single_line_statements = true
csharp_preserve_single_line_blocks = true
###############################
# VB Coding Conventions #
###############################
[*.vb]
# Modifier preferences
visual_basic_preferred_modifier_order = Partial,Default,Private,Protected,Public,Friend,NotOverridable,Overridable,MustOverride,Overloads,Overrides,MustInherit,NotInheritable,Static,Shared,Shadows,ReadOnly,WriteOnly,Dim,Const,WithEvents,Widening,Narrowing,Custom,Async:suggestion
33 changes: 28 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Report a bug or requesting feature

Reporting bug is an important contribution. Please make sure to include:
Reporting bugs is an important contribution. Please make sure to include:

- expected and actual behavior.
- dotnet version that application is compiled on and running with (it may be
Expand All @@ -13,15 +13,38 @@ Reporting bug is an important contribution. Please make sure to include:

## How to contribute

### Before started
### Before you start

Please read project contribution
[guide](https://github.com/open-telemetry/community/blob/master/CONTRIBUTING.md)
for general practices for OpenTelemetry project.

### Fork

In the interest of keeping this repository clean and manageable, you should work from a fork. To create a fork, click the 'Fork' button at the top of the repository, then clone the fork locally using `git clone git@github.com:USERNAME/opentelemetry-dotnet.git`.

You should also add this repository as an "upstream" repo to your local copy, in order to keep it up to date. You can add this as a remote like so:
```
git remote add upstream https://github.com/open-telemetry/opentelemetry-dotnet.git

#verify that the upstream exists
git remote -v
```

To update your fork, fetch the upstream repo's branches and commits, then merge your master with upstream's master:
```
git fetch upstream
git checkout master
git merge upstream/master
```

Remember to always work in a branch of your local copy, as you might otherwise have to contend with conflicts in master.

Please also see [GitHub workflow](https://github.com/open-telemetry/community/blob/master/CONTRIBUTING.md#github-workflow) section of general project contributing guide.

### Build

You can use Visual Studio 2017+ or VS code to contribute. Just open root folder
You can use Visual Studio 2017+ or VS Code to contribute. Just open root folder
or `OpenTelemetry.sln` in your editor and follow normal development process.

To build from command line you need `dotnet` version `2.0+`.
Expand All @@ -32,7 +55,7 @@ dotnet build OpenTelemetry.sln

### Test

You can use Visual Studio 2017 or VS code to test your contribution. Open root
You can use Visual Studio 2017 or VS Code to test your contribution. Open root
folder or `OpenTelemetry.sln` in your editor and follow normal development
process.

Expand All @@ -48,4 +71,4 @@ Create a Pull Request with your changes. Please add any user-visible changes to
`CHANGELOG.md`. The continuous integration build will run the tests and static
analysis. It will also check that the pull request branch has no merge commits.
When the changes are accepted, they will be merged or cherry-picked by an
OpenTelemetry repository maintainers.
OpenTelemetry repository maintainers.
1 change: 1 addition & 0 deletions OpenTelemetry.sln
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Tests", "test
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B7408D66-487A-40E1-BDB7-BC17BD28F721}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
CHANGELOG.md = CHANGELOG.md
CONTRIBUTING.md = CONTRIBUTING.md
NuGet.config = NuGet.config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ public sealed class TraceParams : ITraceParams
/// Default trace parameters.
/// </summary>
public static readonly ITraceParams Default =
new TraceParams(Samplers.GetProbabilitySampler(DefaultProbability), DefaultSpanMaxNumAttributes, DefaultSpanMaxNumEvents, DefaultSpanMaxNumMessageEvents, DefaultSpanMaxNumLinks);
new TraceParams(Samplers.AlwaysSample, DefaultSpanMaxNumAttributes, DefaultSpanMaxNumEvents, DefaultSpanMaxNumMessageEvents, DefaultSpanMaxNumLinks);

private const double DefaultProbability = 1e-4;
private const int DefaultSpanMaxNumAttributes = 32;
private const int DefaultSpanMaxNumEvents = 32;
private const int DefaultSpanMaxNumMessageEvents = 128;
Expand Down
3 changes: 1 addition & 2 deletions src/OpenTelemetry.Abstractions/Trace/ISampler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public interface ISampler
/// Checks whether span needs to be created and tracked.
/// </summary>
/// <param name="parentContext">Parent span context. Typically taken from the wire.</param>
/// <param name="hasRemoteParent">Indicates whether it was a remote parent.</param>
/// <param name="traceId">Trace ID of a span to be created.</param>
/// <param name="spanId">Span ID of a span to be created.</param>
/// <param name="name"> Name of a span to be created. Note, that the name of the span is settable.
Expand All @@ -42,6 +41,6 @@ public interface ISampler
/// </param>
/// <param name="parentLinks">Links associated with the parent span.</param>
/// <returns>True of span needs to be created. False otherwise.</returns>
bool ShouldSample(ISpanContext parentContext, bool hasRemoteParent, ITraceId traceId, ISpanId spanId, string name, IEnumerable<ISpan> parentLinks);
bool ShouldSample(SpanContext parentContext, ITraceId traceId, ISpanId spanId, string name, IEnumerable<ISpan> parentLinks);
}
}
63 changes: 35 additions & 28 deletions src/OpenTelemetry.Abstractions/Trace/ISpan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,44 +27,35 @@ namespace OpenTelemetry.Trace
/// </summary>
public interface ISpan
{
/// <summary>
/// Gets the span name. Use <code>UpdateSpan</code> to explicitly set the span name.
/// </summary>
string Name { get; }

/// <summary>
/// Gets the span context.
/// </summary>
ISpanContext Context { get; }

/// <summary>
/// Gets the span options.
/// </summary>
SpanOptions Options { get; }
SpanContext Context { get; }

/// <summary>
/// Gets or sets the status of the span execution.
/// Gets a value indicating whether this span will be recorded.
/// </summary>
Status Status { get; set; }
bool IsRecordingEvents { get; }

/// <summary>
/// Gets or sets the kind of a span.
/// Sets the status of the span execution.
/// </summary>
SpanKind? Kind { get; set; }
Status Status { set; }

/// <summary>
/// Gets a value indicating whether this span was already stopped.
/// </summary>
/// <remarks>This method is not compliant with the specification. https://github.com/open-telemetry/opentelemetry-specification/issues/55</remarks>
bool HasEnded { get; }

/// <summary>
/// Updates the <code>Span</code> name.
/// Updates the <see cref="Span"/> name.
///
/// If used, this will override the name provided via <code>SpanBuilder</code>.
/// Upon this update, any sampling behavior based on <code>Span</code> name will depend on the
/// If used, this will override the name provided via <see cref="ISpanBuilder"/>.
/// Upon this update, any sampling behavior based on <see cref="Span"/> name will depend on the
/// implementation.
/// </summary>
/// <param name="name">name of the span.</param>
/// <param name="name">Name of the span.</param>
void UpdateName(string name);

/// <summary>
Expand All @@ -75,10 +66,32 @@ public interface ISpan
void SetAttribute(string key, IAttributeValue value);

/// <summary>
/// Puts a list of attributes to the span.
/// Puts a new attribute to the span.
/// </summary>
/// <param name="key">Key of the attribute.</param>
/// <param name="value">Attribute value.</param>
void SetAttribute(string key, string value);

/// <summary>
/// Puts a new attribute to the span.
/// </summary>
/// <param name="key">Key of the attribute.</param>
/// <param name="value">Attribute value.</param>
void SetAttribute(string key, long value);

/// <summary>
/// Puts a new attribute to the span.
/// </summary>
/// <param name="attributes">Collection of attributes name/value pairs.</param>
void SetAttributes(IDictionary<string, IAttributeValue> attributes);
/// <param name="key">Key of the attribute.</param>
/// <param name="value">Attribute value.</param>
void SetAttribute(string key, double value);

/// <summary>
/// Puts a new attribute to the span.
/// </summary>
/// <param name="key">Key of the attribute.</param>
/// <param name="value">Attribute value.</param>
void SetAttribute(string key, bool value);

/// <summary>
/// Adds a single <see cref="IEvent"/> to the <see cref="ISpan"/>.
Expand All @@ -105,12 +118,6 @@ public interface ISpan
/// <param name="link">Link to add to the span.</param>
void AddLink(ILink link);

/// <summary>
/// Complete the span and set end span options.
/// </summary>
/// <param name="options">Span completion options.</param>
void End(EndSpanOptions options);

/// <summary>
/// End the span.
/// </summary>
Expand Down
49 changes: 0 additions & 49 deletions src/OpenTelemetry.Abstractions/Trace/ISpanContext.cs

This file was deleted.

Loading