UNPKG

@opentelemetry/resources

Version:
47 lines 2.1 kB
/*! * Copyright 2020, OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { Resource } from '../../../Resource'; import { Detector } from '../../../types'; /** * The AwsEc2Detector can be used to detect if a process is running in AWS EC2 * and return a {@link Resource} populated with metadata about the EC2 * instance. Returns an empty Resource if detection fails. */ declare class AwsEc2Detector implements Detector { /** * See https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-identity-documents.html * for documentation about the AWS instance identity document endpoint. */ readonly AWS_INSTANCE_IDENTITY_DOCUMENT_URI = "http://169.254.169.254/latest/dynamic/instance-identity/document"; /** * Attempts to connect and obtain an AWS instance Identity document. If the * connection is succesful it returns a promise containing a {@link Resource} * populated with instance metadata as labels. Returns a promise containing an * empty {@link Resource} if the connection or parsing of the identity * document fails. */ detect(): Promise<Resource>; /** * Establishes an HTTP connection to AWS instance identity document url. * If the application is running on an EC2 instance, we should be able * to get back a valid JSON document. Parses that document and stores * the identity properties in a local map. */ private _awsMetadataAccessor; } export declare const awsEc2Detector: AwsEc2Detector; export {}; //# sourceMappingURL=AwsEc2Detector.d.ts.map