Commit 84f65569 authored by Liuhaoyang's avatar Liuhaoyang

refactor

parent c295204b
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*
*/
using System.Threading.Tasks;
namespace SkyWalking.Boot
{
public interface IBootService
{
Task Executing();
Task Executed();
}
}
\ No newline at end of file
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*
*/
namespace SkyWalking.Config
{
public static class AgentConfig
{
/// <summary>
/// Namespace isolates headers in cross propagation. The HEADER name will be 'HeaderName:Namespace'.
/// </summary>
public static string Namespace { get; set; }
/// <summary>
/// Application code is showed in sky-walking-ui
/// </summary>
public static string ApplicationCode { get; set; }
/// <summary>
/// Negative or zeor means off ,by default. Sample_N_Per_3_Secs means sampling N TraceSegment in 10 seconds tops.
/// </summary>
public static int Sample_N_Per_3_Secs = -1;
/// <summary>
/// If the operation name of the first span is included in this set, this segment should be ignored.
/// </summary>
public static string IgnoreSuffix = ".jpg,.jpeg,.js,.css,.png,.bmp,.gif,.ico,.mp3,.mp4,.html,.svg";
/// <summary>
/// The max number of spans in a single segment. Through this config item, skywalking keep your application memory cost estimated.
/// </summary>
public static int SpanLimitPerSegment = 300;
}
}
\ No newline at end of file
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using SkyWalking.Config;
namespace SkyWalking.Context namespace SkyWalking.Context
{ {
...@@ -57,7 +58,14 @@ namespace SkyWalking.Context ...@@ -57,7 +58,14 @@ namespace SkyWalking.Context
public CarrierItem(String headKey, String headValue, CarrierItem next) public CarrierItem(String headKey, String headValue, CarrierItem next)
{ {
_headKey = headKey; if (string.IsNullOrEmpty(AgentConfig.Namespace))
{
_headKey = headKey;
}
else
{
_headKey = $"{AgentConfig.Namespace}:{headKey}";
}
_headValue = headValue; _headValue = headValue;
_next = next; _next = next;
} }
......
...@@ -16,12 +16,30 @@ ...@@ -16,12 +16,30 @@
* *
*/ */
using System; using SkyWalking.Context.Trace;
namespace SkyWalking.Context namespace SkyWalking.Context
{ {
public interface ITracerContext public interface ITracerContext
{ {
void Inject(IContextCarrier carrier);
void Extract(IContextCarrier carrier);
IContextSnapshot Capture { get; }
ISpan ActiveSpan { get; }
void Continued(IContextSnapshot snapshot);
string GetReadableGlobalTraceId();
ISpan CreateEntrySpan(string operationName);
ISpan CreateLocalSpan(string operationName);
ISpan CreateExitSpan(string operationName, string remotePeer);
void StopSpan(ISpan span);
} }
} }
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*
*/
using SkyWalking.Boot;
namespace SkyWalking.Sampling
{
public interface ISampler : IBootService
{
bool TrySampling();
void ForceSampled();
}
}
\ No newline at end of file
namespace SkyWalking.Context /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*
*/
using SkyWalking.Context.Trace;
namespace SkyWalking.Context
{ {
public class TracingContext public class TracingContext: ITracerContext
{ {
private long _lastWarningTimestamp = 0;
public void Inject(IContextCarrier carrier)
{
throw new System.NotImplementedException();
}
public void Extract(IContextCarrier carrier)
{
throw new System.NotImplementedException();
}
public IContextSnapshot Capture { get; }
public ISpan ActiveSpan { get; }
public void Continued(IContextSnapshot snapshot)
{
throw new System.NotImplementedException();
}
public string GetReadableGlobalTraceId()
{
throw new System.NotImplementedException();
}
public ISpan CreateEntrySpan(string operationName)
{
throw new System.NotImplementedException();
}
public ISpan CreateLocalSpan(string operationName)
{
throw new System.NotImplementedException();
}
public ISpan CreateExitSpan(string operationName, string remotePeer)
{
throw new System.NotImplementedException();
}
public void StopSpan(ISpan span)
{
throw new System.NotImplementedException();
}
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment