1 | // Copyright (c) Microsoft. All rights reserved.
|
---|
2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
---|
3 |
|
---|
4 | /** @file iothub_client_diagnostic.h
|
---|
5 | * @brief The @c diagnostic is a component that helps to add predefined diagnostic
|
---|
6 | properties to message for end to end diagnostic purpose
|
---|
7 | */
|
---|
8 |
|
---|
9 | #ifndef IOTHUB_CLIENT_DIAGNOSTIC_H
|
---|
10 | #define IOTHUB_CLIENT_DIAGNOSTIC_H
|
---|
11 |
|
---|
12 | #include "azure_c_shared_utility/umock_c_prod.h"
|
---|
13 |
|
---|
14 | #include "iothub_message.h"
|
---|
15 | #include <stdint.h>
|
---|
16 |
|
---|
17 | #ifdef __cplusplus
|
---|
18 | #include <cstddef>
|
---|
19 | extern "C" {
|
---|
20 | #else
|
---|
21 | #include <stddef.h>
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | /** @brief diagnostic related setting */
|
---|
25 | typedef struct IOTHUB_DIAGNOSTIC_SETTING_DATA_TAG
|
---|
26 | {
|
---|
27 | uint32_t diagSamplingPercentage;
|
---|
28 | uint32_t currentMessageNumber;
|
---|
29 | } IOTHUB_DIAGNOSTIC_SETTING_DATA;
|
---|
30 |
|
---|
31 | /**
|
---|
32 | * @brief Adds diagnostic information to message if:
|
---|
33 | * a. diagSetting->diagSamplingPercentage > 0 and
|
---|
34 | * b. the number of current message matches sample rule specified by diagSetting->diagSamplingPercentage
|
---|
35 | *
|
---|
36 | * @param diagSetting Pointer to an @c IOTHUB_DIAGNOSTIC_SETTING_DATA structure
|
---|
37 | *
|
---|
38 | * @param messageHandle message handle
|
---|
39 | *
|
---|
40 | * @return 0 upon success
|
---|
41 | */
|
---|
42 | MOCKABLE_FUNCTION(, int, IoTHubClient_Diagnostic_AddIfNecessary, IOTHUB_DIAGNOSTIC_SETTING_DATA *, diagSetting, IOTHUB_MESSAGE_HANDLE, messageHandle);
|
---|
43 |
|
---|
44 | #ifdef __cplusplus
|
---|
45 | }
|
---|
46 | #endif
|
---|
47 |
|
---|
48 | #endif /* IOTHUB_CLIENT_DIAGNOSTIC_H */
|
---|