1 | /**
|
2 | * Copyright 2019, OpenCensus Authors
|
3 | *
|
4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | * you may not use this file except in compliance with the License.
|
6 | * You may obtain a copy of the License at
|
7 | *
|
8 | * http://www.apache.org/licenses/LICENSE-2.0
|
9 | *
|
10 | * Unless required by applicable law or agreed to in writing, software
|
11 | * distributed under the License is distributed on an "AS IS" BASIS,
|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 | * See the License for the specific language governing permissions and
|
14 | * limitations under the License.
|
15 | */
|
16 | import * as cls from '../internal/cls';
|
17 | import { TagMap } from './tag-map';
|
18 | export declare const EMPTY_TAG_MAP: TagMap;
|
19 | /** Gets the current tag context. */
|
20 | export declare function getCurrentTagContext(contextManager: cls.Namespace): TagMap;
|
21 | /**
|
22 | * Sets the current tag context.
|
23 | * @param tags The TagMap.
|
24 | */
|
25 | export declare function setCurrentTagContext(contextManager: cls.Namespace, tags: TagMap): void;
|
26 | /**
|
27 | * Enters the scope of code where the given `TagMap` is in the current context
|
28 | * (replacing the previous `TagMap`).
|
29 | * @param tags The TagMap to be set to the current context.
|
30 | * @param fn Callback function.
|
31 | * @returns The callback return.
|
32 | */
|
33 | export declare function withTagContext<T>(contextManager: cls.Namespace, tags: TagMap, fn: cls.Func<T>): T;
|
34 | /** Clear the current tag context. */
|
35 | export declare function clear(contextManager: cls.Namespace): void;
|