-
-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9dc332f
commit 26ff58a
Showing
4 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// sentry_sampling_context.c | ||
#include "sentry_sampling_context.h" | ||
#include <sentry_alloc.h> | ||
#include <stdlib.h> | ||
|
||
sentry_sampling_context_t *sentry_sampling_context_new(sentry_transaction_context_t *transaction_context) { | ||
sentry_sampling_context_t *context = SENTRY_MAKE(sentry_sampling_context_t); | ||
if (context) { | ||
context->transaction_context = transaction_context; // todo incref? | ||
context->custom_sampling_context = NULL; | ||
} | ||
return context; | ||
} | ||
|
||
sentry_sampling_context_t *sentry_sampling_context_new_with_custom(sentry_transaction_context_t *transaction_context, void *custom_sampling_context) { | ||
sentry_sampling_context_t *context = sentry_sampling_context_new(transaction_context); | ||
if (context) { | ||
context->custom_sampling_context = custom_sampling_context; | ||
} | ||
return context; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// sentry_sampling_context.h | ||
#ifndef SENTRY_SAMPLING_CONTEXT_H_INCLUDED | ||
#define SENTRY_SAMPLING_CONTEXT_H_INCLUDED | ||
|
||
#include "sentry_tracing.h" | ||
|
||
typedef struct sentry_sampling_context_s { | ||
sentry_transaction_context_t *transaction_context; | ||
void *custom_sampling_context; // TODO what type should this be? | ||
} sentry_sampling_context_t; | ||
|
||
// TODO add refcounting for this; users might want to reuse this | ||
sentry_sampling_context_t *sentry_sampling_context_new(sentry_transaction_context_t *transaction_context); | ||
sentry_sampling_context_t *sentry_sampling_context_new_with_custom(sentry_transaction_context_t *transaction_context, void *custom_sampling_context); | ||
|
||
#endif // SENTRY_SAMPLING_CONTEXT_H_INCLUDED |