UNPKG

1.8 kBTypeScriptView Raw
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 */
16import { TagKey, TagMetadata, TagValue, TagValueWithMetadata } from './types';
17/** TagMap is maps of TagKey -> TagValueWithMetadata */
18export declare class TagMap {
19 private readonly registeredTags;
20 /**
21 * Adds the key/value pair regardless of whether the key is present.
22 * @param tagKey The TagKey which will be set.
23 * @param tagValue The TagValue to set for the given key.
24 * @param tagMetadata The TagMetadata associated with this Tag.
25 */
26 set(tagKey: TagKey, tagValue: TagValue, tagMetadata?: TagMetadata): void;
27 /**
28 * Deletes a tag from the map if the key is in the map.
29 * @param tagKey The TagKey which will be removed.
30 */
31 delete(tagKey: TagKey): void;
32 /** Gets the tags map without metadata. */
33 readonly tags: Map<TagKey, TagValue>;
34 /** Gets the tags map with metadata. */
35 readonly tagsWithMetadata: Map<TagKey, TagValueWithMetadata>;
36 /**
37 * Constructs a new TagValueWithMetadata using tagValue and tagMetadata.
38 * For backwards-compatibility this method still produces propagating Tags
39 * (UNLIMITED_PROPAGATION) if tagMetadata is not provided or missing.
40 */
41 private getValueWithMetadata;
42}