OpenTelemetry 수집기를 사용하여 Redis 인스턴스에 대한 지표를 수집할 수 있습니다. 수집기는 원격 측정 데이터를 수집, 처리하고 New Relic(또는 모든 관찰 가능성 백엔드)으로 내보내는 OpenTelemetry의 구성 요소입니다. Redis 수신기는 단일 Redis 인스턴스에서 Redis INFO 데이터를 검색하고, 해당 데이터에서 지표를 구축하고, 구성 가능한 간격으로 다음 소비자에게 전송하도록 설계되었습니다.
설치 단계를 거친 후에는 사전 구축된 대시보드에서 이 지표 데이터를 확인하고, 경고 정책을 생성하고, 사용자 지정 쿼리 및 차트를 생성하게 됩니다.
전제 조건
Redis 지표 수집을 시작하려면 무료 New Relic 계정에 가입해야 합니다.
가입한 후 다음을 설정했는지 확인하세요.
- Redis 수신기 구성 요소는 수집기가 엔드포인트를 통해 Redis에 액세스해야 하기 때문입니다. 권장되는 최소 버전은 v0.83.0입니다.
- OpenTelemetry 문서를따르는 OpenTelemetry 수집기
OpenTelemetry 수집기 설치
OpenTelemetry 배포판 설치
OpenTelemetry Collector Contrib Distro 를 설치해야 합니다. 다른 배포판을 사용하는 경우 선택한 배포판에 다음 구성 요소가 있는지 확인하세요.
중요
배포판에 이러한 구성 요소가 없으면 다음 단계의 구성 파일이 적용되지 않습니다 .
OpenTelemetry 수집기 구성
config.yaml
이라는 새 파일을 업데이트하거나 만듭니다. 새 파일에 다음 스니펫을 삽입하세요.
receivers: redis: endpoint: "<YOUR_REDIS_HOSTNAME>:<REDIS_PORT>" metrics: # Enable redis.maxmemory optional metric redis.maxmemory: enabled: true
processors: # This is needed since redis receiver is not currently adding any means to understand to which redis server the metrics are referring to attributes/redis_metrics: include: match_type: regexp metric_names: # Notice that if with single or without quotes just one backslash is needed 'redis\..*' - "redis\\..*" actions: - action: upsert key: server.address value: "<YOUR_REDIS_HOSTNAME>" - action: upsert key: server.port value: "<REDIS_PORT>" # resource and resource-detection processors allow decorating the metrics with host attributes resource: attributes: - key: host.id from_attribute: host.name action: insert resourcedetection: detectors: ["env", "system"] resourcedetection/cloud: detectors: ["gcp", "ec2", "azure"] timeout: 2s override: false
exporters: otlphttp: endpoint: https://otlp.nr-data.net headers: api-key: <NEW_RELIC_LICENSE_KEY>
service: telemetry: logs: pipelines: metrics: receivers: [redis] processors: - resourcedetection - resourcedetection/cloud - resource - attributes/redis_metrics exporters: [otlphttp]
- 파일의
NEW_RELIC_LICENSE_KEY
를 고유한 값으로 바꿉니다. 자세한 내용은 New Relic 라이선스 키를 참조하세요. - Otel 수신기는 redis 측정항목에 식별자를 첨부하지 않으므로 측정항목을
server.address
및server.port
메타데이터로 장식하려면 속성 프로세서가 필요합니다. Redis 서버를 구별하는 데이터 패싯을 쿼리하고 New Relic 엔터티를 생성하려면server.address
및server.port
속성이 필요합니다. - 또한 각 인스턴스를 해당 메타데이터로 장식하기 위해 단일 otel 수집기에서 여러 Redis 서버를 모니터링하는 경우
resource/redis_metrics
의 다양한 인스턴스가 있는 별도의 파이프라인이 필요합니다.
다른 구성 옵션을 보려면 다음을 참조하세요.
수집기 실행
OpenTelemetry 수집기를 실행합니다(실행 방법은 선택한 설치 방법에 따라 다를 수 있음). 예:
/usr/bin/otelcol-contrib --config ./config.yaml
측정항목 탐색기로 데이터 쿼리
측정항목 탐색기를 사용하여 수집되는 측정항목을 확인할 수 있습니다. Redis 수신자가 보고하는 모든 측정항목은 "redis."
접두사로 시작됩니다.
다음 NRQL 쿼리는 받은 메트릭을 쿼리하는 데 도움이 되는 예를 보여줍니다.
측정항목 이름별로 수집된 측정항목 업데이트 수 나열:
SELECT count(*) FROM Metric WHERE metricName LIKE 'redis.%' and instrumentation.provider='opentelemetry' facet metricName LIMIT max호스트별로 패싯된 특정 측정항목 쿼리:
SELECT average(redis.commands.processed) FROM Metric WHERE instrumentation.provider='opentelemetry' FACET host.name TIMESERIES지정된 측정항목에 사용할 수 있는 측정기준 나열:
SELECT keyset() FROM Metric WHERE metricName = 'redis.commands.processed'지원되는 모든 지표 목록은 redis 수신자 지표 참조 를 참조하세요.
다음은 뭐지?
Redis 데이터를 New Relic에 보고하면 Redis Open Telemetry 대시보드를 설치할 수 있습니다. 이를 통해 Redis 인프라를 추적하고 모니터링할 수 있도록 사전 제작된 대시보드 환경을 제공합니다.
다른 수집기 사용 사례에 대한 도움말을 찾고 있다면 newrelic-opentelemetry-examples 리포지토리를 참조하세요.