series

  1. Sentry-Go SDK Chinese Practice Guide
  2. Let's brush together Sentry For Go Official document Enriching Events
  3. Snuba:Sentry New search infrastructure ( be based on ClickHouse above )
  4. Sentry 10 K8S Cloud native architecture exploration ,Vue App 1 Minutes fast access
  5. Sentry(v20.12.1) K8S Cloud native architecture exploration , Before you play / Back end monitoring and event log big data analysis , High performance and high availability + Scalable cluster deployment
  6. Sentry(v20.12.1) K8S Cloud native architecture exploration ,Sentry JavaScript SDK Three ways to install and load
  7. Sentry(v20.12.1) K8S Cloud native architecture exploration ,SENTRY FOR JAVASCRIPT SDK Configuration details
  8. Sentry(v20.12.1) K8S Cloud native architecture exploration , SENTRY FOR JAVASCRIPT Basic usage of manually capturing Events
  9. Sentry(v20.12.1) K8S Cloud native architecture exploration ,SENTRY FOR JAVASCRIPT Source Maps Detailed explanation
  10. Sentry(v20.12.1) K8S Cloud native architecture exploration ,SENTRY FOR JAVASCRIPT Troubleshooting
  11. Sentry(v20.12.1) K8S Cloud native architecture exploration ,1 Minutes to go JavaScript Performance monitoring
  12. Sentry(v20.12.1) K8S Cloud native architecture exploration ,JavaScript Management of performance monitoring Transactions

There are two ways you can control sending to Sentry Of transactions The amount of .

Uniform Sample Rate

If you wish transactions Of cross-section uniform , No matter where or under what circumstances you are in the application , And satisfied with the default inheritance and priority behavior described below , Setting a uniform sampling rate is a good choice .

So , Please put Sentry.init() Medium tracesSampleRate Option set to 0 To 1 A number between . After setting this option , Each created transaction There will be a percentage of opportunities sent to Sentry.( therefore , for example , If you will tracesSampleRate Set to 0.2, Will record and send about 20% Of transactions.) As shown below :

Sentry.init({
// ... tracesSampleRate: 0.2,
});

Dynamic Sampling Function

If you meet the following conditions , The sampling function is a good choice :

  • Want to be different rates Sampling different transactions
  • Want to filter out some completely transactions
  • To modify the default priority and inheritance behavior described below

To do dynamic sampling , Please put Sentry.init() Medium tracesSampler Option is set to a function , This function will accept samplingContext Object and return 0 To 1 The sampling rate between . for example :

Sentry.init({
// ... tracesSampler: samplingContext => {
// Examine provided context data (including parent decision, if any) along
// with anything in the global namespace to compute the sample rate or
// sampling decision for this transaction if ("...") {
// These are important - take a big sample
return 0.5;
} else if ("...") {
// These are less important or happen much more frequently - only take 1%
return 0.01;
} else if ("...") {
// These aren't something worth tracking - drop all transactions like this
return 0;
} else {
// Default sample rate
return 0.1;
}
};
});

For convenience , This function can also return Boolean values . return true Equal to return to 1, And guarantee that transaction Will be sent to Sentry. return false Equal to return to 0, This will ensure that transaction Send to Sentry.

Default Sampling Context Data

establish transaction when , Pass to tracesSampler Of samplingContext The information contained in the object varies by platform and integration .

For browser based SDK, It includes at least the following :

// contents of `samplingContext`
{
transactionContext: {
name: string; // human-readable identifier, like "GET /users"
op: string; // short description of transaction type, like "pageload"
}
parentSampled: boolean; // if this transaction has a parent, its sampling decision
location: Location | WorkerLocation; // the window.location or self.location object
... // custom context as passed to `startTransaction`
}

Custom Sampling Context Data

Manually create transaction when , You can pass the data as an optional second parameter to startTransaction To add data to samplingContext. If you want the sampler to be accessible but don't want it to be tags or data Attach to transaction Data in ( For example, sensitive information or too large to follow transaction Messages sent ), This will be very useful . for example :

Sentry.startTransaction(
{
// `transactionContext` - will be recorded on transaction
name: 'Search from navbar',
op: 'search',
tags: {
testGroup: 'A3',
treatmentName: 'eager load',
},
},
// `customSamplingContext` - won't be recorded
{
// PII
userId: '12312012',
// too big to send
resultsFromLastSearch: { ... }
},
);

Inheritance

No matter what transaction What is the sampling decision of , The decision will be passed on to child spans, And from there to any... That they subsequently cause in other services transactions.( More about how to complete the dissemination , Please see the Connecting Backend and Frontend Transactions.)

If you are currently creating transaction It's the follow-up transactions One of ( let me put it another way , If it has a father transaction), Then upstream ( Father ) Sampling decisions will always be included in the sampling context data , So that your tracesSampler Choose whether and when to inherit the decision .( in the majority of cases , Inheritance is the right choice , So there's no partial tracking .)

In some SDK in , For convenience ,tracesSampler Function can return a Boolean value , such , If this is the expected behavior , You can return to the parent's decision directly .

tracesSampler: samplingContext => {
// always inherit
if (samplingContext.parentSampled !== undefined) {
return samplingContext.parentSampled
} ...
// rest of sampling logic here
}

If you are using tracesSampleRate instead of tracesSampler , Then the decision will always be inherited .

Forcing a Sampling Decision

If in transaction When you create it, you know if you want to transaction Send to Sentry, You can also choose to pass the sampling decision directly to transaction Constructors ( Please note that , be not in customSamplingContext In the object ). If you do , be transaction Will not accept tracesSampleRate Constraints , And it won't run tracesSampler, So you can count on the decisions passed not to be covered .

Sentry.startTransaction({
name: "Search from navbar",
sampled: true,
});

Precedence

transaction There are many ways to make sampling decisions .

  • Based on tracesSampleRate Random sampling at the static sampling rate set in
  • according to tracesSampler Return the dynamic sampling rate for random sampling
  • tracesSampler The absolute decision of return (100% Opportunity or 0% The opportunity to )
  • If transaction There's a parent , Then it inherits the sampling decision of its parent
  • Absolute decision-making power is passed on to startTransaction

When more than one situation is possible , The following priority rules should be followed :

  1. If you pass the sampling decision to startTransaction( See... Above Forcing a Sampling Decision), Regardless of any other factor , Will use that decision .
  2. If you define tracesSampler , Will use its decision . It can choose to keep or ignore any parent sampling decision , Or use sampling context data to make your own decisions , Or for transaction Choose a sampling rate .
  3. If not defined tracesSampler, But there is a parent sampling decision , Then the parent sampling decision is used .
  4. If not defined tracesSampler And there is no parent sampling decision , Will use tracesSampleRate.

Chinese documents are synchronized to :

 I'm for less .
WeChat :uuhells123.
official account : Hacker afternoon tea .
Thank you for your support !

Sentry(v20.12.1) K8S Cloud native architecture exploration ,JavaScript Sampling for performance monitoring Transactions More articles about

  1. Docker Data Center series ( One )- Quickly build the practice environment of cloud native architecture

    This series of articles demonstrates how to quickly build a simple cloud native architecture practice environment . Based on this infrastructure , The application stack of microservice architecture can be continuously deployed , Practice agile development process , promote DevOps Practical ability . 1 The overall planning 1.1 topology 1.2 Basics ...

  2. .NET Cloud native architect training camp ( Module one Architects and cloud natives )-- Learning notes

    Catalog What is software architecture The basic idea of software architecture Monomer evolves to distributed . Cloud native . Technology Center 1.1 What is software architecture 1.1.1 What is architecture ? Software architecture = {Elements, F ...

  3. new book 《OpenShift Cloud native architecture : Principle and practice 》 Chapter one, section three : Enterprise class PaaS platform OpenShift

    In the past ten years , The field of information technology is undergoing a technological revolution , This change is transforming us from tradition IT Architecture and the era of bloated application system supported by it , Move to the era of cloud native architecture and its supporting agile application system . In this revolution , The emergence of new technology . The speed of renewal and elimination , as well as ...

  4. Jmeter Tool use - Distributed architecture and server performance monitoring solutions

    When doing large concurrent performance testing on a project , We often encounter a large number of concurrent ( For example, you need support 10000 Concurrent ), The configuration of a single computer (CPU And memory ) May not be able to support , You can use Jmeter Provide the function of distributed testing to build a distributed concurrent environment . One .J ...

  5. 12-Factor With cloud native Part2

    12-Factor With cloud native Part2 12-Factor To build the following SaaS Application provides methodology : Use declarative format to build automation , So that new developers spend the least learning cost to join the project Keep it simple with the underlying operating system ...

  6. Review of yunqi dry goods | Cloud native database POLARDB Special field “ hardcore ” analysis

    POLARDB It is a cloud native relational database independently developed by Alibaba , Currently compatible with three database engines :MySQL.PostgreSQL.Oracle.POLARDB The computing power can be expanded to 1000 Supranuclear , Storage capacity up to 100TB ...

  7. 《Kubernetes And cloud native applications 》 Container design pattern of series

    http://www.infoq.com/cn/articles/kubernetes-and-cloud-native-app-container-design-pattern <Kubern ...

  8. Ambassador, Cloud native applications “ goalkeeper ”

    at present , Open source projects in the industry based on the original idea of cloud , It's about management . Control micro service and communication between services under micro service architecture . They effectively solve “ Service isomerization ”.“ Dynamic ”.“ multi-protocol ” What the scene brings east/west Traffic control issues , and ...

  9. Cloud native GIS technology

    Cloud native Architecture Overview - DockOne.io  http://dockone.io/article/2991 Cloud native GIS The whole interpretation of Technology - SuperMap Technology control - CSDN Blog   https://blo ...

  10. How to map cloud native workload to Kubernetes Controller in

    author :Janakiram MSV translator : Yin Longfei Original address :https://thenewstack.io/how-to-map-cloud-native-workloads-to-kubernetes- ...

Random recommendation

  1. Android Database upgrade solution

    from :http://blog.csdn.net/leehong2005/article/details/9128501 Consider the following : During database upgrade , Different versions of database , The table structure they define is probably not ...

  2. Unity5 New function analysis -- Physical rendering and standard shader

    Unity5 New function analysis -- Physical rendering and standard shader http://blog.csdn.net/leonwei/article/details/48395061 Physical rendering is UNITY5 ...

  3. One of the shortest path algorithms ——Floyd Algorithm

    Floyd Algorithm Floyd The algorithm can be used to solve the shortest path problem between any two vertices . The core formula is : Edge[i][j]=Min{Edge[i][j],Edge[i][k]+Edge[k][j]}. That is, through the right i ...

  4. Hadoop core-site.xml List of configuration items

    core-default.xml And core-site.xml The function of is the same , If in core-site.xml There are no configured properties in , Will automatically get core-default.xml The value of the same property in Official documents : ...

  5. dbcp Write connection pool Demo

    1. Guide pack 2. Prepare the configuration file    .properties( notes : The parameter name here driverClassName.url.username And so on can't be changed ) The reason you can't name anything is [ Do you know ] 3.Demo publ ...

  6. jqgird practice

    $.jgrid.defaults.styleUI="Bootstrap"; $("#table_list_2").jqGrid({ multiselect: t ...

  7. mongoDB The set operation of

    mongoDB The set operation of mongoDB The set in is equivalent to mysql In the table . mongoDB The creation of collections in : The first way : Unlimited set size    db.createCollection(" Collection name &q ...

  8. web front end (5)—— Commonly used labels 2

    The following three are not just common tags , It's also very important , So please make sure it looks good , Importance goes from high to low : The box model div div Tags are the most common and important , It can be web The page is divided into many small pieces and managed separately Test code : <!DOCTYPE h ...

  9. INCLUDE COMMON FILES IN HTML USING JQUERY

    Simple example for including common files in HTML. JQuery load() function is used for including comm ...

  10. docker Subtotal of commands to delete useless image files

    df -h  View the memory status of the current server docker system prune  Delete useless image file command perform ok after , Check the memory again .